BizTalk with REST Service

Now in BizTalk 2013 R2 release, Microsoft provide the communication with Rest Services through WCF-WebHttp adapter. Here are below things added in BizTalk to consume and publish REST Service through BizTalk.

  1. WCF-WebHttp adapter- to communicate with REST Service
  2. JSON decoder pipeline component- to convert Json file into xml format in Receive Pipeline.
  3. JSON encoder pipeline component- to convert xml file to Json in Send Pipeline.
  4. JSON Schema Wizard- To generate xsd from json file.

as we know RESTService has always prefer to have data in json format.

Note: Sometime when RESTService respond with empty message then BizTalk will generate the Object Reference is not found error in JSON decoder pipeline. Micorsoft has release the hotfix for that. You can download from below site.

URL:

https://support.microsoft.com/en-us/help/4020011/fix-wcf-webhttp-two-way-send-response-responds-with-an-empty-message-a

https://support.microsoft.com/en-us/help/4020020

Before BizTalk 2013 and upper version release, BizTalk was not communicating with REST Services without adding custom coding at pipeline level.

For older Version of BizTalk to communicate with REST Service you can refer the below reference:

https://social.technet.microsoft.com/wiki/contents/articles/2474.invoke-restful-web-services-with-biztalk-server-2010.aspx

 

Following five HTTP methods are commonly used in REST based architecture.

  • GET – Provides a read only access to a resource.
  • PUT – Used to create a new resource.
  • DELETE – Used to remove a resource.
  • POST – Used to update existing resource or create a new resource.
  • OPTIONS – Used to get the supported operations on a resource.

Generate an XSD schema for JSON message

You can Refer to below link:

https://msdn.microsoft.com/en-us/library/dn789171.aspx

Create pipelines to process JSON messages

Receive Pipeline:

We are using JSON decoder pipeline component in Receive Pipeline to convert json to xml format. This pipeline has two properties (if you have installed above define hotfix then three properties)

As mentioned in below screenshot.

jsondecoder.jpg

Below property details should be defined.

Add Message Body For Empty message: By default its False, we need to make this true to handle empty message. (This property only available when you have installed above defined hotfix).

Root Node: Define the schema root node name of the schema which is created through JSON Schema Wizard

Root Node Namespace: define the namespace of the schema which is created through JSON Schema Wizard.

Send Pipeline:

For sending json file from BizTalk, we can use the JSON encoder pipeline component. This component converts xml to json file. There is only one property in this pipeline component as defined in below screenshot.

jsonencoder.jpg

Remove Outer Envelope: By default, this property is defined False. When we make it true then its remove top layer or envelope of json file.

Example:

Json file with property Remove Outer Envelope as False:

{

  “TestRequest”: {

    “Test”: {

      “TestRequire”: true

    }

  }

}

Json file with property Remove Outer Envelope as True:

{

  “Test”: {

    ” TestRequire “: true

  }

}

For more info you can refer to below reference:

https://msdn.microsoft.com/en-us/library/dn789172.aspx

These are the prerequisites knowledge about how to deal with Rest-service through BizTalk.

Now in next blog we have defined that how to publish BizTalk as REST Service.

https://vkbiztalk.wordpress.com/2017/06/17/publish-biztalk-as-rest-service/

 

Advertisements

3 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s