I have seen people hint at using XmlDocument parameter in web api method but can't work out how it should work.
This works
I have done a POST using the following
POST https://service/api/ HTTP/1.1
Content-Type: application/xml; charset=utf-8
apikey: 969db811-41a5-a9b1-4551-9f7c4ca10a99
Host: abcde
Content-Length: 1651
Expect: 100-continue
<itinerary>
<batch> .... etc
to the method code
public HttpResponseMessage Post(HttpRequestMessage value)
{
var doc = new XmlDocument();
doc.Load(value.Content.ReadAsStreamAsync().Result);
How would I do this?
I am curious as to what the format of the POST would be and the code for the method if I had a method signature as follows. Is it a good approach to accept XML and\or what are the pros\cons when compared to the previous approach I have shown.
public HttpResponseMessage Post(XmlDocument value)
{
I am enjoying learning about RESTful services so any advice from more experienced people would be appreciated
Aucun commentaire:
Enregistrer un commentaire