I am building a webservice using RESTful approach and am using WCF WebHttp API (.NET v4). To satisfy some legacy functionality I need to accept raw XML message via POST and process it..For example one of my methods looks like:
[WebInvoke(UriTemplate = "Hello", Method = "POST")]
public Message ProcessMessage(string xmlMessage)
{
if (String.IsNullOrWhiteSpace(xmlMessage))
{
return WebOperationContext.Current.CreateXmlResponse(ProcessingFailedReply);
}
var message = XElement.Parse(xmlMessage);
return WebOperationContext.Current.CreateXmlResponse(ProcessingSuccessfullReply);
}
However, every time I try to POST some xml to "/Hello" I get a message that the format is invalid and it wants specifically encoded string. I guess the API is using standard schema to automatically serialize xmlMessage. When I visit the help ("/help") I am given an example format for my xmlMessage:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">String content</string>
How do I allow and process the POSTed request as raw in this scenario? I looked over the API and the only relevant class (WebOperationContext.Current.IncommingRequest) does not have any methods to retrieve raw message...
Thanks Z...