繁体   English   中英

服务器无法识别HTTP标头SOAPAction启动的值

[英]Server did not recognize the value of HTTP Header SOAPAction initiate

我有一个简单的网络方法。 当我调用它时,出现以下错误。

服务器无法识别HTTP标头SOAPAction启动的值。

我们从Java客户端调用webmethod,然后将以下代码添加到标头中。

addRequestHeader("SOAPAction", "initiate"); 

如何将其添加到服务器代码(C#)的标头中?

我已经决定在这里发布自己的答案,因为我已经在此问题上浪费了几个小时,我认为,尽管这个问题的答案已经被接受(http://stackoverflow.com/questions/352174/server-did- not-receognize-the-value-of-http-header-soapaction / 14084341#14084341)非常好,并向我指出了正确的方向(是的,它得到了表决),它不够详细,无法解释出什么问题了我的申请,至少就我而言。

我在OpenESB 2.2中运行BPEL模块,并且我的Composite Application的测试用例由于以下错误而失败:

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构建项目,由于某种原因(错误?),将使用空的soapAction参数生成复合应用程序服务程序集(CASA)绑定的XML:

<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/

这意味着(至少就我而言),这意味着您正在使用SOAP访问Web服务并在HTTP请求中传递与该服务期望不匹配的SOAPAction参数。

暂无
暂无

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

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