Contact Free trial Login

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 Connector has a single configuration. The most important configuration parameters are the WSDL Location, the Service, and the Port. The configuration will not be valid if any of these parameters 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, which 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:

<wsc:config name="wsc">
  <wsc:connection
   wsdlLocation="http://ilt.mulesoft-training.com/essentials/delta?wsdl"
   service="TicketServiceService"
   port="TicketServicePort"/>
</wsc:config>

The configuration above does not contain the address parameter because the service and port pair declares a valid address. The WSDL in the example is to get a list of flights by airline.

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 Connector can be parameterized with an HTTP connector configuration to use to dispatch the messages.

Take a look at the following example:

Custom Transport Web Service Consumer Configuration
<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 Web Service Consumer Connector configuration. Now the Web Service Consumer Connector will dispatch each one of the requests using the advanced configuration that is provided.

The Web Service Consumer Connector configuration also supports WS-Security strategies. See the link to the Technical Reference below for more information.

Setting Web Service Security

The WS-Security 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 Connector supports the following mechanisms:

  • Timestamp

  • Signature/Signature Verification

  • Username

  • Encryption/Decryption

Example of a configuration with username WSS strategy:

<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 the Web Service Consumer Technical Reference to know how to configure each WSS strategy and see the description of each parameter associated to it.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.