다음을 통해 공유


Consume WCF Service Wizard generates port binding configuration files for import into BizTalk Server

Scenario: You have already designed, implemented and hosted a WCF Service. Now, you would like to send (and get) messages to this WCF Service in a BizTalk Orchestration process. BizTalk communicates with WCF applications via BizTalk WCF Adapter, which can be configured through send and receive ports in BizTalk. This post talks about how BizTalk’s Consume WCF Wizard can be used to simplify the port creation process in BizTalk, especially the need of mapping the operation(s) with the SOAP Action(s) within the port to invoke the operation in WCF Service.

Microsoft BizTalk Server 2006 R2 now includes a BizTalk WCF Adapter to provide support for WS-* and transport neutrality by letting the user choose most appropriate Windows Communication Foundation (WCF) binding in BizTalk Port configuration. The BizTalk WCF Adapter can be selected within a Send Port by creating a new port and then selecting a Transport Type. In Receive Port, the BizTalk WCF Adapter can be selected by creating a new Receive Location and then selecting Transport Type from the drop-down box. The Receive Location allows for hosting a non-HTTP WCF Service within BTSNtSvc.exe and can be enabled within the BizTalk Administration Console without need for publishing.

Even though WCF-Custom is the only adapter needed, BizTalk allows other WCF adapters for most common messaging scenarios, as shown in the table below. For example, WCF-Custom can be used as WCF-WSHttp transport by selecting WCF-Custom, clicking on Configure, select Binding tab and selecting the Binding Type wsHttpBinding or customize this transport by using wsDualHttpBinding or wsFederationHttpBinding.

Available Send Port

WCF Adapters

Available Receive Port

WCF Adapters

One-way

WCF-BasicHttp

WCF-Custom

WCF-NetMsmq

WCF-NetNamedPipe

WCF-NetTcp

WCF-WSHttp

WCF-BasicHttp

WCF-Custom

WCF-CustomIsolated

WCF-NetMsmq

WCF-NetNamedPipe

WCF-NetTcp

WCF-WSHttp

 

Two-way

WCF-BasicHttp

WCF-Custom

WCF-NetNamedPipe

WCF-NetTcp

WCF-WSHttp

WCF-BasicHttp

WCF-Custom

WCF-CustomIsolated

WCF-NetNamedPipe

WCF-NetTcp

WCF-WSHttp

Note: Adapters built using WCF LOB Adapter SDK are consumed within BizTalk using WCF-Custom BizTalk WCF Adapter. Once the adapter is configured, it shows up in the Binding Type drop-down box and can be selected like any other predefined WCF binding.

The following section shows, at a very high level, how a BizTalk WCF Adapter is used within a typical BizTalk programming lifecycle.

· Design-Time Experience

o Create a Visual Studio BizTalk Project

 

o Use Consume WCF Service Wizard (Right Click > Add > Add Generated Items > Consume WCF Service) to download metadata from a running service using MEX endpoint or import metadata using WSDL.

§ Following files are generated as an outcome of running this wizard.

 

Metadata

XML Schema Files

Orchestration

BizTalk Orchestration (.odx) file

Port Binding Information Configuration

{ServiceName}_Custom.BindingInfo.xml – Contains port configuration using WCF Custom Adapter

 

{ServiceName}.BindingInfo.xml – Contains port configuration using other WCF bindings as obtained from the MEX endpoint

 

These configuration files can be imported in

 

§ MEX endpoints only with these transport types are supported

o http, https, net.pipe, net.tcp

o Implies users CANNOT use this wizard to import metadata from MEX enabled services that use a custom transport channel. WCF users can publish and retrieve metadata over a custom binding, which may include transports (and schemes) other than the ones defined above.

 

§ Port Binding Information Configuration Contains operation to action mapping strings

· <BtsActionMapping> <Operation Name=”Operation1” Action=”Action1”/> </BtsActionMapping>

 

o Build the BizTalk Project

 

· Deployment-Time Experience

 

o Deploy the BizTalk Project

 

o Import the Port Binding Information XML file to auto-generate the ports in BizTalk Server 2006 Administration Console

§ Right click on Applications within BizTalk Group, select Import > Bindings and then navigate to the Visual Studio BizTalk project folder

§ Select the Port Binding Information XML file

o

 Enlist and start the orchestration (and all its dependencies)  

 

· Execution-Time Experience

 

o Trigger the orchestration depending on your scenario – e.g. dropping a file in the file drop for receive location to pick it up

See the attached document for screen shots of Consume WCF Service Wizard.