This post was originally published here

Exposing Orchestration as WCF Service – Notes

Exposing Orchestration as WCF Service – Notes

Orchestration with Receive and Send as two different Port (One-Way):

If you create an orchestration with independent Receive and Send Ports, then WCF Service Wizard will create void as return type for the client Service Reference.

You need to use WCFHttpPool to host the Orchestration in IIS.

WCF publishing wizard will create a new WCF-BasicHttp receive location. It will be a one-way receive location. This port will be running under BizTalk Isolated Host Instances.

WCF Publishing wizard will create a large text as the service reference name like
<Name Given As Service Reference Namespace>.<OrchProjectName_OrchestrationName_ReceivePort Name>.

By default, WCF Publishing Wizard creates BasicHttpBinding_ITwoWayAsynVoid as interface type name for WCF Service.

You need make sure the Receive Port is configured as Direct Binding.

Code for Calling WCF from Console Application:

RcvProcessPO.ExposeOrchWCFService_ProcessPO_prtRcvPOClient client = new
RcvProcessPO.PurchaseOrder po = new RcvProcessPO.PurchaseOrder();
po.PONum = “7002”;
po.PODate = “09/09/2015”;
po.POAmount = “1200”;
po.POQty = “120”;

Two way – Request Response port in Orchestration:

Make sure Request Response port is configured in Orchestration, and it should be bind directly to the Message Box.

Check WCFHttpPool application pool identity user has permission to biztalk databases.

Verify value passed to the client function is of reference type and you need to pass it as ref.

It will be difficult to stop port/location to examine the context or messages in BizTalk. Since it is Request Respond Receive Location, you cannot stop it. Even if you stop, WCF service will not be invoked at it says “Receive location is disabled”

Code for calling Request Response WCF from Console Application:

CalculatePOAmount.ExposeOrchReqResp_CalculatePOAmount_prtCalculatePOAmountClient client = new

CalculatePOAmount.CalculatePOAmountRequest req = new CalculatePOAmount.CalculatePOAmountRequest();

CalculatePOAmount.PurchaseOrder po = new CalculatePOAmount.PurchaseOrder();

po.PONum = “4567”;
po.PODate = “09/09/2015”;
po.POQty = “12”;
po.POUnitPrice = “100”;

CalculatePOAmount.CalculatePOAmountResponse resp = new CalculatePOAmountResponse();
resp.PurchaseOrder = po;
client.CalculatePOAmount(ref po);
resp.PurchaseOrder = po;

Console.WriteLine(” The calculated PO Amount = {0}”, resp.PurchaseOrder.POAmount.ToString());