Axis 客户端 .NET Web 服务:WebMethod 中的参数为 Null,但 SOAP 请求中的参数为 Null

发布于 2024-12-09 08:19:57 字数 1463 浏览 0 评论 0原文

我有一个由 Axis 客户端调用的 .NET Web 服务;但是,由于某种原因,我收到的所有参数值均为空。客户端不传递 SOAPAction 属性,因此我需要将 Routing 设置为 RequestElement,如下所示:

[SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)]    

我已将命名空间设置为与调用方相同。

[WebService(Namespace = "http://aaa.com")] 

正在调用 SOAP 请求中指定的适当方法,但所有参数仍然为空。

我的方法看起来像

 [WebMethod(MessageName = "method1")]  
    public string method1(int param1, string param2, string param3)  

这就是请求的样子

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
        <soapenv:Body>  
            <ns1:method1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://aaa.com">  
                <param1 href="#id0"/>  
                <param2 xsi:type="xsd:string">value</param2>  
                <param3 xsi:type="xsd:string">value</param3>  
            </ns1:method1>  
            <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">11</multiRef>  
        </soapenv:Body>  
    </soapenv:Envelope>

但是,在该方法中,我为所有字符串获取 null,为整数获取 0。有什么想法吗?

I have a .NET web service being called by an Axis client; however, for some reason all of the parameter values I am receiving are null. The client does not pass the SOAPAction attribute, so I need to set the Routing to RequestElement as follows:

[SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)]    

I have set the namespace same as the caller.

[WebService(Namespace = "http://aaa.com")] 

The appropriate method specified in the SOAP Request is being called but still all of the parameters are null.

My method looks like

 [WebMethod(MessageName = "method1")]  
    public string method1(int param1, string param2, string param3)  

This is what the request looks like

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
        <soapenv:Body>  
            <ns1:method1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://aaa.com">  
                <param1 href="#id0"/>  
                <param2 xsi:type="xsd:string">value</param2>  
                <param3 xsi:type="xsd:string">value</param3>  
            </ns1:method1>  
            <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">11</multiRef>  
        </soapenv:Body>  
    </soapenv:Envelope>

However, in the method I get null for all the strings and 0 for the ints.. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文