gpt4 book ai didi

c# - 未从 SOAP 请求中读取参数

转载 作者:太空宇宙 更新时间:2023-11-03 11:14:04 25 4
gpt4 key购买 nike

我正在编写的 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 Forms 应用程序调用的。收到的 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>

问题是“MerchantRef”在我的方法中始终是一个空字符串...有人对此有任何想法吗? SOAP 请求是否错误?我是否遗漏了一些明显的东西?

最佳答案

原来是 SOAP 请求的问题...

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

即来自:

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

到:

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

关于c# - 未从 SOAP 请求中读取参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13193509/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com