GET method at Receive Port

When we publish BizTalk as REST Service, then it’s not directly linked with Schema or Orchestration like WCF or Web Service does. in my previous blog, I have mentioned how to publish BizTalk as REST Service with help of BizTalk WCF Service Publishing Wizard Tool.

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

Here when we define the action configuration in Receive Location in that we provide Message Context property BTS.Operation for Operation Name, through this message context property, incoming message can link with orchestration Receive Port or Send Port with applying details in Filter. In below example

<BtsHttpUrlMapping><Operation Name=”TESTGETMETHOD” Method=”GET” Url=’/OperationName/Request?Param1={param1}&amp;Param2={param2}’ /></BtsHttpUrlMapping>

Here Operation name is TESTGETMETHOD. So BTS.Operation Message Context Property is stand for TESTGETMETHOD.

For Pipeline configuration related information, you can refer to below reference:

https://vkbiztalk.wordpress.com/2017/06/14/biztalk-with-rest-services/

The purpose of enabling GET operation is to fetch data from target system. Other perspective is when request parameters are few in count wise, then we can go with GET API URL.

We will discuss the configuration details at receive location transport level for GET operation.

  • Promote the elements (Param1 and Param2) from message schema whose elements are going to use in GET API URL.
  • Navigate transportation configuration of the REST API receive location and add below text in HTTP method and URL mapping shown in below snap.
  • <BtsHttpUrlMapping><Operation Name=”<Name>” Method=”GET” Url=’/OperationName/Request?Param1={param1}&amp;Param2={param2}’ /></BtsHttpUrlMapping>
  • If there is not require any parameter in GET method then no need to add parameters in BizTalk Schema.
  • Map the elements with property schema element names and namespace as below.
rest14.jpg

In GEt method of REST Service, there is no message body. Information is sending in URL as Parameter as in below example:

here Param1 and Param2 are the two parameters of the GET method. Now We need to understand how BizTalk work with this. In above screen shot we are defining Variable Mapping. In variable Mapping, we are assigning parameters with Property Schema. We need to define Property Schema variable with Message Context Property. Otherwise it will not assign any value.

Rest13_PropertySchema.jpg

Create your property schema with those properties, set the Property Schema Base to MessageContextPropertyBase.

When BizTalk receive request with JSON decoder pipeline, then its create message.

Receive location transportation url would be like this: /BizTalkRestServiceTest/Service1.svc

Receive Pipeline for get Method: ( if orchestration is subscriber for the get method)

Note: Get Method does not contain any message it has just URL. So, if you need to create custom message body in Receive pipeline Disassembler stage. You can download code from github from below reference.

https://github.com/BizTalkComponents/HttpDisassembler

And configure the schema details in the HttpDisassembler property section as below:

Here DocumentSpecName would be Schema Name, Assembly Name

GET Method at Send Port:

In case of when BizTalk consuming Rest Service through its Send Port with Wcf-WebHttp adopter, then its configuration is same as in Receive Port except one nominal change in below configuration.

<BtsHttpUrlMapping><Operation Name=”” Method=”<REST METHOD>” Url=’/OperationName/Request’ /></BtsHttpUrlMapping> 

There is not require to provide Operation name, we can leave it blank as above.

BizTalk Server Monitoring

One response to “GET method at Receive Port”

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 )

Facebook photo

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

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: