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 REST Service 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 here

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 here.

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://vkbiztalk.com/2020/03/11/create-schema-from-json-files/

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.

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.

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 here.

Click here for publishing BizTalk as REST Service

Click here for consuming REST Service by BizTalk

BizTalk Server Monitoring

4 responses to “BizTalk with REST Service”

  1. […] to create schema for json file. And add JSON decoder in Receive Pipeline Decode component. Click here for more details. Create your property schema with those properties, set the Property Schema Base […]

    Like

Leave a comment