Geeks With Blogs
Saqib Ullah BootStrapper Know How

This is my first technological article. Today I want to present you how to use .Net Web Services in BizTalk Server 2006. Actually the main purpose of this article is to address the problems faces by the beginner BizTalk engineers. Especially how to configure Web Port in BizTalk Administration console. In this article I explain the ConsumeWebService sample application of the BizTalk Server Orchestration sample. This sample application is a very good and easy and it’s show us how to invoke web service from BizTalk orchestration and how to apply SOAP adapter in BizTalk application.
You can find the application in the ‘Installation Drive\Program Files\Microsoft BizTalk Server 2006\SDK\Samples\Orchestrations\ConsumeWebService’.

Note:
In this article I don’t use setup.bat file.

ConsumeWebService Sample:

This sample application is basically divided into two parts first one called POWebService and second is the BizTalk application that use POWebService called consumeWebService. Here I don’t want to present you how .Net web services works because it’s a complete science but you should know about it before lunge in this article. ConsumeWebService application process the income Purchase Order with the help of POWebService Web service. BizTalk application receives Purchase Order in the XML form [actually in a file] and orchestration passes it to Web service as a simple string. POWebService application return invoice message to the calling orchestration in the string form. After applying transform, orchestration writes the invoice message to an .xml file. For the sake of easiness I redraw the ReceivePOandSubmitToWS orchestration and mark its controls with the numbers Figure 1. With orchestration file you also found a collection of messages and Ports in the Orchestration View window. Whenever you go to add a Web port you also need a Web service reference in the BizTalk application project. Actually the reference is the description of Web service that is available to your project. When you add a Web reference to BizTalk application project its does the following things for you.

·          Orchestration Web port

·          Web message type

·          Reference.map file

·          Reference.odx file

·          <WebService>.disco file

·          <WebService>.wsdl file

·          If <WebService>.wsdl file contains schema Web messages types, Reference.xsd file is also adds.

ConsumeWebService project also contains mapping and schema file that is necessary for the application. There is no rocket science in these files it contains xml schemas and their mapping.

How ReceivePOandSubmitToWS Orchestration Works

This orchestration is actually the main block of activity where we call Purchase Order Web service.



Fig 1: ReceivePOandSubmitToWS orchestration.

In this orchestration there are three ports. First port (1) is use for receive purchase order file, second port (11) is use for send invoice file and third port (6) is use for Web service communication. Above workflow starts from “FilePOReceive” receive component and its take Microsoft.Samples.BizTalk.ConsumeWebService.InboundPO type of message InboundPOMessage (2). “ConstructPOMessage” Construct message component comes after the receive shape (2) we set messages constructed property to WebServicePOMessage because we transform the xml file purchase order to Web purchase order (3). You have notice that ConstructPOMessage contain “TransformFilePOToWebPO” transform component where message transformation is take place so therefore we set input messages property of transform. In ConsumeWebSevice project you find two mapping files namely “FilePOToWebPO” and “WebInvoiceToFileInvoice”.  We use FilePOToWebPO map file for Source Transform “InboundPOMessage” to Destination TransformPODocument” (4). WebServicePOSend send component take the message type of WebServicePOMessage and call the Web service from POWebServicePort port (6) and the same port is use to get the response from Web service and return message type of WebServiceInvoiceMessage to WebServiceInvoiceReceive receive component (7). On this stage we use Web services in our orchestration and get Microsoft.Samples.BizTalk.ConsumeWebService.localhost.POWebService_.submitPO_response type of message. Here another ConstructInvoiceMessage (8) construct message shape is waiting for us and its construct InvoiceMessage message type. Process of transformation is take place in the transform shape we called it TransformWebInvoiceToFileInvoice where we use WebInvoiceToFileInvoice map file and give Source Transform “SubmitPOResult” to Destination TransformInvoiceMessage” (9). Finally orchestration complete the conversion of purchase order to invoice and ready to send it through FileInvoiceSend (10) send shape that accept InvoiceMessage type of message.

Note:
“Open the FilePOToWebPO.btm you have notice that Source Schema is InboundPO.xsd and destination schema is Reference.xsd and we use this file in TransformFilePOToWebPO transform shape”.

