gpt4 book ai didi

java - 415 不支持的媒体类型 JAX-WS

转载 作者:太空宇宙 更新时间:2023-11-04 12:54:48 24 4
gpt4 key购买 nike

我正在使用 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 原始输出:

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 的 stub

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)

最佳答案

可能的原因:

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.

关于java - 415 不支持的媒体类型 JAX-WS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35499066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com