9

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

Newby23
  • 91
  • 2
  • 5
    And just got the problem, it is in the following line: Message.CreateMessage(request.Version, request.Headers.Action, bodyElement.ToString()); Changing it to: Message.CreateMessage(request.Version, request.Headers.Action, bodyElement); solved the problem. – Newby23 Nov 23 '11 at 19:53
  • Maybe that's because you are setting content-type as application/xml and API that you're using tries to convert it into XML, try set content-type as plain/text for simple string – Regfor Dec 18 '11 at 17:12
  • 1
    @Newby - If you've found the solution yourself, why not add it as an answer below, then accept it. That way others can find it more easily, and can vote for it if they find it useful. – Jude Fisher Aug 26 '12 at 15:13
  • Could you also close your question, please? It appears as unanswered... – Aurélien Bénel Feb 15 '13 at 07:37

2 Answers2

1

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]

TheWhiteRabbit
  • 15,480
  • 4
  • 33
  • 57
0

The reason is the content-type

burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
Lloyd Moore
  • 3,117
  • 1
  • 32
  • 32