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.
- WCF-WebHttp adapter- to communicate with REST Service
- JSON decoder pipeline component- to convert Json file into xml format in Receive Pipeline.
- JSON encoder pipeline component- to convert xml file to Json in Send Pipeline.
- 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:
Create pipelines to process JSON messages
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.
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.
Json file with property Remove Outer Envelope as False:
Json file with property Remove Outer Envelope as True:
” TestRequire “: true
For more info you can refer here.