I am trying to make a CoreWCF SOAP endpoint which is backwards compatible with a legacy .NET Framework SOAP API. One problem remaining is that if I call any method (OperationContract), the XML output references http://tempuri.org/ instead of my custom namespace. I can't seem to see any way to change this value. Here's a snippet of my code:
[ServiceContract(Name = "UploaderAPI")]
[XmlSerializerFormat]
[XmlRoot(Namespace = "http://x-rm.com")]
public interface IUploaderAPISoap
{
[OperationContract(Action = "http://x-rm.com/uploaderapi/HelloWorld")]
HelloWorldResponse HelloWorld(string echo);
}
But that gives this output in Postman: Please see line 3 which mentions xmlns="http://tempuri.org/
<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">
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>
<HelloWorldResult xmlns="http://mileagecount.live.x-rm.com/uploaderapi">Hi there, foo</HelloWorldResult>
</HelloWorldResult>
</HelloWorldResponse>
</s:Body>
</s:Envelope>
I believe this is what's causing the client application to reject the response.
[DataContract(Namespace = "http://tempuri.org/"]. Also the solutions of these two cases could be tried : How can I specify a namespace for OperationContract when using WCF? and Changing namespace for DataContracts in a WCF service.