Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Brett, thanks for the bit of code. Unfortunately I found it in this thread: <a href="https://stackoverflow.com/questions/1709781/wcf-rest-parameters-involving-complex-types">WCF Rest parameters involving complex types</a> and had attempted it prior to this posting.</p> <p>In any event, I have solved this problem. Now I would love to say that I had a complete 'Eureka' moment and everything just came together but the fact of the matter is I just started throwing acronymns at Google and one of the SERPs led me to this link: <a href="http://blogs.msdn.com/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx</a></p> <p>The link itself doesn't directly address the question at hand but it made me think differently about how I was putting together my URI templates. I had read this MSDN article <a href="http://msdn.microsoft.com/en-us/library/dd203052.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/dd203052.aspx</a> on how to put together a RESTful service. In the example the author provides several different templatesL some which utilize a typical querystring parameter-esque template and some that don't. For whatever reason I choose the template that was void of a typical querystring parameter as can be seen in my original post. So I modified my code a bit and came up with this:</p> <pre><code>[OperationContract] [WebGet(UriTemplate = "/method1/?xml={data}", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)] string Method2(string data); </code></pre> <p>Notice that the URI template is the only thing that changed; changing from "/method1/{data}" to "/method1/?xml={data}. I then navigated to <a href="http://myuri.com/service.svc/method1/?xml=" rel="nofollow noreferrer">http://myuri.com/service.svc/method1/?xml=</a> and viola, everything worked beautifully! </p> <p>This also was the problem with POST. For whatever reason passing the XML along in the content body, even as a key/value pair, was causing the the 400 error. Using the exact same URI template shown above I opened Fiddler, executed a POST, and the result was 200 OK. </p> <p>Thanks for the help everyone. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload