locked
Integrating BizTalk with WCF and Web API's ? RRS feed

  • Question

  • How to Integrate BizTalk with WCF and Web API's ?

    What are Web API's ? Anyone a link or example in Integrating with BizTalk.


    MBH

    Thursday, November 3, 2016 8:05 PM

Answers

All replies

  • Hello,

    Its very simple to consume Web API from BizTalk.

    you can test by create simple send port and publish to message box.

    Configure send port with WebAPI with GET Operation.

    <BtsHttpUrlMapping><Operation Method="GET" Url="<you can pass parameters>" /></BtsHttpUrlMapping>

    if end point has behavior configure under behavior section.

    under messages mention content type : application/xml (if api returns data as JSON).

      Deploy and test.

    you can have a look below article. 

    http://social.technet.microsoft.com/wiki/contents/articles/18935.biztalk-server-2013-consuming-a-restful-endpoint-using-wcf-webhttp.aspx

    This is for just consume web api. If you want to consume JSON u need to place JSON Receive pipeline. 

    hope this helps. 


    Ram

    Thursday, November 3, 2016 8:44 PM
  • Hi,

    Wcf creates a URL which is consumed by an application to access it.

    In Web API the URL can be configured by consumer leveraging urlmappings that will be in the App_Start folder. 

    Article Below:

    Web API

    http://www.quicklearn.com/blog/2013/08/16/biztalk-server-2013-support-for-restful-services-part-15/

    Wcf

    https://msdn.microsoft.com/en-us/library/bb246019.aspx?f=255&MSPPError=-2147217396

    exposing as wcf  services 

    https://psrathoud.wordpress.com/2014/08/05/publishing-schemas-as-a-webservice/


    Regards PK: Please mark the reply as answer or vote it up, as deemed fit.

    Thursday, November 3, 2016 8:49 PM
  • Well, "WebAPI" means whatever someone wants it to mean, it's a fairly generic term.

    But, the prevailing definition is a service that uses http and either JSON or Xml without SOAP.

    Given that, BizTalk has been using "WebAPIs" since the beginning, there's really nothing special about it.

    Thursday, November 3, 2016 9:35 PM
    Moderator
  • Hi jaguajags,

    Web APi is defined as 

    " A server-side web API is a programmatic interface consisting of one or more publicly exposed endpoints to a defined request–response message system, typically expressed in JSON or XML, which is exposed via the web—most commonly by means of an HTTP-based web server."

    To Consume WCF service in Biztalk you use the WCF-Custom, WCF-basicHTTP and other WCF based adapter based upon your need. To consume web API in Biztalk you use the WCF-webhttp adapter .

    Go through the links mentioned below to try out some examples

    BizTalk Server 2013: Consuming a RESTFul Endpoint using WCF-WebHttp

    Walkthrough: Consuming WCF Services with the WCF-BasicHttp Adapter

    Consuming WCF Service in BizTalk 2010 Orchestration

    Regards


    Mandar Dharmadhikari

    Friday, November 4, 2016 5:00 AM
    Moderator
  • Hi Mandar - in the below link, where does It has one endpoint that only supports GET operation ??

    http://services.faa.gov/docs/services/airport/#airportStatus


    MBH

    Friday, November 4, 2016 1:54 PM
  • sorry the question is not clear to me..can you explain in a bit detail please

    Mandar Dharmadhikari

    Friday, November 4, 2016 2:35 PM
    Moderator
  • It is mentioned in this link http://services.faa.gov/docs/services/airport/#airportStatus

     for this service      http://services.faa.gov/airport/status/SEA?format=xml       

    it states  'It has one endpoint that only supports GET operation'. How to know there is only one operation and that is GET ? 

    It can also be many operations ? It can be PUT, POST, DELETE ??  From the service link how to know it is GET operation ?


    MBH

    Friday, November 4, 2016 2:40 PM
  • That definition u get from the service provider. They would specify what all verbs are supported on their API and the call process for them by providing a sample in case of REST or a WSDL in case of SOAP

    Pi_xel_xar

    Blog: My Blog

    BizTalkApplicationDeploymentTool: BizTalk Application Deployment Tool/

    Friday, November 4, 2016 2:49 PM
    Answerer
  • Well That detail for the verb that needs to be used, the content-type of the service header along with the necessary request/response message payloads(json or xml) are provided by the service provider. Meaning the team which develops and maintains the web api will provide you these details as there is no metadata associated with the REST apis

    Regards


    Mandar Dharmadhikari

    Friday, November 4, 2016 2:55 PM
    Moderator
  • so say I have a separate team within my company working on this Web APIs, so when ever they expose this service, as I am a BizTalk guy I always need to ask that Web API developer what all definition or verbs are supported ?

    What is difference between GET, PUT, POST, DELETE ?


    MBH

    Friday, November 4, 2016 2:59 PM
  • Yes you will have to ask the team specifically for following things

    1) The message payloads for request and response (json/xml)

    2) The Verb to call the api

    3) The content-type that need to be passed in the header

    4) The security details if any that they have implemented for their api.

    To know more about the verbs used in REST 

    refer REST api verbs



    Mandar Dharmadhikari

    Friday, November 4, 2016 3:05 PM
    Moderator
  • Ok thank you.

    How different are REST services(WEB APIs) when compared to WCF services ?

    what would be major different when consuming both in BizTalk ?


    MBH

    Friday, November 4, 2016 3:10 PM
  • The main difference is that in case of REST api there will not be any metadata associated with the service while the WCF service will have its metadata defining the operation name the message types and other details.

    This difference will be visible when you try to consume the REST api using the add generated items Wizard. You will not be able to generate the request response schemas or the binding file for the send port pointing to the api.

    In case of WCF service you will be able to generate the request response messages and the binding file to generate the send port in Admin console once you use the Add generated items wizard.

    To learn about how to consume them please visit the links that i have shared and try out the tutorials and the difference will be more clear after you try it out yourself


    Mandar Dharmadhikari

    Friday, November 4, 2016 3:15 PM
    Moderator
  • ok, will try it out.

    One last question : when using WCF-WebHTTP Adapter (for REST or WEB API services), do we have to remove body detail part. I see a link provided by Saravana as below :

    http://blogs.biztalk360.com/rest-wcf-webhttp-adapter-in-biztalk-server-2010-r2/

    Why do we need to do this ?


    MBH

    Friday, November 4, 2016 3:19 PM
  • Ok thank you.

    How different are REST services(WEB APIs) when compared to WCF services ?

    what would be major different when consuming both in BizTalk ?


    MBH

    Refer Here:

    Some great info available. 


    Pi_xel_xar

    Blog: My Blog

    BizTalkApplicationDeploymentTool: BizTalk Application Deployment Tool/

    Friday, November 4, 2016 3:19 PM
    Answerer
  • Because that is the way GET verb works, you do not need to invoke the get with message payloads, and hence no need for the body content.

    One of the basic requirements of a GET request is there should not be any content in the body. But in BizTalk case when the REST send port receives the message the message. the bodypart of the message will be added to the HTTP request body. This is against the HTTP GET request specification and the underlying code will through the protocol violation exception as shown below.

    Regards


    Mandar Dharmadhikari



    Friday, November 4, 2016 3:22 PM
    Moderator
  • Here's where I say just try it and see what happens.

    The worst that will happen is you get an error. :)  But, you can often learn the most from what doesn't work.

    Friday, November 4, 2016 4:18 PM
    Moderator
  • Hi Ramshankar - what if the service is not within network ?

    How to access this and process ?


    MBH

    Friday, November 4, 2016 4:19 PM
  • You consume the service over the internet by following certain security measures and by opening the necessary port in the firewall

    Regards


    Mandar Dharmadhikari


    Friday, November 4, 2016 4:21 PM
    Moderator
  • Hi Ramshankar - what if the service is not within network ?

    How to access this and process ?

    To be clear, the client really has no knowledge of the location of the service so...it doesn't matter.  You access it by whatever rules it defines, which would be the same inside and outside your network.

    Try it.  Please.  The FAA services, now at least, are pretty easy to work with.  Trust me, I know.

    Friday, November 4, 2016 4:26 PM
    Moderator
  •  the prevailing definition is a service that uses http and either JSON or Xml without SOAP
    • Proposed as answer by gdsgd Tuesday, February 20, 2018 10:29 AM
    Tuesday, February 20, 2018 10:28 AM
  • The main difference is that in case of REST api there will not be any metadata associated with the service 

    It is possible to have additional documentation on the same site of the provided APIs
    eg the swagger plugin can provide this for ASP.NET or Core Web APIs
    https://swagger.io/

    /Peter


    • Edited by Peter Lykkegaard Wednesday, February 21, 2018 11:11 AM Reduced quote
    Wednesday, February 21, 2018 11:10 AM