Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 未从SOAP请求中读取参数_C#_.net_Asmx - Fatal编程技术网

C# 未从SOAP请求中读取参数

C# 未从SOAP请求中读取参数,c#,.net,asmx,C#,.net,Asmx,我正在编写的web服务(它是asmx)有问题 我有这个方法: [WebMethod()] [SoapDocumentMethod( RequestNamespace="http://bsp.XXX.org", ResponseNamespace="http://bsp.XXX.org", ResponseElementName="PaymentResults", RequestElementName="GetPaym

我正在编写的web服务(它是asmx)有问题

我有这个方法:

    [WebMethod()]
    [SoapDocumentMethod(
        RequestNamespace="http://bsp.XXX.org",
        ResponseNamespace="http://bsp.XXX.org",
        ResponseElementName="PaymentResults",
        RequestElementName="GetPaymentResult",
        Action = "http://bsp.XXX.org/GetPaymentResult")]
    public PaymentResult[] GetPaymentResult(string MerchantRef)
    {
        try
        {
            if (!String.IsNullOrEmpty(MerchantRef))
            {
                return PaymentResultRepository.GetPaymentResults(MerchantRef).ToArray();
            }
            else
            {
                _errorLog.Error("MerchantRef is empty");
            }
        }
        catch (Exception ex)
        {
            _errorLog.Error("Failed to get payment details", ex);
        }
        return new PaymentResult[0];
    }
}
它是从Oracle窗体应用程序调用的。收到的SOAP请求是:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
        <GetPaymentResult xmlns="http://bsp.XXX.org/" 
                 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <MerchantRef xsi:type="xsd:string">
                 IP/58991/1
            </MerchantRef>
        </GetPaymentResult>
    </SOAP-ENV:Body>

IP/58991/1


问题是在我的方法中,“MerchantRef”总是一个空字符串。。。有人知道这件事吗?SOAP请求是否错误?我是否遗漏了一些明显的内容?

发现问题在于SOAP请求

它不喜欢encodingStyle属性,一旦删除它,它就可以完美地工作

i、 e.由此:

<GetPaymentResult xmlns="http://bsp.XXX.org/" 
             SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

致:


<GetPaymentResult xmlns="http://bsp.XXX.org/">