为什么webmethod参数为空?

时间:2021-03-24 17:16:24

标签: c# web-services soap

我在 vs2015 c# 中创建了一个 SOAP 网络服务。 现在网络服务在服务器上。 当我调用该方法时:

[WebMethod]
public OperazioniSostaResult GetOperazioniSosta(string codiceOperatore, string password)

从我的测试程序或浏览器它工作正常:

codiceOperatore = "1234"
password = "4321"

在wireshark上我有这个:

*Hypertext Transfer Protocol
    POST /Soapxxx/xxx.asmx HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): POST /Soapxxx/xxx.asmx HTTP/1.1\r\n]
        Request Method: POST
        Request URI: /Soapxxx/xxx.asmx
        Request Version: HTTP/1.1
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)\r\n
    VsDebuggerCausalityData: uIDPoyyyP7XdXCZEtQeiYH2wNNwAAAAA3DjPLEKLj02TKyKHC9W6+WLlyY9Sdf1Ikh1eEmY/XCQACQAA\r\n
    Content-Type: text/xml; charset=utf-8\r\n
    SOAPAction: "http://xxx.it/GetOperazioniSosta"\r\n
    Host: www.xxx.it:90\r\n
    Content-Length: 460\r\n
    Expect: 100-continue\r\n
    Connection: Keep-Alive\r\n
    \r\n
    [Full request URI: http://www.xxx.it:90/Soapxxx/xxx.asmx]
    [HTTP request 2/2]
    [Response in frame: 4961]
    File Data: 460 bytes eXtensible Markup Language
    <?xml
        version="1.0"
        encoding="utf-8"
        ?>
    <soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
            <GetOperazioniSosta
                xmlns="http://xxx.it">
                <codiceOperatore>
                    1234
                    </codiceOperatore>
                <password>
                    4321
                    </password>
                </GetOperazioniSosta>
            </soap:Body>
        </soap:Envelope>*

但是当它收到客户端程序的请求时,参数为空:

codiceOperatore = ""
password = ""

在wireshark上我有这个:

*Hypertext Transfer Protocol
    POST /Soapxxx/xxx.asmx HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): POST /Soapxxx/xxx.asmx HTTP/1.1\r\n]
        Request Method: POST
        Request URI: /Soapxxx/xxx.asmx
        Request Version: HTTP/1.1
    Content-Type: text/xml; charset=utf-8\r\n
    SOAPAction: "http://xxx.it/GetOperazioniSosta"\r\n
    Host: www.xxx.it:90\r\n
    Content-Length: 408\r\n
    Accept-Encoding: gzip, deflate\r\n
    \r\n
    [Full request URI: http://www.xxx.it:90/Soapxxx/xxx.asmx]
    [HTTP request 10/10]
    [Prev request in frame: 5013]
    [Response in frame: 5020]
    File Data: 408 bytes
eXtensible Markup Language
    <s:Envelope
        xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <s:Body
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <GetOperazioniSosta
                xmlns="http://xxx.it/">
                <codiceOperatore>
                    1234
                    </codiceOperatore>
                <password>
                    4321
                    </password>
                </GetOperazioniSosta>
            </s:Body>
        </s:Envelope>*

我认为这是方法上游的解析问题。

0 个答案:

没有答案
相关问题