Nav

To Configure the Web Service Consumer

To consume a SOAP Web Service operation, you need to create a configuration that points to the service that you want to consume.

The Web Service Consumer (WSC) connector has a single configuration. The most important configuration parameters are the the WSDL Location (wdslLocation), the Service (service), and the Port (port). The configuration will not be valid if any of them are not set.

The WSDL Location is the path or URL where the WSDL is located (local or remote), and the Service and Port are the parameters that specify which SOAP operations can be executed using the configuration.

Another important parameter is Service Address (address), where indicates where the requests are dispatched. This parameter is usually auto-populated when the Service and Port are specified, but sometimes the Service-Port pair does not indicate an address, and you need to provide the correct one.

Here is a simple configuration example:

Simple Web Service Consumer Configuration

         
      
1
2
3
4
5
6
<wsc:config name="wsc">
  <wsc:connection
   wsdlLocation="http://www.webservicex.com/globalweather.asmx?WSDL"
   service="GlobalWeather"
   port="GlobalWeatherSoap"/>
</wsc:config>

Note that the configuration above does not contains the address parameter because the service and port pair declares a valid address. The WSDL in the example is for the Global Weather service, a public service.

Setting a Custom HTTP Transport Configuration

By default, the connector uses a simple, non-protected HTTP configuration to dispatch all outgoing SOAP messages. For cases where a more advanced HTTP configuration is required, the Web Service Consumer can be parameterized with an HTTP connector configuration that will be used to dispatch the messages. Take a look at the following example:

Custom Transport Web Service Consumer Configuration

         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<http:request-config name="basic-auth">
    <http:request-connection host="www.someplace.com" port="8182" protocol="HTTP">
        <http:authentication>
            <http:basic-authentication username="alejandro.garcia" password="nariz"/>
        </http:authentication>
    </http:request-connection>
</http:request-config>

<wsc:config name="with-custom-transport">
    <wsc:connection wsdlLocation="http://www.host.com?WSDL" service="Service" port="Port">
        <wsc:custom-transport-configuration>
            <wsc:http-transport-configuration requesterConfig="basic-auth"/>
        </wsc:custom-transport-configuration>
    </wsc:connection>
</wsc:config>

In the example, an HTTP Requester configuration with HTTP basic authentication is declared and then referenced in the custom-transport-configuration element in the WSC configuration. Now the WSC will dispatch each one of the requests using the advanced configuration that is provided.

Note that the Web Service Consumer configuration also supports WSS security strategies. See the link to the Technical Reference below for more information.

Setting Web Service Security

The WS-Security (WSS) protocol specifies how integrity and confidentiality can be enforced on messages and allows the communication of various security token formats. Its main focus is the use of XML Signature and XML Encryption to provide end-to-end security.

WS-Security describes three main mechanisms:

  • How to sign SOAP messages to assure integrity. Signed messages also provide nonrepudiation.

  • How to encrypt SOAP messages to assure confidentiality.

  • How to attach security tokens to ascertain the sender’s identity.

The Web Service consumer supports the following mechanisms:

  • Timestamp

  • Signature/Signature Verification

  • Username

  • Encryption/Decryption

Example of a configuration with username WSS stategy:


         
      
1
2
3
4
5
6
7
<wsc:config name="with-custom-transport">
    <wsc:connection wsdlLocation="http://www.host.com?WSDL" service="Service" port="Port">
        <wsc:web-service-security>
            <wsc:username-token-security-strategy username="admin" password="textPassword" addCreated="true" addNonce="true"/>
        </wsc:web-service-security>
    </wsc:connection>
</wsc:config>

See: Web Service Consumer Technical Reference to know how to configure each WSS strategy and see the description of each parameter associated to it.