簡體   English   中英

SOAP響應的Java問題

[英]java trouble with SOAP response

我正在從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)

我檢查了soap請求中的標頭,它表明可接受的內容類型是html / xml,text / jpg等。但不是application / xml + soap。

使用SoapUI進行測試時,一切運行正常。

我們使用的是SOAP v1.1 ..,但是(顯然)客戶端使用的是SOAP 1.2 ..,有沒有辦法讓我們解析響應?

如果您使用Maven作為構建工具,請確保檢查您的Maven目標是否已將XSoap1.2作為協議..我們有一個類似的問題,我們無法在數周內解決。

希望這對您有幫助...

別人那里引渡

  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頁面可以提供幫助。

您可以從sun-jaxws.xml端點定義中刪除binding="http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM