OFBiz
  1. OFBiz
  2. OFBIZ-3385

Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]"

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015

      Description

      I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5.

      I received the following error message:

      com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]
              at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284)
              at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118)
              at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278)
              at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180)
              at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
              at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
              at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
              at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
              at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
              at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
              at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
              at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
              at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
              at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
              at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
              at $Proxy28.findPartiesById(Unknown Source)
              at javaapplication7.Main.main(Main.java:74)
      

      Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items:

      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
         <S:Body>
            <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/">
               <map-Map>
                  <ns2:map-Entry>
                     <ns2:map-Key>
                        <ns2:std-String value="idToFind"/>
                     </ns2:map-Key>
                     <ns2:map-Value>
                        <ns2:std-String value="admin"/>
                     </ns2:map-Value>
                  </ns2:map-Entry>
                  <ns2:map-Entry>
                     <ns2:map-Key>
                        <ns2:std-String value="login.username"/>
                     </ns2:map-Key>
                     <ns2:map-Value>
                        <ns2:std-String value="admin"/>
                     </ns2:map-Value>
                  </ns2:map-Entry>
                  <ns2:map-Entry>
                     <ns2:map-Key>
                        <ns2:std-String value="login.password"/>
                     </ns2:map-Key>
                     <ns2:map-Value>
                        <ns2:std-String value="ofbiz"/>
                     </ns2:map-Value>
                  </ns2:map-Entry>
               </map-Map>
            </ns2:findPartiesById>
         </S:Body>
      </S:Envelope>
      

      If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds:

      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
         <S:Body>
            <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/">
               <map-Map>
                  <map-Entry>
                     <map-Key>
                        <std-String value="idToFind"/>
                     </map-Key>
                     <map-Value>
                        <std-String value="admin"/>
                     </map-Value>
                  </map-Entry>
                  <map-Entry>
                     <map-Key>
                        <std-String value="login.username"/>
                     </map-Key>
                     <map-Value>
                        <std-String value="admin"/>
                     </map-Value>
                  </map-Entry>
                  <map-Entry>
                     <map-Key>
                        <std-String value="login.password"/>
                     </map-Key>
                     <map-Value>
                        <std-String value="ofbiz"/>
                     </map-Value>
                  </map-Entry>
               </map-Map>
            </ns2:findPartiesById>
         </S:Body>
      </S:Envelope>
      

      My java class is:

      package javaapplication7;
      
      import org.apache.ofbiz.service.MapEntry;
      import org.apache.ofbiz.service.MapKey;
      import org.apache.ofbiz.service.MapMap;
      import org.apache.ofbiz.service.MapValue;
      import org.apache.ofbiz.service.StdString;
      
      public class Main {
      
          public static void main(String[] args) {
      
              try { 
                  org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById();
                  org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort();
      
                  StdString keyString = new StdString();
                  keyString.setValue("idToFind");
      
                  MapKey mapKey = new MapKey();
                  mapKey.setStdString(keyString);
                  
                  StdString valueString = new StdString();
                  valueString.setValue("admin");            
                  
                  MapValue mapValue = new MapValue();
                  mapValue.setStdString(valueString);
      
                  MapEntry mapEntry = new MapEntry();
                  mapEntry.setMapKey(mapKey);
                  mapEntry.setMapValue(mapValue);
      
                  StdString keyStringLogin = new StdString();
                  keyStringLogin.setValue("login.username");
      
                  MapKey mapKeyLogin = new MapKey();
                  mapKeyLogin.setStdString(keyStringLogin);
      
                  StdString valueStringLogin = new StdString();
                  valueStringLogin.setValue("admin");
      
                  MapValue mapValueLogin = new MapValue();
                  mapValueLogin.setStdString(valueStringLogin);
      
                  MapEntry mapEntryLogin = new MapEntry();
                  mapEntryLogin.setMapKey(mapKeyLogin);
                  mapEntryLogin.setMapValue(mapValueLogin);
      
                  StdString keyStringPassword = new StdString();
                  keyStringPassword.setValue("login.password");
      
                  MapKey mapKeyPassword = new MapKey();
                  mapKeyPassword.setStdString(keyStringPassword);
      
                  StdString valueStringPassword = new StdString();
                  valueStringPassword.setValue("ofbiz");
      
                  MapValue mapValuePassword = new MapValue();
                  mapValuePassword.setStdString(valueStringPassword);
      
                  MapEntry mapEntryPassword = new MapEntry();
                  mapEntryPassword.setMapKey(mapKeyPassword);
                  mapEntryPassword.setMapValue(mapValuePassword);
      
                  MapMap myMap = new MapMap();
                  myMap.getMapEntry().add(mapEntry);
                  myMap.getMapEntry().add(mapEntryLogin);
                  myMap.getMapEntry().add(mapEntryPassword);
      
                  javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = 
                          new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap);
      
                  port.findPartiesById(mapMap);
      
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
      }
      
      1. patch2.txt
        2 kB
        chris snow
      2. patch.txt
        2 kB
        chris snow

        Issue Links

          Activity

          chris snow created issue -
          chris snow made changes -
          Field Original Value New Value
          Link This issue blocks OFBIZ-3363 [ OFBIZ-3363 ]
          chris snow made changes -
          Attachment patch.txt [ 12429129 ]
          Hans Bakker made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          chris snow made changes -
          Attachment patch2.txt [ 12429514 ]
          chris snow made changes -
          Link This issue incorporates OFBIZ-3394 [ OFBIZ-3394 ]
          Gavin made changes -
          Workflow jira [ 12485617 ] OFbiz Workflow [ 12506042 ]
          Jacques Le Roux made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Sharan Foga made changes -
          Sprint Bug Crush Event - 21/2/2015 [ 91 ]
          Sharan Foga made changes -
          Rank Ranked higher
          Sharan Foga made changes -
          Rank Ranked higher
          Sharan Foga made changes -
          Rank Ranked higher

            People

            • Assignee:
              Unassigned
              Reporter:
              chris snow
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development

                  Agile