I developed soap method using SoapCore.
Here is my code:
[ServiceContract(Namespace = "http://txn.xxx.com")]
public interface ISampleService
{
[OperationContract()]
void Reserve(long timestamp, string posId, string employeeRef, string merchantRef, int amountCents, string itemRef, int validitySeconds, long txnId, PayterTokenRequest token, string signature);
}
public class SampleService : ISampleService
{
public void Reserve(long timestamp, string posId, string employeeRef, string merchantRef, int amountCents, string itemRef, int validitySeconds, long txnId, PayterTokenRequest token, string signature)
{
return;
}
}
[DataContract(Name = "token", Namespace = "")]
public class PayterTokenRequest
{
[DataMember(Name = "tokenId")]
[MessageBodyMember(Namespace = "", Order = 0, Name = "tokenId")]
public string TokenId { get; set; }
[DataMember(Name = "tokenRef")]
[MessageBodyMember(Namespace = "", Order = 1, Name = "tokenRef")]
public string TokenRef { get; set; }
[DataMember(Name = "tokenVersion")]
[MessageBodyMember(Namespace = "", Order = 2, Name = "tokenVersion")]
public int TokenVersion { get; set; }
}
They have specified how the request will be sent by the device as follows in the document.
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:txn="http://txnHost.payter.com">
<soapenv:Header/>
<soapenv:Body>
<txn:reserve soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<timestamp xsi:type="xsd:long">1369231373</timestamp>
<posId xsi:type="xsd:string">posId</posId>
<employeeRef xsi:type="xsd:string">SYSTEM</employeeRef>
<merchantRef xsi:type="xsd:string">merchantRef</merchantRef>
<amountCents xsi:type="xsd:int">1</amountCents>
<currency xsi:type="xsd:string">EUR</currency>
<itemRef xsi:type="xsd:string"/>
<validitySeconds xsi:type="xsd:int">0</validitySeconds>
<token>
<tokenId xsi:type="xsd:string">ac8191d3</tokenId>
<tokenRef xsi:type="xsd:string">d39181acf734ae</tokenRef>
<tokenVersion xsi:type="xsd:int">0</tokenVersion>
</token>
<txnId xsi:type="xsd:long">1</txnId>
<signature xsi:type="xsd:string">548d9db3a066c8b46c5ccafc45f7c230f8d9442c</signature>
</txn:reserve>
</soapenv:Body>
</soapenv:Envelope>
But request parameter always null.
If I change request like this it is working.
What should I do to solve issue?




I ran across the same problem while I was playing with namespaces. You are defining a namespace in you interface:
but in the model you are leaving it blank:
I am not an expert but from what I have experienced it seems as if the deserializer had no knowledge of the type it is supposed to map the object to. For me simply matching the namespace is datacontract solved the issue, which in your usecase would look like:
Hope it helps