Wednesday, March 27, 2013

Exposing orchestration as WCF service biztalk example

I am going to demonstrate how to expose an Orchestration as WCF service & then consuming this exposed service using a WCF client.

Overall flow of the solution :

1. Creation of a solution
2. Creation of a BizTalk project in the solution which contains an XML schema & an Orchestration.
3. Publishing the Orchestration to IIS using BizTalk WCF publishing wizard.
4. Creation of a C# console project in the same solution.
5. Addition of the service reference of the above exposed orchestration into the C# console application.

Schema :

Created an XML schema with 'Status' field as distinguished field.

Orchestration :

The Orchestration simply receives a message from a folder path & the Status
of the message is changed to 'received' & then this new message is send to a 
output folder location.

There are two messages used in the orchestration one for receive shape & one
for send shape but these two messages uses the same schema as message type.

The message assignment shape simply copies the input message into output &
then assigns the status field as 'received'.

After doing all this I'll build this BizTalk project & deploy this project to 
Admin console.

Exposing the Orchestration :

Our brand new orchestration is ready to be exposed to IIS. We a wizard to
to perform this thing. In visual studio -> tools we have BizTalk WCF publishing 

After clicking next we have two options Service Endpoint & Metadata only endpoint.

We'll choose Service endpoint & also create a receive location in the deployed BizTalk

After that clicking next we see two options of exposing either schema or 
Orchestration.Choose Orchestration & click next.

Then we need to choose our Biztalk project dll. 

After clicking next a receive port is created with the name specified on
the logical port in the Orchestration.

After clicking next Specify the appropriate namespace for our service.

After clicking next we have the option to locate our service. We can use
localhost to deploy the service on local IIS server or we can change host 
to deploy the service on any other machine's IIS server.

On clicking next a WSDL is created for our service.

After clicking next a new receive location is created in the our project 
in the admin console. We need to enable this receive location to browse
our WCF service.

Next step is to browse the service from the IIS.

Our exposed Orchestration service looks like below screenshot.
We need to copy the link in the explorer so that a service reference can be 
added to consume this service.

After that I have created a new C# console application to act as a client 
for our WCF service calling. Now we need to add the service reference of our

Paste the URL copied from the explorer & click go.
Our service will be discovered & change the namespace.
This namespace will be used in our client to call the service.

Now in the client code we create an object of the client WCFClient.
An object of the root node of the schema is also created. We pass the 
appropriate values to this object & call a method which is nothing but the
operation specified on the logical receive port in the Orchestration. Then
we close our client.

We simply start a new instance of our console program.
This will create a new message which will be passed to the 
logical port of the orchestration & finally the message will be 
processed by orchestration & a new XML file will be created at
the output folder.


  1. hi rahul

    in orchestration i got error while doing this sample
    Error 1 #error: "No Constructed Messages."

    in msg assignment shape

    plz give me am new to Biztalk


  2. COURSE OUT LINE - Biztalk Server Online Training
    Introductions to Enterprise Application Patterns and BizTalk Server, Understanding BizTalk Framework, Setting up a BizTalk Server Environment, Messaging Architecture, Setting up a BizTalk Server Environment Engine, Business Activity Monitoring, WCF Services Schemas in BizTalk, Transformations in BizTalk, The BizTalk Messaging Engine and Pipelines, Adapters in BizTalk, Orchestrations, Advanced Orchestrations, Integration Patterns in BizTalkBizTalk Rules with BizTalk, Testing BizTalk Artifacts, BizTalk Server Instrumentation, Error Handling, and Deployment,Tracking and Deploying BizTalk Solutions, Monitoring and Maintenance, Administration, BizTalk Server Performance andTuning, BizTalk Tools, BizTalk 2013 Features, ESB Toolkit 2. - Employees to learn at their own pace and maintain control of learning “where, when and how” with boundless access 24/7by 21st Century Software Solutions. ---- Call Us +919000444287

  3. is there a code download link for this sample?

  4. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Windows foundation communication, kindly contact us
    MaxMunus Offer World Class Virtual Instructor led training on Windows foundation communication. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email :
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –