spring - 无法从 InputStream : Invalid Content-Type:te

你好。 我通过手册为 WSDL 创建了一个客户端: http://static.springsource.org/spring-ws/site/reference/html/client.html

但是当我启动我的应用程序时,我得到这个错误:

Exception in thread "main" org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:204)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:58)
    at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:90)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:548)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:496)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:451)
    at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:395)
    at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:386)
    at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:376)
    at com.software.prod.core.ws.WebServiceClient.simpleSendAndReceive(WebServiceClient.java:36)
    at com.software.pro.core.common.ServiceRunner.main(ServiceRunner.java:19)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:602)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:275)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1_1Impl.java:67)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:61)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:182)
    ... 10 more

最佳答案

是否有在您尝试调用的任何 URL 上运行的 Web 服务?看起来您收到的响应可能是 html 页面或 HTTP 错误(我猜是 404 - 未找到文件或目录)。

您要调用哪个 URL?您创建的 Web 服务或某些外部 Web 服务?

我建议首先尝试使用 SoapUI 调用 Web 服务(以确保 Web 服务存在并且正在运行)

关于spring - 无法从 InputStream : Invalid Content-Type:text/html 创建消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7510937/

相关文章:

msbuild - 如何转储从 MSBuild 导入的属性表列表

python - 在 Matplotlib 中设置颜色图的范围

php - 从我的 Wordpress 插件中更改 wp_title

PHP 5.2 无法解释 - 文件停止正常执行

asp.net - NHibernate:获取所有打开的 session

maven-2 - Maven : Could not transfer artifact Erro

jsf - 如何注入(inject)不同的子类作为 ManagedProperty JSF 2?

python - 如何在 setup.py 中为 cython 设置 sysroot

sql-server - 从游标源 SQL Server 中删除行

database-design - ERD - 鱼尾纹符号