繁体   English   中英

尝试使用Apache Tomcat托管的Web服务时,WebServiceexception“标头中没有内容类型”

[英]WebServiceexception “No Content-type in the header” when trying to consume Apache Tomcat hosted webservice

我正在远程Web服务的wsdl url,该URL部署在apache tomcat上。 当调用Web服务的方法出现以下错误时,我正在使用CXF转换为Java客户端。

Exception in thread "main" javax.xml.ws.WebServiceException: No Content-type in the header!
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:172)
    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 sun.proxy.$Proxy30.process(Unknown Source)
    at com.exp.webservice.IWebService_WebServiceImplPort_Client.main(IWebService_WebServiceImplPort_Client.java:59)

那不是CXF客户。 那是使用JDK中的JAX-WS实现。

无论哪种情况,都可以使用Wireshark之​​类的工具来追踪电线上的内容。 看起来服务器正在响应某种无效请求。

发生了同样的问题,但是当正确检查WSDL URL是否正常工作时,该问题已得到解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM