проблема Java с SOAP-ответом - PullRequest
2 голосов
/ 29 июля 2011

Я звоню в веб-сервис из jax-ws java-клиента, когда я получаю ответ, я получаю исключение о том, что тип контента не поддерживается,

трассировка исключения выглядит следующим образом.

com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/soap+xml Supported ones are: [text/xml]
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:295)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:129)
    at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:360)
    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:187)
    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:94)
    at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:116)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.client.Stub.process(Stub.java:222)
    at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
    at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

Я проверил заголовки в запросе мыла, он показывает, что допустимыми типами контента являются html / xml, text / jpg и т. Д., Но не application / xml + soap.

при тестировании с SoapUI все работает отлично.

мы используем SOAP v1.1 ... но (ясно), что клиент использует SOAP 1.2 ... есть ли способ проанализировать ответ?

Ответы [ 3 ]

3 голосов
/ 29 июля 2011

если вы используете maven в качестве инструмента для сборки, убедитесь, что у вашей цели maven есть протокол XSoap1.2 в качестве протокола .. у нас была похожая проблема, которую мы не могли решить в течение нескольких недель ..

надеюсь, это поможет вам ...

2 голосов
/ 29 июля 2011

Удалено от кто-то еще

  The @BindingType annotation is only necessary as we're using SOAP v1.2.  
  If you forget this line and you've specified SOAP v1.2 in your WSDL you'll 
  receive a runtime exception about the wrong content-type header as follows:

  SEVERE: Unsupported Content-Type: application/soap+xml; 
  charset=UTF-8 Supported ones are: [text/xml]
  com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type:  
  application/soap+xml; charset=UTF-8 Supported ones are: [text/xml]

Возможно, вы пытаетесь использовать неправильную версию SOAP.

Glassfish также может помочь SOAP 1.2 .

1 голос
/ 01 августа 2012

Вы можете удалить binding="http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/" из определения конечной точки в sun-jaxws.xml.

...