Logo
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
World Cup news
 
 
Windows Server

WCF and BizTalk 2009 (part 2) - Publishing Your WCF Service from the Command Line & Consuming WCF Services

6/30/2011 3:28:02 PM

12.1.3. Publishing Your WCF Service from the Command Line

The BizTalk WCF Service Publishing Wizard is convenient to use when deploying an endpoint within your development environment. For more advanced users or when automating your deployment, there is an additional downloadable command-line tool from Microsoft called the BtsWcfServicePublishing[] tool.

[] Download the BTSWCFServicePublishing tool from http://go.microsoft.com/fwlink/?LinkId=92955.

The tool has the following syntax:

BtsWcfServicePublishing PathName [-AdapterName:value] [-EnableMetadata]
[-ReceiveLocation] [-ApplicationName:value] [-MetadataOnly]
[-MetadataReceiveLocationName:value] [-MergePorts]
[-TargetNamespace:value]
[-Location:value] [-Overwrite] [-Anonymous]

This is a basic sample invocation of this tool:

BtsWcfServicePublishing.exe "MyAssembly.dll" 

-Location:http://localhost/MyVdir -Overwrite

This sample publishes the orchestration in MyAssembly.dll to http://localhost/MyVdir with the default values and overwrites any existing service at this location.

Of course, the default values are not very friendly; therefore, the tool supports many parameters to customize the output. Table 3 lists these parameters.

Table 3. Command-Line Parameters for the BtsWcfServicePublishing Tool
ParameterRequiredDescription
PathNameYesPath and file name of BizTalk assembly (*.dll) or WCF service description (*.xml) file.
-AdapterNameNoPublishes a service endpoint. Specify which adapter will be used: WCF-BasicHttp, WCF-WSHttp, or WCF-CustomIsolated. This field is valid when publishing a service endpoint. The default is WCF-WSHttp.
-EnableMetadataNoEnables metadata endpoint in addition to service endpoint. This field is valid when publishing a service endpoint. The default is False.
-ReceiveLocationNoCreates receive locations in the specified BizTalk application. This field is valid when publishing a service endpoint with the BizTalk application name specified. The default is False.
-ApplicationNameNoName of the BizTalk application in which to create receive locations. This field is valid when publishing a service endpoint with the receive location specified. The default is BizTalk Application 1.
-MetadataOnlyNoPublishes a metadata-only endpoint. This field is valid when publishing a service endpoint. The default is False.
-MetadataReceiveLocationNameNoName of WCF-adapter receive location to expose at metadata-only endpoint. You can further edit it in Web.config after publishing. This field is valid when publishing a metadata endpoint. The default is Null.
-MergePortsNoMerges all ports into a single WCF service if possible. The default is False.
-TargetNamespaceNoTarget namespace of WCF service. The default is http://tempuri.org.
-LocationNoLocation in which to publish. For example, http://host[:port]/path. This is automatically generated based on the project name.
-OverwriteNoOverwrites (deletes contents of) specified location. The default is False.
-AnonymousNoAllows anonymous access to WCF service. The default is False.

4. Consuming WCF Services

Just as there is a wizard to help you publish a WCF service, there is also a BizTalk WCF Service Consuming Wizard. You can launch this wizard from within the orchestration designer; it creates port types and message types necessary for consuming WCF services. The wizard also creates two binding files that can be imported by the development command-line tool or wizard to configure the send ports with the system-provided binding WCF adapters and the WCF-Custom adapter.

To add schemas and types for WCF services to your orchestration, follow the steps described in the following subsections.

4.1. Step 1: Start the Biztalk WCF Consuming Wizard

In the Solution Explorer, right-click your project, click Add, and select Add Generated Items. In the Add Generated Items dialog box, select Consume WCF Service, and click Add to launch the wizard.

4.2. Step 2: Import Metadata

Click Next on the welcome screen to display the Metadata Source screen, as shown in Figure 5.

Figure 5. Selecting a metadata source

The easier option is to use a MEX endpoint, which will dynamically download the WSDL and supporting XSDs. If you have previously downloaded or been provided with these files, then choose the Metadata Files option. Leave the default option, and click Next.

4.3. Step 3: Supply a Metadata URL

On the Metadata Endpoint screen, enter the URI to the metadata endpoint you want to include, and click Next.

The metadata endpoint doesn't have to be over HTTP or HTTPS. The wizard also supports net.tcp and net.pipe URIs.


4.4. Step 4: Complete the Wizard

