Contact Us 1-800-596-4880

Web Service Consumer Additional Configuration Information - Mule 4

Set additional configuration for Anypoint Connector for Web Service Consumer (Web Service Consumer Connector), such as custom HTTP Transport and Web Service Security both in Anypoint Studio and in the XML editor.

Configure Custom HTTP Transport

By default, the connector uses a simple unprotected HTTP configuration to dispatch all outgoing SOAP messages. For cases where a more advanced HTTP configuration is required, you can parameterize the Web Service Consumer Connector with an HTTP Connector configuration to dispatch the messages.

The following example illustrates how you might declare and reference an HTTP Requester configuration with HTTP Basic authentication in the Transport Configuration parameter of the Web Service Consumer Connector configuration to ensure that the connector dispatches each request:

  1. In Studio, open the Global Element Properties window of the Web Service Consumer Connector.

  2. On the Transport tab, for Transport Configuration, select HTTP Transport Configuration.
    The Requester Config field automatically populates HTTP_Request_configuration.

  3. Click OK

In Studio, configuring custom HTTP transport looks like this:

Configure Custom HTTP Transport
Figure 1. Configure Custom HTTP Transport

In the Configuration XML tab, the reference of the HTTP Requester configuration <http:request-config name="basic-auth"> is under the Web Service Consumer configuration <wsc:custom-transport-configuration>:

<http:request-config name="basic-auth">
    <http:request-connection host="www.exampleplace.com" port="8182" protocol="HTTP">
        <http:authentication>
            <http:basic-authentication username="admin" password="textpassword"/>
        </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>

Configure Web Service Security

The WS-Security protocol enables you to use various security token formats to enforce message integrity and confidentiality. This protocol uses XML Signature and XML Encryption to provide end-to-end security.

WS-Security describes how to:

  • Sign SOAP messages to ensure integrity and provide nonrepudiation

  • Encrypt SOAP messages to ensure confidentiality

  • Attach security tokens to ascertain the sender’s identity

Web Service Consumer Connector supports the following mechanisms:

  • Timestamp

  • Signature or signature verification

  • Username

  • Encryption or decryption

The following example illustrates how you might configure a username token security strategy as web service security for the connector:

  1. In Studio, open the Global Element Properties window of the Web Service Consumer Connector.

  2. On the Security tab, for Username token security strategy, select Edit inline.

  3. Complete the Username, and Password fields, and set Add nonce and Add created fields to true.

  4. Click OK.

In Studio, configuring web service security looks like this:

Configure Web Service Security
Figure 2. Configure Web Service Security

In the Configuration XML tab, configuring Web Service Security looks like this:

<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>
View on GitHub