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.
Created an XML schema with 'Status' field as distinguished field.
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
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.
After clicking next a receive port is created with the name specified on
the logical port in the Orchestration.
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.