Invoking a SOAP over HTTP Web Service Using Different Binding Styles

This sample shows the creation and invocation of a SOAP over HTTP web service. It demonstrates how to use two different binding styles, RPC and DOC Literal for the same service on two different endpoints.

Prerequisites

Note: To run the sample you can either use TIBCO ActiveMatrix BusinessWorks™ 6.x client or ActiveMatrix BusinessWorks™ 5.x as a client.

Procedure

Configure the Server

  1. In the samples directory, select binding > soap > http > MixedStyles and double-click tibco_bw_sample_binding_soap_http_mixedstylesprovider. For more information, see Accessing Samples.
  2. In Project Explorer, expand the tibco_bw_sample_binding_soap_http_mixedstylesprovider project.
  3. Set the default application profile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Fully expand the Processes directory and double-click Process.bwp.
  5. Click Run > Debug Configurations.
  6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  7. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the check box next to tibco_bw_sample_binding_soap_http_mixedstylesprovider.
  8. Click Debug.
    This executes the sample in Debug mode.

Configure the Client

  1. Unzip the TIBCO_HOME\bw\n.n\samples\bindings\soap\http\MixedStyles\bw5\tibco.bw.binding.soap.http.MixedStylesClient.zip file to a directory.
  2. Start TIBCO Designer and open the project unzipped in the directory.
    1. In TIBCO Designer, click Global Variables and verify the variables are set correctly.
    2. Click Tester and then click the green button. Select the check box next to the process and then click Load & Start Current.
    3. After the process completes, click the Stop Testing icon to stop the process
  3. In TIBCO Business Studio™ for BusinessWorks™, click the Terminate icon to stop the process.

Result

The Service has the following two different endpoint bindings:

  • The Document/Literal is the endpoint for ZipPortEndpoint1.
  • The RPC/Literal is the endpoint for ZipPortEndpoint2.

For the getCityInfoTest operation, you can view the information corresponding to the zip code that is defined in the zip field. Its default value is 60801. This should return information about Urbana, IL.

For the getCityDistanceTest operation, you can view the information corresponding to the distance between two zip codes. The default values are:
  • 60801: Urbana, IL
  • 61820: Champaign, IL

The console shows the following output:

15:24:51.971 INFO [bwThread:In-Memory STWorkProcessor-3] c.t.b.p.g.L.t.b.s.b.s.h.M.Log - Invoked cityinfo

15:24:51.992 INFO [bwThread:In-Memory STWorkProcessor-4] c.t.b.p.g.L.t.b.s.b.s.h.M.Log - getCityInfo-DOC:

city: Urbana

state: Illinois

location: Urbana, Illinois, United States

latitude: 40.11

longitude: 88.207

zip: 61801

15:24:53.857 INFO [bwThread:In-Memory STWorkProcessor-6] c.t.b.p.g.L.t.b.s.b.s.h.M.Log1 - Invoked cityDistance

15:24:53.865 INFO [bwThread:In-Memory STWorkProcessor-7] c.t.b.p.g.L.t.b.s.b.s.h.M.Log -getCityDistance-RPC: 4

Understanding the Configuration

At run-time for the first operation, the client sends a SOAP request comprising a zip code and receives a city information of that zip code. For the second operation, the client sends a SOAP request comprising two zip codes and returns the distance between the two cities defined by their zip codes.

The following shared resources are defined in the project:
  • HTTPConnectorResource.httpConnResource: The HTTP Connection Shared Resource containing the transport configuration.
  • CitySchema.xsd: The XSD Schema file containing the definition of the types used by the web service interface.
  • ZipInfo.wsdl: The WSDL file that describes the web service.