“Open the WebInvoiceToFileInvoice.btm you have notice that Source Schema is Reference.xsd and destination schema is Invoice.xsd and we use this file in TransformWebInvoiceToFileInvoice transform shape”.

 

Host:

The BizTalk Host object represents a logical set of zero or more runtime processes in which you can deploy services, pipelines, and other artifacts.

·          Hosts are the logical container of BizTalk Server objects.

·          Only one instance of a specific host can exist on each server.

·          You can map one host to multiple servers.

Host Instance:

A host instance is the physical installation of a host in a BizTalk Server. A BizTalk Server can support multiple host instances.

·          Host instances are the physical containers of BizTalk Server objects.

·          You create a host instance when you map a server to a host.

·          Multiple host instances (of different hosts) can exist on a server when load balancing or for failover.

 

Type of Hosts:

There are two types of host instance base on the configuration.

·          In-process Hosts:  In-process host represent service instances in which we host orchestrations, send handlers and host only receive handler of File and BizTalk Message Queuing adapters.

·          Isolated Hosts: Isolated host represent the service instances primary host adapters that must run outside of the normal BizTalk Server runtime process. Adapters like HTTP/S and SOAP [receive] are hosted in Isolated Host.

BizTalk Isolated Hosts

If you want to deploy Web service that communicates with BizTalk application so you must have at least one Isolated Host in BizTalk Server.

How to Deploy Web Service

Open POWebService Web service project in Visual Studio 2005. Build the project and deploy it on the Internet Information Server. I use IIS 5.1 as web server for POWebService Web service I mention it because IIS 5.0 or IIS 5.1 don’t have application pool. Select High (Isolated) in application protection for application pool isolation and in the result of this selection separate COM+ application will be create for each virtual directory.

How to Deploy and Configure BizTalk Application

Open ConsumeWebService BizTalk application project in Visual Studio 2005 and take project properties.

·          In solution Explorer, right-click Solution ‘ConsumeWebService’, and then click Properties.

·          In the solution ‘ConsumeWebService’ Properties Pages dialog box, in the tree control, expand Configuration Properties, and then click Configuration.

·          Give Application Name in property and set True in Redeploy, and then click OK.

·          In Solution Explorer, right-click Solution ConsumeWebService, and then click Deploy Solution.

Note: The Output pane at the bottom of the screen should read: Deploy Operation Succeeded.

·          Click Start, point to Programs, point to Microsoft BizTalk Server 2006, and then click BizTalk Server Administration.

·          In the BizTalk Server Administration console, expand BizTalk Server 2006 Administration, expand BizTalk Group, expand Applications, right-click ‘ConsumeWebService’, and then click Configure.

·          In the Configure Application dialog box, on the ‘ConsumeWebService’ to do the following:

Use this

To do this

Host

From the drop-down list, select BizTalkServerApplication.

ReceivePO

From the Receive Ports drop-down list, select <New receive port>.

·          In the ReceivePort1 - Receive Port Properties dialog box, on the General tab, in the Name box, type ReceivePO_ReceivePort.

·          In the ReceivePort1 - Receive Port Properties dialog box, on the Receive Location tab, click New.

·          In the ReceiveLocation1 -- Receive Location Properties dialog box, do the following:

Use this

To do this

Name

Type ReceivePO_ReceiveLocation.

Type

From the drop-down list, select FILE.

·          Click Configure.

·          In the FILE Transport Properties dialog box, in the Receive folder box, type C:\Program Files\Microsoft BizTalk Server 2006\SDK\Samples\Orchestrations\ConsumeWebService\In\ and then click OK.

·          In the ReceivePO_ReceiveLocation -- Receive Location Properties dialog box, from the Receive pipeline drop-down list, select XMLReceive, and then click OK.

·          In the ReceivePO_ReceivePort - Receive Port Properties dialog box, click OK.

·          In the Configure Application dialog box, on the ReceivePOandSubmitToWS tab, in the SendInvoicePort row, from the Send Ports/Send Port Groups drop-down list, select <New send port>.

·          In the SendPort1 - Send Port Properties dialog box, on the General tab, do the following:

Use this

