I have a WCF method which currently returns a string like so:
string CreateDesign(string UID, string TemplateName)
The retruned string is created by this method:
string RequestProcessed(string status, string UID)
{
XDocument doc = new XDocument(
new XElement("RequestProcessed",
new XElement("Status", status),
new XElement("UID", UID)));
return doc.ToString();
}
The response that I got from using SOAPUI is like this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<CreateDesignResponse xmlns="http://tempuri.org/">
<CreateDesignResult><![CDATA[<RequestProcessed>
<Status>OK</Status>
<UID>FolderName</UID>
</RequestProcessed>]]></CreateStandardResult>
</CreateStandardResponse>
</s:Body>
</s:Envelope>
The client is expecting it like this:
<soap:Body>
<m:RequestProcessed xmlns:m=" ">
<m:Status></m:Status>
<m:UID></m:UID>
</m: RequestProcessed >
</soap:Body>
What should I do to make the WCF service return the response like that?
I am struggling with this for quite sometime now, appreciate any help.
Regards.
To have full controll over your SOAP message body you should use MessageContract attribute for both your input and output parameters. Here is a good article on the web to start with.
Using Message Contracts
Hope it helps!
EDITED:
Operation contract
RequestProcessed
SOAP message body