Reputation: 2347
I have a WCF method that is not receiving the request parameters. But if I use the WCFTest client (the one that comes with visual studio) the method receives the parameters.
If I capture the requests, they look very similar:
If the request is this, it works:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<consultaValeCompra xmlns="http://tempuri.org/">
<dataMovto>1</dataMovto>
<numSeqOperacao>2</numSeqOperacao>
<numDocumento>3</numDocumento>
<valorDocumento>4</valorDocumento>
<tipo>5</tipo>
<codPreVenda>6</codPreVenda>
</consultaValeCompra>
</s:Body>
</s:Envelope>
If the request is this, I do not get the parameters:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<consultaValeCompra xmlns="http://valeCompra/jaws">
<dataMovto>121212</dataMovto>
<numSeqOperacao>003719</numSeqOperacao>
<numDocumento>000000000000005555466465454546</numDocumento>
<valorDocumento>000046400</valorDocumento>
<tipo>0</tipo>
<codPreVenda>0000000000</codPreVenda>
</consultaValeCompra>
</soapenv:Body>
</soapenv:Envelope>
The method signature is:
public Retorno consultaValeCompra(string dataMovto, string numSeqOperacao, string numDocumento, string valorDocumento, string tipo, string codPreVenda)
I can spot the differences, but I cannot understand why the first works and the second does not.
What can I do to make it work?
Thanks.
Upvotes: 2
Views: 750
Reputation: 8319
It seems that the XML namespace (xmlns=
attribute) for <consultaValeCompra>
are different :
<consultaValeCompra xmlns="http://tempuri.org/">
versus
<consultaValeCompra xmlns="http://valeCompra/jaws">
EDIT : corrected answer :
You should check the ServiceContract
attribute on your service class. Set it to the same namespace on both server and client side. For example :
[ServiceContract(Namespace = "http://valeCompra/jaws")]
public class MyService
{
[...]
}
Or regenerate your service client.
Upvotes: 3