Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

POST to REST webservices using API: body serialization

Tags:

rest

wcf

biztalk

I am trying to use an REST webservice, by following the indications here: http://social.technet.microsoft.com/wiki/contents/articles/invoke-restful-web-services-with-biztalk-server-2010.aspx

However, the GET's seem to work correctly, but the POST are failing because, somehow, the message is getting serialized as a string.

I get:

POST /my_app/12005ab0-1522-71e1-0dde-0a0801c50000 HTTP/1.1
Content-Type: application/xml; charset=utf-8
Host: bsmshell.inovaprime.com:81
Content-Length: 174
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">&lt;body xmlns="http://microsoft.com/schemas/samples/biztalkwebhttp/1.0"&gt;HelloWorld&lt;/body&gt;</string>

Instead of:

POST /my_app/12005ab0-1522-71e1-0dde-0a0801c50000 HTTP/1.1
Content-Type: application/xml; charset=utf-8
Host: bsmshell.inovaprime.com:81
Content-Length: 174
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

<body xmlns="http://microsoft.com/schemas/samples/biztalkwebhttp/1.0">HelloWorld</body>

This with a message like: 12005ab0-1522-71e1-0dde-0a0801c50000 application/xml; charset=utf-8 HelloWorld

The ports configurations are as indicated in the article.

Any pointers on the possible reason why I am seeing this behaviour?

Thanks

like image 582
Newby23 Avatar asked Nov 23 '11 19:11

Newby23


1 Answers

Message.CreateMessage(request.Version, request.Headers.Action, bodyElement.ToString()); Changing it to: Message.CreateMessage(request.Version, request.Headers.Action, bodyElement); solved the problem.

[ Posting in-order for others to find out]

like image 91
TheWhiteRabbit Avatar answered Oct 03 '22 20:10

TheWhiteRabbit