java 不支持的内容类型:text/html;charset=UTF-8 支持的有:[text/xml] in Jdev

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25406563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 07:58:55  来源:igfitidea点击:

Unsupported Content-Type: text/html; charset=UTF-8 Supported ones are: [text/xml] in Jdev

javaweb-servicessoapui

提问by user964819

I'm trying to consume a mock service from SoapUI in Jdev by generating proxy client but i keep getting the following exception in Jdev :

我试图通过生成代理客户端在 Jdev 中使用来自 SoapUI 的模拟服务,但我在 Jdev 中不断收到以下异常:

Exception in thread "main" com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html; charset=iso-8859-1 Supported ones are: [text/xml]
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118)
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180)
    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 $Proxy33.searchOrder(Unknown Source)
    at beans.util.search.ShowOrderSearchResults.getOrderSearchResults(ShowOrderSearchResults.java:43)
    at beans.util.search.ShowOrderSearchResults.main(ShowOrderSearchResults.java:32)

Can anyone tell me what is the probable cause of this as I'm new to webservices.

谁能告诉我这可能是什么原因,因为我是网络服务的新手。

回答by vagelis

This error is notabout the request, but about the response. The JAX-WS client-sideruntime has sent the request and is about to process the response, but the response is not text/xml as expected (a SOAP response). Two possible root causes:

此错误与请求无关,而与响应有关。JAX-WS客户端运行时已发送请求并即将处理响应,但响应不是预期的 text/xml(SOAP 响应)。两个可能的根本原因:

  1. You are using the wrong URL for the web service and the web server sends a HTML response, either with the content of the URL, or an error page - for example 404 Not found.
  2. Something breaks inside the web service (for example an unhandled exception) and the web server sends a HTML response with the error information - for example 500 Internal server error.
  1. 您为 Web 服务使用了错误的 URL,Web 服务器发送 HTML 响应,其中包含 URL 的内容或错误页面 - 例如 404 Not found。
  2. Web 服务内部出现问题(例如未处理的异常),Web 服务器发送带有错误信息的 HTML 响应 - 例如 500 内部服务器错误。