I have created a SOAP client proxy via "Add Web Reference" in visual studio. Now my problem is, that when I call the function "createAccount", the function returns a null value instead of the object I would expect. I know that the request was accepted by the service. Here is my code calling the proxy class function:
CreateAccountSuccess ret = null;
try
{
client.Credentials = new NetworkCredential("test", "test", ""); // last is domain
ret = client.createAccount("", pers, addr, false, null, null);
}
The problem is "ret" is always null. Here is the code visual studio generated (Reference.cs, which I already had to modify) for that function:
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethod("https://ocs-api-v2-3-sandbox.outbox.de/account#createAccount", RequestNamespace= "https://ocs-api-v2-3-sandbox.outbox.de/account", ResponseNamespace="https://ocs-api-v2-3-sandbox.outbox.de/account")]
[return: System.Xml.Serialization.SoapElementAttribute("return")]
public CreateAccountSuccess createAccount(string transactionId, Person person, Address address, bool checkHousenumberAdditive, string resellerId, Contract contract) {
object[] results = this.Invoke("createAccount", new object[] {
transactionId,
person,
address,
checkHousenumberAdditive,
resellerId,
contract});
return ((CreateAccountSuccess)(results[0]));
}
And here is what the response XML actually looks like (tested with SOAP-UI)
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://ocs-api-v2-3-sandbox.outbox.de/account" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:createAccountResponse>
<return xsi:type="CreateAccountSuccess">
<TnbAccountCarrierId xsi:type="xsd:int">4</TnbAccountCarrierId>
<areaCode xsi:type="xsd:int">2421</areaCode>
<emergencycoding xsi:type="SOAP-ENC:Struct">
<routingprefix xsi:type="xsd:string"/>
<areaCode xsi:type="xsd:int">2421</areaCode>
<countryCode xsi:type="xsd:string">49</countryCode>
<psapPolice xsi:type="xsd:string">02421CC72</psapPolice>
<psapFireDepartment xsi:type="xsd:string">02421CC40</psapFireDepartment>
</emergencycoding>
<status xsi:type="xsd:string">OK</status>
</return>
</ns1:createAccountResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
What am I doing wrong? I already tried with different combinations of parameters for the SoapDocumentMethod-attribute but with no luck. Also edited the namespaces which should now match...