Click here to Skip to main content
Click here to Skip to main content

Invoking a Web Service without using a Proxy by using WCF Adapter in BizTalk Server 2006 R2

, 4 Mar 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
Invoking a Web Service without using a Proxy by using WCF adapter in BizTalk Server 2006 R2

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:

WCF_Adapters.JPG

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:

WCF_SolutionExplorer.JPG

  • 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.

    WCF_main_1.JPG

  • Specify the web service URL address to generate the WSDL.

    WCF_main_2.JPG

  • Finally specify the namespace and click finish to generate the schemas.

    WCF_main_3.JPG

The following files would be generated by the WCF wizard:

EmployeeInfoServicePort.BindingInfo.xml - For transport type : WCF-BasicHttp
EmployeeInfoServicePort.odx
EmployeeInfoServicePort_Custom.BindingInfo.xml - For transport type : WCF-Custom
EmployeeInfoServicePort_org_naveen_employee.xsd

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:

WCF_SendPortName.JPG

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.

WCF_Req_res_Maps.JPG

Common WCF Adapter - Error Condition

WCF_Adapter_Error.JPG

Consuming BizTalk WCF Service Adapter Wizard: Object reference not set to an instance of an object.

Resolution

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 targetNamespace.

 <xsd:schema targetNamespace="http://com.naveen.employee"> 
 ...
 </xsd:schema>

Takeaways

  • 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.

History

  • 4th March, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Naveen Karamchetti
Architect AT&T Wi-Fi Services
United States United States
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)
http://biztalkcontrolcenter.codeplex.com

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 4 Mar 2009
Article Copyright 2009 by Naveen Karamchetti
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid