Click here to Skip to main content
14,177,305 members
Click here to Skip to main content
Add your own
alternative version


23 bookmarked
Posted 22 Mar 2006
Licenced CPOL

Calling a Web Service with Custom Parameters from an Orchestration in BizTalk Server 2004

, 18 Apr 2006
Rate this:
Please Sign up or sign in to vote.
This article describes how to invoke a Web Service which has custom parameters from a BizTalk Orchestration.


It is generally very straight forward to invoke a Web Service from an BizTalk Orchestration. In some special cases, a Web service returns or accepts an object. In such cases, a custom map is required to send a request to the web service. We shall consider a case where an object is returned from a web service and how this is handled in BizTalk.

Employee Data Retrieval - Example

Consider a simple scenario where some information about an Employee is required within an orchestration. This employee information is provided by some web service, which takes in a EmployeeInput object as a input parameter and returns a EmployeeOutput object. Notice that both the input and output parameters to the web service are objects, and not simple .NET types.

First Came the Schemas...

Let us have a quick look at the input and output schemas...

Employee Request Schema


This is very simple schema with EmployeeCode element.

Employee Response Schema


The output schema contains all the elements related to the employee information.

Approach Overview - Steps to Invoke a Web Service

  • In the Solution Explorer, right-click on the Project and select "Add Web Reference". Follow the instructions on the dialog displayed.
  • Look under the folder "Web References" and open the file "Reference.xsd". This file would contain the expected input and output formats (XML elements) to correctly invoke the Web Service.
  • Promote all the properties (XML elements) in the "Reference.xsd" file, which are required within the Orchestration.
  • Create a new "Map" which maps the data from the Orchestration message to the Web Service input. In this case, select the namespace for "Reference.xsd" as the Destination schema.
  • Lastly use the "Send" and "Receive" shape to send Web service Request and Response respectively.

BizTalk Maps

In this project, we are using two maps:

  • The first one, would convert the input message into the one required by the Web Service.


  • The second one would convert the input message into the output message as required by the orchestration.


Building the Orchestration (Also Known as a "Business Process")

The parallel branch in this orchestration shall invoke the Web Service and perform the Transformation simultaneously.


Setting the parameters required to invoke the Web Service:

WSParamEmployeeInput.EmployeeCode = EmployeeIn.EmployeeCode;
WSRequest.employeeInput = WSParamEmployeeInput;
System.Diagnostics.EventLog.WriteEntry("Transformation", "EmployeeIn -> WSRequest");

Assigning the EmployeeOut message into a temporary variable:

TempEmployeeOut = EmployeeOut;
System.Diagnostics.EventLog.WriteEntry("Transformation", "Employee In to EmployeeOut");

Assigning the data obtained from the Web Service to the EmployeeOut message:

EmployeeOut = TempEmployeeOut;

EmployeeOut.EmployeeCity = WSResponse.RetrieveEmployeeResult.EmployeeCity;
EmployeeOut.EmployeeName = WSResponse.RetrieveEmployeeResult.EmployeeName;
EmployeeOut.EmployeeDept = WSResponse.RetrieveEmployeeResult.EmployeeDept;
EmployeeOut.EmployeeEmail =WSResponse.RetrieveEmployeeResult.EmployeeEmail;

List of various messages used in the Orchestration...


Executing the DEMO

Input XML File


Notice the input file data. The EmployeeCode is filled up.

Solution Explorer


Observe the various artifacts in the Solution Explorer.

Output XML File


The output XML file has all the information about the Employee.

About the Downloadable Code

  • Unzip the file with the folder names in the C:\ drive.
  • Unzip the file with the folder names in the C:\inetpub\wwwroot drive and setup the Web Service Application through Internet Services Manager.
  • The folder KeyAndBindings contains the Bindings.xml file, which can be imported after the solution is built and deployed.
  • Place the EmployeeRequest_1.xml in the In folder and observe the Event log to find out the various events generated, and finally observe the Out folder for the output XML file.

Quick Takeaways

  1. Always set the Activate property to "true" for the first Receive shape in the orchestration.
  2. Note the XSD file generated when a Web Reference is added to the Project.
  3. Ensure that all the promoted properties in the schema have a default value.
  4. A BizTalk service needs to be re-started every time a deployment is done.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Naveen Karamchetti
Architect AT&T Wi-Fi Services
United States United States
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.

Naveen has developed the BizTalk Control Center (BCC)

You may also be interested in...


Comments and Discussions

GeneralMy vote of 3 Pin
MiriBosi15-Mar-11 1:02
memberMiriBosi15-Mar-11 1:02 
GeneralMy vote of 5 Pin
ruwalimanoj8325-Jul-10 21:34
memberruwalimanoj8325-Jul-10 21:34 
GeneralMy vote of 1 Pin
tatasunder23-Sep-09 0:04
membertatasunder23-Sep-09 0:04 
QuestionHow to setup the Web Service Application through Internet Services Manager. Pin
sam yassa15-Sep-08 5:42
membersam yassa15-Sep-08 5:42 
GeneralThanks a lot! Pin
Bogdan Dumitrescu19-Apr-07 0:57
memberBogdan Dumitrescu19-Apr-07 0:57 
GeneralNot very user friendly Pin
shahzad.syed15-Aug-06 20:07
membershahzad.syed15-Aug-06 20:07 
QuestionDoes anyone actually care about this? Pin
Heywood19-Apr-06 4:32
memberHeywood19-Apr-06 4:32 
AnswerRe: Does anyone actually care about this? Pin
benjamin wegner26-Apr-06 21:25
memberbenjamin wegner26-Apr-06 21:25 
GeneralRe: Does anyone actually care about this? Pin
Heywood27-Apr-06 3:28
memberHeywood27-Apr-06 3:28 
GeneralRe: Does anyone actually care about this? Pin
Naveen Karamchetti27-Apr-06 8:20
professionalNaveen Karamchetti27-Apr-06 8:20 
why are you having this -ve feeling? whats the matter? Did not like my article at all?? Frown | :(

Always be there....| MCSD.NET | Sun Certified...

AnswerRe: Does anyone actually care about this? Pin
niles bhor28-Apr-06 4:09
memberniles bhor28-Apr-06 4:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190526.1 | Last Updated 19 Apr 2006
Article Copyright 2006 by Naveen Karamchetti
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid