我试图将我的Java应用程序连接到Channel,并得到以下错误:
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. One or more http request headers was not valid for the SOAP request. </faultstring>
<detail/>
</soap:Fault>
</soap:Body>
</soap:Envelope>以下是我的要求:
String requestURL = "https://api.channeladvisor.com/ChannelAdvisorAPI/v7/InventoryService.asmx";
String request =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:web='http://api.channeladvisor.com/webservices/'>"+
"<soapenv:Header>"+
"<web:APICredentials>"+
"<!--Optional:-->"+
"<web:DeveloperKey>XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX</web:DeveloperKey>"+
"<!--Optional:-->"+
"<web:Password>XXXXXXXXXX</web:Password>"+
"</web:APICredentials>"+
"</soapenv:Header>"+
"<soapenv:Body>"+
"<web:GetInventoryQuantity>"+
"<web:accountID>XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX</web:accountID>"+
"<web:sku>XXXXXX-XX-XXX</web:sku>"+
"</web:GetInventoryQuantity>"+
"</soapenv:Body>"+
"</soapenv:Envelope>";奇怪的是,如果我使用SoapUI尝试相同的请求,我会得到一个成功的响应。
知道怎么解决这个问题吗?
发布于 2014-06-14 09:02:56
您是否尝试过处理web服务返回的实际消息(重点是我的消息)?
服务器无法处理请求。一个或多个http请求头对SOAP请求无效。
如果它从SoapUI中运行,那么这意味着您没有从您的应用程序发送适当的请求。SoapUI在执行请求时记录一些日志。您可以查看HTTP日志,并查看它发送的标头。
我猜你要么错过了SOAPAction,要么错过了Content-Type。开始一个一个地添加标题,并查看web服务何时停止抱怨。
https://stackoverflow.com/questions/24169142
复制相似问题