javax.xml.ws.WebServiceException: Unexpected response element Response expected: {http://ofbiz.apache.org/service/}findPartiesByIdResponse

Apache's JIRA Issue Tracker | chris snow | 7 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    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: {code} 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) {code} Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: {code} <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> {code} 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: {code} <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> {code} My java class is: {code} 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(); } } } {code}

    Apache's JIRA Issue Tracker | 7 years ago | chris snow
    javax.xml.ws.WebServiceException: Unexpected response element Response expected: {http://ofbiz.apache.org/service/}findPartiesByIdResponse
  2. 0

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

    apache.org | 1 year ago
    javax.xml.ws.WebServiceException: Unexpected response element Response expected: {http:
  3. 0

    PHP WebService not working when invoked from Java or .Net

    Stack Overflow | 6 years ago | JCRamirez
    javax.xml.ws.WebServiceException: Unexpected response element {http://[URLhere]//ws/sWSDL.php}getServiceXMLDetailsResponse expected: {subscriptionWS}getServiceXMLDetailsResponse
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Java - How to connect to Microsoft Office 365 SharePoint

    Stack Overflow | 3 years ago | davedonohue
    javax.xml.ws.WebServiceException: java.net.ProtocolException: Server redirected too many times (20)
  6. 0

    No Content-type in the header! Error while trying to access my Web Service

    Stack Overflow | 4 years ago | Naved Alam
    javax.xml.ws.WebServiceException: No Content-type in the header!

    14 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.xml.ws.WebServiceException

      Unexpected response element Response expected: {http://ofbiz.apache.org/service/}findPartiesByIdResponse

      at com.sun.xml.internal.ws.client.sei.ResponseBuilder$RpcLit.readResponse()
    2. Java RT
      SEIStub.invoke
      1. com.sun.xml.internal.ws.client.sei.ResponseBuilder$RpcLit.readResponse(ResponseBuilder.java:603)
      2. com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110)
      3. com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      4. com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
      4 frames
    3. Unknown
      $Proxy28.findPartiesById
      1. $Proxy28.findPartiesById(Unknown Source)
      1 frame
    4. javaapplication7
      Main.main
      1. javaapplication7.Main.main(Main.java:74)
      1 frame