I’m receiving a 400 bad request error w/ the following code:
This is my WCF service contract
[WebInvoke(UriTemplate = "/cust_key/{key}/prod_id/{id}",
Method = "POST",
BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Xml,
ResponseFormat = WebMessageFormat.Xml)]
Stream GetData(string key, string id, XElment data);
The following xml payload will work and a 200 will be returned
<Product>
<Name>laptop</Name>
</Product>
BUT this xml below w/ a non-default namespace will cause a 400 error
<Productxsi:type="electronics" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>laptop</Name>
</Product>
How should I handle this namespace issue?
It turned out to be a silly thing: I escaped the quote in the xml and now it’s working…sorry about this silly question. Hopefully this in some way can help somebody.