After the WSDL has been downloaded, click Next to complete the wizard. The necessary port types and message types will be created and ready to use within your orchestration. Simply bind your message types to an orchestration port and connect to shapes.

5. Specifying Dynamic Port Properties

As with other adapters, the WCF adapters support dynamic send ports. These are useful for customizing parameters of WCF calls with runtime values that may be passed with incoming messages or as a result of a business rule.

The following code demonstrates how to modify the transport security option of a WCF-NetTcp adapter:

MessageOut=MessageIn;
MessageOut(WCF.Action)="http://tempuri.org/IReceiveMessage/ReceiveMessage";
MessageOut(WCF.SecurityMode)="Transport";
MessageOut(WCF.TransportClientCredentialType)="Windows";
DynamicSendPort(Microsoft.XLANGs.BaseTypes.Address)=

"net.tcp://localhost:8001/netTcp";
DynamicSendPort(Microsoft.XLANGs.BaseTypes.TransportType)="WCF-NetTcp";

Using the WCF context object, all properties of the WCF adapter can be dynamically changed if necessary to meet your requirements. The previous example tells the adapter to implement transport-level security leveraging the Windows identity as its credential token. The code also overrides the WCF endpoint address and sets the transport type to the WCFNetTcp adapter.

Top Search -----------------
- Windows Server 2008 R2 : Work with RAID Volumes - Understand RAID Levels & Implement RAID
- Windows Server 2008 R2 Administration : Managing Printers with the Print Management Console
- Configuring Email Settings in Windows Small Business Server 2011
- Windows Server 2008 R2 : Configuring Folder Security, Access, and Replication - Implement Permissions
- Monitoring Exchange Server 2010 : Monitoring Mail Flow
- Windows Server 2008 R2 :Task Scheduler
- Windows Server 2008 R2 : File Server Resource Manager
- Windows Server 2008 R2 : Installing DFS
- Exchange Server 2010 : Managing Anti-Spam and Antivirus Countermeasures
- Windows Server 2008 R2 : Configuring Folder Security, Access, and Replication - Share Folders
Other -----------------
- WCF and BizTalk 2009 (part 1) - Exploring the Built-in WCF Adapter Transport Support & Using the WCF Service Publishing Wizard
- SQL Server 2008 : Working with Synonyms
- SQL Server 2008 : Working with Views -Partitioned Views, Updateable Views & Indexed Views
- SQL Server 2008 : Post-Installation - Preproduction Tasks
- Microsoft PowerPoint 2010 : Expanding PowerPoint Functionality - Simplifying Tasks with Macros
- Microsoft PowerPoint 2010 : Enhancing a Presentation with VBA & Setting Developer Options
- Windows Server 2008 R2 : Manage Disk Storage - Manage Disk Storage Quotas
- Windows Server 2008 R2 : Work with RAID Volumes - Understand RAID Levels & Implement RAID
- Exchange Server 2010 : Perform Essential Public Folder Management (part 3) - Configure Client Connectivity
- Exchange Server 2010 : Perform Essential Public Folder Management (part 2) - Define Public Folder Permissions
 
 
Most view of day
- Windows Small Business Server 2011 : Disaster Planning - Planning for Disaster
- Microsoft Project 2010 : Setting Up a Project Budget - Reducing Project Costs
- Windows Server 2003 on HP ProLiant Servers : File and Print Services, Selection of ProLiant Servers for the Enterprise
- Connecting Dynamics GP to Microsoft Office 2010 : Skipping the exports by using Prebuilt Excel Reports
- Customizing OneNote 2010 : Customizing the Ribbon (part 1)
- Communicating with Internet Email : Sending Messages (part 2) - Setting Send Options, Maintaining Outlook Express
- Reporting in Dynamics AX 2009 : Ad Hoc Reporting
Top 10
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 3) - Translating Text with the Mini Translator
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 2) - Translating a Word or Phrase with the Research Pane
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 1) - Setting Options for the Research Task Pane, Searching with the Research Task Pane
- Microsoft OneNote 2010 : Doing Research with Linked Notes (part 2) - Ending a Linked Notes Session, Viewing Linked Notes
- Microsoft OneNote 2010 : Doing Research with Linked Notes (part 1) - Beginning a Linked Notes Session
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 3) - Moving Side Notes to Your Existing Notes
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 2) - Reviewing Side Notes
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 1) - Creating Side Notes
- Games and Windows 7 : Installing and Playing Third-Party Games
- Games and Windows 7 : Using the Games Explorer (part 4) - Managing Your Game Controllers and Other Game-Related Hardware
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
Cars Review