Saturday, December 15, 2007

Exposing a BTS orchestration as a WCF service

Hey everyone, I've learened recently few new technologies that were just released and so decided to share some of the stuff that was hard to find on the web.

I'll start with Exposing a BizTalk orchestration as a WCF service, it's really simple but there are some problems that happened along the way.

1. First publish your orchestration as a WCF service

- open the “BizTalk WCF Service Publishing Wizard”

-Select your Http Binding
-Browse for your BizTalk application

-Browse for your BTS application dll.

-Type the name of your namespace.
-Type the name of the Service on the IIS.

2. After you finish you will have a WCF service created in your IIS.

3. Now you can “Browse” your WCF service normally as any webService.

4. Consuming your WCF service in a client application:

a. Open VS Command Prompt and type:
“svcutil.exe http://server2003sql:81/WCF_Service/DemoBTS_OrderProcessing_Order_RecievePort.svc?wsdl”
b. This will generate two files at the directory you are on, a configuration file “Output.config”; which contains the endpoint for your WCF service and a code file “BizTalkServiceInstance.cs”; that contains the client class (objects for your receive port and objects for your schemas).
c. Add the two files to your client application and use the generated client class to call the Service.

5. Submitting data from InfoPath to WCF service:
It’s the same as submitting to WebService, you can find its steps here:

  • Problem 1
An error occurred while browsing your WCF service from IIS and you can’t view the error.
1. Open the “web.config” file at “C:\Inetpub\wwwroot\WCF_Service”.
2. Uncomment the tag, now you’ll be able to view your error
  • Problem 2

The SOAP Adapter fails to register

The following error may occur when BizTalk Server attempts to register the SOAP (or HTTP) adapter.
"The Messaging Engine failed to register an adapter "SOAP" (Or "HTTP"). Details: "Registering multiple adapter types within the same process is not a supported scenario. For e.g. HTTP and SOAP receive adapters cannot co-exist in the same process".

When running BizTalk Server on Windows Server 2003 / IIS 6.x, the SOAP and HTTP adapters cannot execute in the same process space or application pool.
If an installation requires using both the SOAP and HTTP adapters on the same Web server then separate application pools must be created for each adapter. Once created, the virtual directories for each adapter are each assigned to a different application pool.

  • Problem 3

You forgot to assign the receive port of the orchestration to the generated receive port of the WCF service.
In the “BizTalk Server Administration” Tool >> Orchestration properties >> Bindings

No comments:

Post a Comment