I am using WCF to connect to an Apache web service. The request fails because the server cannot parse the header information. I have spoken to the provider of the service and they have indicated that the namespaces are in the wrong scope. They should be on the envelope not the body. How do I change this in .NET please?
My request:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<wsCaller>
<appVersion></appVersion>
</wsCaller>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<addSvcRecord xmlns="http://ws.dsr.careur.com">
<svcRecord xmlns="">
<vin>JMZCR19F200100059</vin>
<number>10</number>
<date>2012-02-22</date>
<mileage>38500</mileage>
<mileageType>KILOMETERS</mileageType>
<invokeErrorPage>false</invokeErrorPage>
</svcRecord>
</addSvcRecord>
</s:Body>
</s:Envelope>
Should look more like:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.dsr.careur.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://ws.dsr.careur.com" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<ws:wsCaller>
<appVersion></appVersion>
</ws:wsCaller>
</SOAP-ENV:Header>
<ns0:Body>
<ns1:getSvcRecords>
<vin>JMZDE14K280138989</vin>
</ns1:getSvcRecords>
</ns0:Body>
</SOAP-ENV:Envelope>
The problem isn’t that the namespace is at the wrong scope, its that the header isn’t in the namespace (which isn’t quite the same thing). You need to put your header in the namespace in the config file