Introduction - WCF Adapters for BizTalk Server 2006
The BizTalk Adapters for Windows Communication Foundation (WCF) allow Microsoft BizTalk Server 2006 R2 to communicate with WCF-based applications. The BizTalk WCF adapters include five physical adapters that represent the WCF predefined bindings.
The screen shot below depicts the list of WCF Biztalk adapters on the Biztalk Server 2006 R2 Server:
The TASK at Hand
In this article, we shall invoke a Web Service using the WCF adapter, but without using a web service proxy which is done typically. This can be any web service which has a WSDL file to describe itself.
Understanding the Solution Structure
The screen shot below shows the solution structure:
EmployeeSchemas - A BizTalk project which holds all the internal domain specific schemas. This has no references to any other project.
ProcessEmployee - A BizTalk project which contains an orchestration to process internal domain specific schemas, this has no knowledge about the web service schemas to be invoked.
EmployeeMaps - A BizTalk project which holds all the web service specific schemas and maps. This of course would have references to domain specific schemas. The maps are used to transform the domain specific message into a web service request message and vice versa.
Using the WCF Adapter Wizard
Once the Web Service is setup and running, right click on the BizTalk Project, select "Add" -> "Add Generated Items..." and select "Consume WCF Service". Follow the screen shots below...
- Select Metadata exchange point and select the web service end point.
- Specify the web service URL address to generate the WSDL.
- Finally specify the namespace and click finish to generate the schemas.
The following files would be generated by the WCF wizard:
EmployeeInfoServicePort.BindingInfo.xml - For transport type : WCF-BasicHttp
EmployeeInfoServicePort_Custom.BindingInfo.xml - For transport type : WCF-Custom
Open the file EmployeeInfoServicePort.BindingInfo.xml and note the 'Operation name' which is
RetrieveEmployeeInfo. This must match the Send Port operation name. Observe the screen shot below for more clarity:
NOTE: The orchestration (*.odx) file and the WCF-Custom binding which were auto-generated can be safely deleted.
Configure the Maps in the WCF Send Port
Once the orchestration has been coded and deployed, import the bindings file which has been auto generated. This would generate a WCF send port. Now specify the maps which convert the message from domain-specific into a web service request using the send port 'Filters and Maps' section. Observe the screen show below.
Common WCF Adapter - Error Condition
Consuming BizTalk WCF Service Adapter Wizard: Object reference not set to an instance of an object.
This happens when no target namespace is specified for a schema tag in the WSDL. Open the WSDL file, observe the tag
xsd:schema and add the attribute
- We have separated the web services schemas from the domain specific schemas. The orchestration has no knowledge of the web service schemas.
- Using the Send Port maps, the web service end point and the schemas can be changed without re-deploying/modifying/recoding/recompiling the orchestration.
- 4th March, 2009: Initial post
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)