ExposeWebService (BizTalk Server Sample)

The ExposeWebService sample demonstrates how to expose a BizTalk Server orchestration as a Web service. A sample ASP.NET application is provided to submit static data to the exposed orchestration.

The sample ASP.NET application that you use to interact with the Web service constructs an object based on the Web reference to the orchestration. It populates the fields in this object and submits the Web service request. The orchestration applies a simple transform to the submitted data and returns a corresponding object in the response. BizTalk selects a single field (zip code) from the response object and displays it to the user.

Note  For important information about all samples in this SDK, see Samples.

To download the updated BizTalk Server 2004 SDK, go to http://go.microsoft.com/fwlink/?LinkId=24723.

Location in SDK

<Samples Path>\Orchestrations\ExposeWebService\

File Inventory

The following table shows the files in this sample and describes their purpose.

File(s)Description
Cleanup.batUsed to undeploy assemblies and remove them from the global assembly cache (GAC). Removes send and receive ports. Removes Microsoft Internet Information Services (IIS) virtual directories as needed.
ClientRequest.xsd, CompanyRequest.xsdSchemas for the XML messages exchanged with the BizTalk Server orchestration Web service.
ClientToCompanyRequest.btmBizTalk Server map for transforming the XML messages exchanged with the BizTalk Server orchestration Web service.
ExposeWebService.btproj, ExposeWebService.slnProject and solution files for the BizTalk Server orchestration Web service.
ExposeWebServiceBinding.xmlUsed for automated setup such as port binding.
ProcessClientRequest.odxBizTalk Server orchestration that BizTalk exposes as a Web service. This orchestration receives a request message from the ASP.NET application, uses the map to transform it, and then returns the response to the ASP.NET application.
Setup.batUsed to build and initialize this sample.
In the \ExposeWebServiceDriver folder:

AssemblyInfo.cs, default.aspx, default.aspx.cs, default.aspx.resx, ExposeWebServiceDriver.csproj, ExposeWebServiceDriver.csproj.webinfo, ExposeWebServiceDriver.sln, Global.asax, Global.asax.cs, Global.asax.resx, Web.config

Project and solution files, source files, and various website infrastructure files used for the ASP.NET application that interacts with the BizTalk Server orchestration Web service.
In the \ExposeWebServiceDriver\Web References\localhost folder:

Microsoft_Samples_BizTalk_ExposeWebService_ProcessClientRequest_SOAPPort.disco, Microsoft_Samples_BizTalk_ExposeWebService_ProcessClientRequest_SOAPPort.wsdl, Reference.cs, Reference.map

Infrastructure files for the BizTalk Server orchestration Web service.

To Build and Initialize This Sample

Use the following procedure to build and initialize the ExposeWebService sample.

  1. In a command window, navigate to the following folder:

    <Samples Path>\Orchestrations\ExposeWebService

  2. Run the file Setup.bat, which performs the following actions:
    • Compiles and configures the ASP.NET application used to interact with this sample.
    • Compiles and deploys the BizTalk Server orchestration Web service.
    • Creates and binds the necessary BizTalk Server ports.

      Note  This sample displays the following warnings when creating and binding the ports:

      Warning: Receive handler not specified for receive location "ExposeWebServiceLocation"; updating with first receive handler with matching transport type.
      Warning: Host not specified for orchestration "ExposeWebService.ProcessClientRequest"; updating with first available host.
      You can safely ignore these warnings. (To accommodate for possible naming differences in user installations, the host name and receive handler have been omitted from the binding file. The utility Btsdeploy.exe uses the first receive handler that supports the adapter type and the default host.)
    • Starts the BizTalk Server orchestration.

    Note  You should confirm that BizTalk did not report any errors during the build and initialization process before attempting to run this sample.

    Note  If you choose to open and build the projects in this sample without running the file Setup.bat, you must first create a strong name key pair using the .NET Framework Strong Name utility (sn.exe). Use this key pair to sign the resulting assemblies.

    Note  To undo changes made by Setup.bat, run Cleanup.bat. You must run Cleanup.bat before running Setup.bat a second time.

To publish the ExposeWebService sample

  1. Click Start, point to Programs, point to Microsoft BizTalk Server 2004, and then click BizTalk Web Services Publishing Wizard.
  2. When prompted, select Publish BizTalk Orchestration as Web services.
  3. In the Open File dialog box, select the following DLL:

    <SamplesPath>\Orchestrations\ExposeWebService\bin\Development\
    ExposeWebService.dll

  4. Accept the defaults in the subsequent wizard pages, making sure to check the Allow anonymous access to Web service check box on the Web Service Project page.

    Important  You must ensure that your development environment is configured and enabled to work with BizTalk Web services. Additional information and the instructions for completing this step will be provided in the updated BizTalk Server 2004 Help available at http://go.microsoft.com/fwlink/?linkid=20616. For more information, see Enabling Web Services.

    Note  To ensure the published orchestration and the driver program have the correct references, you should update the ExposeWebServiceDriver Web references as follows:

    1. Navigate to <Samples Path>\Orchestrations\ExposeWebService\
      ExposeWebServiceDriver\.
    2. Open ExposeWebServiceDriver.sln in Visual Studio .NET 2003.
    3. In the Solution Explorer, expand ExposeWebServiceDriver, and then expand Web References.
    4. Right-click localhost, and then click Update Web Reference.
    5. In Solution Explorer, right-click ExposeWebServiceDriver, and then click Rebuild.
    6. After the build succeeds, close the solution.

To Run This Sample

Use the following procedure to run the ExposeWebService sample.

  1. Click Start, and then click Run. Enter inetmgr, and then click OK.
  2. In Internet Information Services (IIS) Manager, expand the node for your server, expand Web Sites, and then expand Default Web Sites. Right-click ExposeWebServiceDriver, click Properties, and then click the Documents tab.
  3. In the ExposeWebServiceDriver Properties dialog box, verify that Enable default content page is selected. If not, select Enable default content page, and then click OK.
  4. In Internet Explorer, browse to the URL http://localhost/ExposeWebServiceDriver/

This submits data to the BizTalk Server orchestration Web service and displays the ZIP code field extracted from the response. The expected output is 98052.

Note  If you are having trouble running this sample, remember to check the Event Viewer to help determine the source of the problem.

Remarks

This sample serves as a prototype showing how to interact with BizTalk Server orchestrations that are exposed as Web services. You can expose your business processes as Web services to interact with line-of-business (LOB) and third-party applications that also conform to Web service (SOAP) standards.

See Also

Orchestrations (BizTalk Server Samples Folder)

To download updated BizTalk Server 2004 Help from www.microsoft.com, go to http://go.microsoft.com/fwlink/?linkid=20616.

Copyright © 2004 Microsoft Corporation.
All rights reserved.
Show: