日志含义服务器无法识别HTTP报头SOAPAction的值
本文关键字:HTTP 报头 SOAPAction 的值 识别 服务器 日志 | 更新日期: 2023-09-27 18:12:50
我有一个简单的web方法。当我调用它时,我得到下面的错误:
服务器不识别HTTP报头SOAPAction initiate的值。
我们从Java客户端调用webmethod,并将下面的代码添加到header中。
addRequestHeader("SOAPAction", "initiate");
如何将其添加到服务器代码(c#)的头?
我决定写我自己的答案,因为我已经失去了几个小时,我认为,尽管接受了另一问题的答案(http://stackoverflow.com/questions/352174/server-did-not-recognize-the-value-of-http-header-soapaction/14084341 # 14084341)很好,并指出我在正确的方向上(是的,它有一个voteup),它不是足够详细解释与我的应用程序是错误的,至少对于我来说。
我正在OpenESB 2.2中运行BPEL模块,我的复合应用程序的测试用例失败,出现以下错误:
Caused by: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
在做了一些研究之后,我注意到外部WSDL具有解决此问题所需的所有线索,例如,我正在使用以下web服务通过web服务编排来验证信用卡号码:http://www.webservicex.net/CreditCard.asmx?WSDL
如果你检查
<wsdl:binding name="CCCheckerSoap" type="tns:CCCheckerSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ValidateCardNumber">
<soap:operation soapAction="http://www.webservicex.net/ValidateCardNumber" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
...
但是,一旦您创建了复合应用程序并使用调用此外部WSDL服务的BPEL构建了项目,由于某种原因(bug?),复合应用程序服务组装(CASA)绑定的XML将生成一个空soapAction参数:
<binding name="casaBinding1" type="ns:CCCheckerSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="ValidateCardNumber">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal"/>
</input>
一旦您将适当的soapAction (http://www.webservicex.net/ValidateCardNumber)复制到此参数中,应用程序的测试用例将正确地返回预期的Soap响应。
<soap:operation soapAction="http://www.webservicex.net/ValidateCardNumber" style="document"/>
所以,这是一个更具体的解决方案,我决定根据在这篇博客文章中找到的信息来记录:http://bluebones.net/2003/07/server-did-not-recognize-http-header-soapaction/.
这意味着(至少在我的情况下)您正在访问web服务使用SOAP,并在HTTP请求中传递SOAPAction参数与服务期望的不匹配。