Reputation: 3612
I'm having a problem with a web service that I'm writing (it's asmx).
I have this method:
[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];
}
}
And it's being called from an Oracle Forms application. The SOAP request received is:
<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>
The problem is that "MerchantRef" is always an empty string in my method... Anyone have any idea about this? Is the SOAP request wrong? Am I missing something obvious?
Upvotes: 2
Views: 502
Reputation: 3612
Turns out that the problem was the SOAP request...
It didn't like the encodingStyle attribute, once this was removed it worked perfectly.
i.e. from this:
<GetPaymentResult xmlns="http://bsp.XXX.org/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
to:
<GetPaymentResult xmlns="http://bsp.XXX.org/">
Upvotes: 2