我正在使用JAX-ws生成渲染器WSDL的客户端代码。当我尝试将请求发送到服务器时,我得到以下内容。是否存在与代码或任何配置问题或服务器端更改相关的任何事情?
代码:
byte[] tif = //method call to get byte[] data.
ByteArrayInputStream bais = new ByteArrayInputStream(tif);
DataHandler inData = new DataHandler(bais, "application/octet-stream");
new MDIVRS().getRenderingServiceSoap().renderDocument(bstrRenderer, inData, bstrFileName, plBeginPage, plEndPage, pbstrImageType, ppParams, ppPagesData, pbstrErrMsg);
SOUP UI RAW输入:
POST http://10.96.85.124/MRSMTOMSrv/RenderingService.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=iso-8859-1
SOAPAction: "http://mdivrs.myapplication.com/renderDocument"
Content-Length: 10926
Host: 11.22.33.44
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
SOUP UI RAW OUTPUT:
HTTP/1.1 415 Unsupported Media Type
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Fri, 19 Feb 2016 06:09:40 GMT
服务器无法为请求提供服务,因为媒体类型不受支持。
堆栈跟踪 JDK 6中的JAX-WS RI 2.1.6:http://11.11.11.11/MRSMTOMSrv/RenderingService.asmx?WSDL的存根
com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 415: Unsupported Media Type
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:196)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:168)
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 $Proxy35.renderDocument(Unknown Source)
at come.on.Previous.renderDocument1(Previous.java:107)
at come.on.Previous.main(Previous.java:41)
答案 0 :(得分:0)
可能的原因:
You have not included Jackson libraries in your classpath
Check your spring XML configuration if you have added below tag or not
Probably JSON data not correctly created. Please check your JSON object before sending request to the controller.
You could use JSONLint to validate your JSON data format.
Check JSON object property name is correctly matching with your Spring MVC controller domain object
Finally check your request mapping in controller.