2017-08-24 99 views
0

我成功地運用了weimport行家工具生成針對客戶端WSD,這是由.NET SOAP服務SOAP連接重置

,當我做從我的Java客戶端代碼的請求支持的Jar文件,我得到的以下日誌

Accept: text/xml, multipart/related 
Content-Type: multipart/related;start="<rootpart*[email protected]>";type="application/xop+xml";boundary="uuid:dbea05e3-9997-4835-965c-02b1ed77e6b6";start-info="text/xml" 
SOAPAction: "http://xxx/2013/xxx/RemotexxxService/UpdateProfile" 
User-Agent: JAX-WS RI 2.2.10 svn-revision#919b322c92f13ad085a933e8dd6dd35d4947364b 
--uuid:dbea05e3-9997-4835-965c-02b1ed77e6b6 
Content-Id: <rootpart*[email protected]> 
Content-Type: application/xop+xml;charset=utf-8;type="text/xml" 
Content-Transfer-Encoding: binary 

,我收到以下錯誤

javax.xml.ws.WebServiceException: java.net.SocketException: Connection reset 
    at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:210) 
    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:241) 
    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:232) 
    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:145) 
    at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110) 
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136) 
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050) 
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019) 
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877) 
    at com.sun.xml.ws.client.Stub.process(Stub.java:463) 
    at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191) 
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108) 
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92) 
    at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161) 

但是當我複製過去的整個SOAP消息,並嘗試在SOAPUI,它的工作..

我已經注意到了SOAP UI都有不同的HTTP頭產生

POST http://coreservices-uat.legendonlineservices.co.uk/IRemoteContactUpdateService.svc HTTP/1.1 
Accept-Encoding: gzip,deflate 
Content-Type: text/xml;charset=UTF-8 
SOAPAction: "http://Infrastructure/2013/ContactPhoto/RemoteContactUpdateService/UpdateProfile" 
Content-Length: 1761 
Host: coreservices-uat.legendonlineservices.co.uk 
Connection: Keep-Alive 
User-Agent: Apache-HttpClient/4.1.1 (java 1.5) 

我想不出之間的Java版本或差異Apache的HttpClient的或Jasws落實將使

難道有什麼區別內容類型?我的意思是在SOAP UI中,內容類型是 與Java客戶端不同

是否可以在wsdl中引起此問題的以下定義?

<wsp:Policy wsu:Id="BasicHttpBinding_RemoteContactUpdateService_policy"> 
<wsp:ExactlyOne> 
<wsp:All> 
<wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"/> 
</wsp:All> 
</wsp:ExactlyOne> 
</wsp:Policy> 

注:我是發送相同的XML消息使用相同的Java代碼前兩天的服務器,它總是工程....這是一個最新的錯誤。

回答

1
在我的情況

,web服務提供商從https改爲端點到http 也是在服務器端的HTTPS連接器被禁用

發送MTOM通過HTTP aparently引起的問題在我的情況

的解決方法是從我JAXWS客戶端

Binding binding = bp.getBinding(); 
SOAPBinding sb = (SOAPBinding)binding; 
sb.setMTOMEnabled(false); 
在此之後

禁用MTOM,客戶請求的內容類型從

改變
Content-Type: multipart/related;start="<rootpart*[email protected]>";type="application/xop+xml";boundary="uuid:dbea05e3-9997-4835-965c-02b1ed77e6b6";start-info="text/xml" 
Content-Type: application/xop+xml;charset=utf-8;type="text/xml" 

Content-Type: text/xml;charset=UTF-8 

然後我把它通過HTTP,問題就迎刃而解了。