com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]

Apache's JIRA Issue Tracker | chris snow | 7 years ago
  1. 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
    com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]
  2. 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
    com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]
  3. 0

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

    apache.org | 1 year ago
    com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [Java EE] Przesylanie obiektow :: 4programmers.net

    4programmers.net | 1 year ago
    com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]
  6. 0

    problem to send file

    Coderanch | 6 years ago | mark smith
    com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]

    2 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. 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()
    2. Java RT
      SEIStub.invoke
      1. com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284)
      2. com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118)
      3. com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278)
      4. com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180)
      5. com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
      6. com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
      7. com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
      8. com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
      9. com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
      10. com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
      11. com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
      12. com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
      13. com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
      14. com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      15. com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
      15 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