none
How to use HTTP or WCF-Custom Adapter to HTTP URL RRS feed

  • Question

  • Hi All,

    I am new to HTTP adapter and I am developing an application to invoke HTTP URL from BizTalk.

    I have provided with HTTP URL, one like this "<tt>http://www.contoso.com/Customer/Details?firstName=John&lastName=Smith</tt><tt>". </tt><tt>I have to create a biztalk application in which I receive a file on receive location (xml file). Once I receive a file on the receive location I have to hit the above HTTP URL and get the status code and html body back into biztalk.I have not provided with any HTTP request response schema. </tt>

    <tt>What I have done is till now is, I have used the request-response port in orchestration for sending a request and receiving a response. While sending a request on send port I have used HTTP adapter configured with above URL. On receive side I have created one multipart message with XmlDocument element type. I am assigning the HTTP response to this multipart message. What I am getting in the response is HTML output and what I am expecting is HTTP response code and body message.</tt><tt>Please let me know the how to capture the response and HTML body using HTTP adapter. </tt>

    <tt>Is the above implementation is possible using WCF HTTP adapter. What are the benefits of WCF HTTP adapter over native HTTP adapter?</tt>

    <tt>Thanks, Nilesh Sawant</tt>

    Wednesday, November 9, 2011 11:50 AM

Answers

  • Nilesh,

    If all you need to check is the status code of HTTP then I don't think you need request response port. All you need is delivery notification in case of any failure i.e. Status Code other than 200 you will get the error details by enabling the delivery notification.


    Don't forget to mark the post as answer or vote as helpful if it does, Regards -Rohit Sharma (http://rohitbiztalk.blogspot.com)
    Tuesday, November 22, 2011 7:08 AM
    Moderator

All replies

  • Hi I think you need to look at this article if you have a custom HTTP address you want to connect to if you want to use WCF. The WCF-WSHttp and WCF-BasicHttp are aimed at web-service. In the article you add a custom behavior to request a Rest web service. You can use some of the same functionality to request your HTTP address: http://social.technet.microsoft.com/wiki/contents/articles/invoke-restful-web-services-with-biztalk-server-2010.aspx
    Torben Christiansen http://www.snatchedmoments.com/
    • Edited by TorbenChrona Wednesday, November 9, 2011 12:10 PM
    Wednesday, November 9, 2011 12:04 PM
  • Hi,

    Thanks for the information. I have already implemented the code mentioned in the above site: http://social.technet.microsoft.com/wiki/contents/articles/invoke-restful-web-services-with-biztalk-server-2010.aspx But I get an error: A message sent to adapter "WCF-Custom" on send port "Twitter" with URI "http://api.twitter.com/1"; is suspended. Error details: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (407) Proxy Authentication Required. ---> System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required. May be we do not have access to twitter from our company domain.

    But my basic question is: Can it possible to get the response (status code and html body) without any request and response schema for HTTP URL (eg: http://www.contoso.com/Customer/Details?firstName=John&lastName=Smith) using HTTP or WCF-Custom Adapter. If yes please share me the steps or link to do the same. I would also like to know what is the difference/benefits of using WCF-Custom over HTTP adapter.

    Thanks, Nilesh

    Wednesday, November 9, 2011 12:42 PM
  • Hi

    Regaring the sample it seems like you are hitting a proxy. 

    You should be able to use the HTTP adapter to get a response from that url. I have done so in a project, but don't remember the steps. You could look at this blog about using the HTTP adapter (http://kentweare.blogspot.com/2009/06/adventures-with-http-adapter-and-yahoo.html). The WCF-Custom adapter is there so that you can implement a scenario like the twitter one in BizTalk.

     

     


    Torben Christiansen www.snatchedmoments.com
    Wednesday, November 9, 2011 12:52 PM
  • Hi,

    Thanks, I have gone through the link but did not find anything on how to get response code from HTTP. The link talk about send formatted request to yahoo API and get the flat file response (html) back. I was looking for is status code and html content in the response. Any help will be appreciated.

    Thanks, Nilesh

    Thursday, November 10, 2011 7:30 AM
  • Nilesh,

    If all you need to check is the status code of HTTP then I don't think you need request response port. All you need is delivery notification in case of any failure i.e. Status Code other than 200 you will get the error details by enabling the delivery notification.


    Don't forget to mark the post as answer or vote as helpful if it does, Regards -Rohit Sharma (http://rohitbiztalk.blogspot.com)
    Tuesday, November 22, 2011 7:08 AM
    Moderator