Wednesday 24 December 2008

How to Call Custom Receive Pipeline inside Orchestration

How to Call Custom Receive Pipeline inside Orchestration
Create a simple project which accepts OrderDetails as input xml and transform to OrderSummary xml file.
ProjectName : CallPipeline
Here I created custom receive Pipeline which uses the “XML disassembler” component to validate my input message against the predefined XSD schema.

Step-1

Create Schema CallPiplineInOrder.xsd and define the structure as mentioned below image
Create Schema CallPipelineOutOrder.xsd and define the structure as mentioned below image and do a simple map.

Step-2
Add new receivepipeline and name it as receiveOrderPipe.btp and add the “XML Disassember” and set the property

DocumentSchema = CallPipeline.CallPiplineInOrder

Step-3
Add reference of Microsoft.XLANGs.Pipeline.dll from the location C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.XLANGs.Pipeline.dll
Create New Orchestration and place an Scope shape and set the Transaction Type= Atomic

Create new Variable vReceivePipeline and set the property
Type= Microsoft.XLANGs.Pipeline.ReceivePipelineOutputMessages

Inside the Expression Shape Write the following Code.
vReceivePipeline = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(CallPipeline.receiveOrderPipe),inboundMsg);

CallPipeline.receiveOrderPipe is projectName.Receive Pipeline TypeName



Here MY projectName = CallPipeline and Receive Pipeline TypeName = receiveOrderPipe

Finally your orchestration looks like ..


You can reach me @raj.webjunky@yahoo.com











Thursday 11 December 2008

BizTalk Consumes Complex Data Type (Class/Object) Web Service

I have been trying to find an article that shows some light on how to consume a Web Service that returns Complex Data Type like Class / Object. At last I tried with small example which gave me good “Beep” to do a further investigation for Complex Data Types with Web Service.Here is my Class which I am going to use it as Complex data Type in Webservice.
Here is my Class which I am going to use it as Complex data Type in Webservice.

Create a C# WebService and create an Web Method that accepts 3 input parameters lime Employee ID , Employee Name and Employee JOB, also the web method returns the EMPLOYEE class as a datatype. Below is the Sample Code.


Now I am trying to Call this Webservice from the BizTalk , The challenge work is how Biztalk Returns the Employee Class to the destination ??

Schemas and Maps

Add a webreference to the BizTalk Application. Once you add web reference You can find a Reference.XSD file under your webReference. Here I renamed my webreference from localhost to “BTSlocalhost
Solution

Create a InputSchema that contain EmpID, Name, Job fields. The Structure looks like below


Create an ouput file with 3 fields as shown below

Now the Map is not between Input and Output Schema. Confused ??? , yes Here input schema used to send the data to the Webservice and that webservice returns the Employee Class as a Datatype. So the Reference.XSD is used as Source Schema and destination schema is ouput schema.
The Reference Schema contains the Employee Class and which creates a “Result” Method for Response object.


Orchestration

Create Message
Ws1_Resquest
= WebServiceTest.BTSLocalhost.AbcBTSWebServiceTest_. TestEmployee_request
Ws1_ResponseMsg = WebServiceTest.BTSLocalhost.AbcBTSWebServiceTest_.TestEmployee_response
Apart from this BizTalk creates an additional method called “Result” automacially.
Ws1_ResponseMsg. TestEmployeeResult
You need construct the TestEmployeeResult Message in your message Assignment shape.

Generate an Instance for your Reference.xsd and Load that XML file from your Message assignment shape and assign to “Ws1_ResponseMsg.TestEmployeeResult”

Apparently assign the input values to Webservice Method input parameters by extracting the values using xpath.
Ex: Ws1_Resquest.ename= xpath(InputMsg, string(“your xpath ”));



Now you need to use the Result Object in Transform Shape to assign the values to Output Schema.

Finally your Orchestration Looks like below.

Test your Application with sample File
Let me know If you have any issues reach me @ raj.webjunky@yahoo.com