none
Calling a REST Web Service from BizTalk RRS feed

  • Question

  • Hi,

    I am working on an application where I have to send XML Request to a Third Party Service which is REST webservice.

    I have to send this request from BizTalk Orchestration. Currently I have created a WCF service and call this REST based service from there.

    and have consumes WCF service at our send port in BizTalk.

     

    Is there any way we can call this REST web service directly from BizTalk Orchestration?

     

    Thanks in advance.

     

    Regards,

    Nitin Rastogi

    Wednesday, February 23, 2011 6:59 AM

Answers

All replies

  • Hi Nitin,

    I have no experience in consuming RESTful web service in BizTalk, but you may review this post by fellow MVP Jesus Rodriguez Consuming RESTful services from BizTalk Server using AtomPub .

    HTH

    Regards,

    Steef-Jan Wiggers
    MVP & MCTS BizTalk Server
    http://soa-thoughts.blogspot.com/
    If this answers your question please mark it accordingly

     

     


    BizTalk
    Wednesday, February 23, 2011 7:49 AM
    Moderator
  • Hi Steef,

    Thanks for your reply.

    The blog published by Jesus is not much helpful.

     

    Issue is I have to construct XML request and send it to the service through HttpWebRequest.

    Can we achieve this if we write custom adaptor?

     

    Thanks,

    Nitin Rastogi

    Wednesday, February 23, 2011 11:55 AM
  • The HTTP adapter will function most like an HttpWebRequest. Another way to handle calling a REST web service would be through the webHttp binding as part of the WCF-Custom adapter. Thanks,
    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Wednesday, February 23, 2011 4:32 PM
    Moderator
  • You can write a custom behavior to call the RESTful service from a BizTalk send port if you havent got the level of control you need from the webHttp binding.  Once the behavior is registered you can configure the WCF-Custom adapter to use it.  You can use this to reformat the message for the service your calling.. You might have a problem if the service returns a respose in JSON format however, as the adapter will expect text/xml.
    Friday, February 25, 2011 3:07 PM
  • You can try doing this with the WCF Custom adapter.


    --------------------------------------
    Mark As Answer or Vote As Helpful if this helps.
    Monday, February 28, 2011 11:29 AM
  • I would think that its easier to construct an XML message in BizTalk than in code (as you would do in a custom adapter). I think it would help if you make your scenario clearer, and share some info on what the REST service is doing and expecting.
    -- Please mark as answered if this answers your question.
    Tuesday, March 1, 2011 11:50 AM
  • Hi Manas,

    Currently my client has given source code, where a HttpWebRequest is constructed similar to below string:

     

    URL + "requesType=1&RequestValue" + "Encoded XML file"

    Where URL is the Service URL(It is not WCF service)

    Request Type is one parameter.  RequestValue is second parameter.

    So basically I have to read an XML file, encode it and create URL as mentioned above.

    And I have to do this in BizTalk Server.  I have searched on internet and found one link Here

    My work much similar to this, but still not able to solve this.

    Could you please help me on this?

     

    Thanks,

    Nitin R.

     

     

    Tuesday, March 1, 2011 1:13 PM
  • All you need to do is to use a dynamic HTTP send port, where you construct the URL just before you make the call. See this : http://biztalk-dev.blogspot.com/2008/02/dynamic-send-ports.html
    -- Please mark as answered if this answers your question.
    • Proposed as answer by Manas G Wednesday, March 2, 2011 5:31 AM
    • Marked as answer by Andrew_ZhuModerator Wednesday, March 2, 2011 7:38 AM
    Wednesday, March 2, 2011 5:31 AM
  • I created a blog post around creating a send port with WCF-Custom adapter to be able to call the REST service. It will help you understand the different options and issues that come around when trying to call a REST service from a send port with the WCF-Custom adapter. I don't consider using the HTTP Adapter as using the WCF-Custom adapter gives me additional flexibility (I can configure behaviors, modify security, bindings, etc.).

    http://www.leandrodg.com.ar/blog/2011/03/calling-rest-services-from-biztalk-server-2010/

    This uses a static send port for this with a custom behavior to set up the destination address.

    You have 2 options, you can either use this method (which lets you set the destination address in the send port configuration) or you can use a static send port but instead of using this behavior you can configure the To property inside the orchestration.

    Let me know if it helps.


    • Edited by LeandroDG Thursday, March 31, 2011 7:36 PM
    • Proposed as answer by LeandroDG Thursday, March 31, 2011 7:37 PM
    Tuesday, March 15, 2011 2:14 PM
  • I saw this pop up on a feed recently - a very good article on BizTalk and REST on the TechNet Wiki: http://social.technet.microsoft.com/wiki/contents/articles/invoking-restful-web-services-with-biztalk-server-2010.aspx.

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Friday, March 18, 2011 2:40 PM
    Moderator