To do this

Name

Type SendPOInvoice_SendPort.

Type

From the drop-down list, select FILE.

·          Click Configure.

·          In the FILE Transport Properties dialog box, do the following:

Use this

To do this

Receive folder

Type C:\Program Files\Microsoft BizTalk Server 2006\SDK\Samples\Orchestrations\ConsumeWebService\In\

File name

Type Invoice%MessageID%.xml

·          Click OK.

·          In the SendPOInvoice_SendPort - Send Port Properties dialog box, from the Send pipeline drop-down list, select PassThruTransmit, and then click OK.

·          In the Configure Application dialog box, on the ReceivePOandSubmitToWS tab, in the POWebServicePort row, from the Send Ports/Send Port Groups drop-down list, select <New send port>.

·          In the SendPort1 - Send Port Properties dialog box, on the General tab, do the following:

Use this

To do this

Name

Type SendPOWebService_SendPort.

Type

From the drop-down list, select SOAP.

·          Click Configure.

·          In the SOAP Transport Properties dialog box, do the following:

Use this

To do this

Web service URL:

Type http://localhost/ConsumeWebService/SubmitPOService.asmx

·          Click OK.

·          In the SendPOWebService_SendPort - Send Port Properties dialog box, from the Send pipeline drop-down list, select PassThruTransmit, and from the Receive pipeline drop-down list, select PassThruReceive, and then click OK.

·          In the Configure Application dialog box, click OK.

To Start the Application

Follow these steps to start BizTalk application.

·          In the BizTalk Server Administration console, expand BizTalk Server 2006 Administration, expand BizTalk Group, expand Applications, right-click ConsumeWebService, and then click Start.

·          In the Start ConsumeWebService Application dialog box, click Options, ensure that all of the check boxes are selected, and then click Start.

·          To check the status of ConsumeWebService, in the console tree, click Applications.

The status of the ConsumeWebService application should be ‘Started.

Test the Application

·          Paste InputPO.xml file in [In] folder.

·          Invoice{GUID}.xml file is generated in [Out] folder.

How to debug Orchestration

You can use this blog to follow the steps that require debugging BizTalk orchestration.

Posted on Sunday, August 5, 2007 3:35 AM | Back to top


Comments on this post: Consume Web Service in BizTalk Server

# re: Consume Web Service in BizTalk Server
Requesting Gravatar...
Hello,

Thank you for the nice and simple explanation. I am new to BizTalk and trying to consume a web service in a simple orchestration I am trying to build. I tried to follow the steps in your article, however, I was unable to open the POWebService project. I do have VS 2005, I get a the application for project is not installed message. Could you tell me if any specific templates are needed to open this project? I have VS 2005 Professional Edition.

Thanks!
Suma.
Left by Suma on May 02, 2008 6:11 AM

# re: Consume Web Service in BizTalk Server
Requesting Gravatar...
Thanks Saqib,

This article helped me in working with this sample. Have you any other article in this scenario like, asp.net app send request to BizTalk, biztalk send the response to webservice, get response from ws and send it back to asp.net app?
Left by Sheo Narayan on Feb 01, 2009 2:47 AM

# re: Consume Web Service in BizTalk Server
Requesting Gravatar...
How to consume a web service published from schema?
Left by chandan on Mar 05, 2009 9:13 PM

# re: Consume Web Service in BizTalk Server
Requesting Gravatar...
See this step wise simple example on consuming web service in BizTalk Server 2006

http://www.dotnetfunda.com/articles/article296.aspx
Left by Sheo Narayan on Mar 29, 2009 1:52 AM

# re: Consume Web Service in BizTalk Server
Requesting Gravatar...
you have used two receive shapes in your orchestration.how you set two receive shapes activate to true .
Left by mahender on Oct 26, 2015 1:25 AM

# re: Consume Web Service in BizTalk Server
Requesting Gravatar...
Hi Mahender,

As you said that you are using two receive shapes, could you please let me know whether you are using convoy shapes.
Left by Satheesh Koulla on Sep 15, 2016 9:25 PM

Your comment:
 (will show your gravatar)


Copyright © Saqib Ullah | Powered by: GeeksWithBlogs.net