---
schema_version: "1"
id: 914ed50c0291ed9c48ad4ad80749efc541679acbf13f6cf878b03a1f94630be2
title: Web Service Consumer Additional Configuration Information
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/web-service-consumer-connector/latest/web-service-consumer-config-topics.md
canonical_url: https://docs.mulesoft.com/web-service-consumer-connector/latest/web-service-consumer-config-topics
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c0ae26c1d20d3257228da06c2e72d0621ece52bfc6177031791d20d40097987d
description: MuleSoft Documentation Site
release: "2.2"
latest: true
---
---
product: Web Service Consumer Connector
version: 2.2
is-latest-version: true
---

# Web Service Consumer Additional Configuration Information

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

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` only if you
    previously created the HTTP Request configuration.

3.  Click **OK**

In Studio, configuring custom HTTP transport looks like this:

![Configure Custom HTTP Transport](/mulesoft/current/en-us/web-service-consumer-connector/latest/_images/web-service-consumer-configure-transport.png)

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

```xml
<http:request-config name="HTTP_Request_configuration">
    <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>
```

### Handling SOAP Faults with Custom HTTP Configurations

When using a custom HTTP Request configuration as your transport, the HTTP requester’s default
behavior is to treat status codes like `500 Internal Server Error` as failures. Because many SOAP
services return `SOAP Faults` with a 500 status code, the custom transport may throw an
`HTTP:INTERNAL_SERVER_ERROR` before the Web Service Consumer Connector can parse the SOAP body.

To ensure that the Web Service Consumer Connector correctly receives and processes the SOAP Fault,
you must configure the **Response validator** in your HTTP Request configuration to accept a broader
range of status codes, typically `100..500`.

The following example illustrates how to capture the SOAP Fault when Web Service Consumer Connector
uses custom HTTP Requester configuration:

1.  In the **HTTP Request configuration** window, navigate to the **Settings** tab.

2.  In the **Response options** section, set the **Response validator** field to
    `Success status code validator`.

3.  In the **Values** field, enter `100..500`.

In Studio, configuring the response validator for custom HTTP transport looks like this:

![Configure HTTP Response Validator](/mulesoft/current/en-us/web-service-consumer-connector/latest/_images/web-service-consumer-configure-response-validator.png)

In the **Configuration XML** tab, the configuration looks like this:

```xml
<http:request-config name="HTTP_Request_configuration">
 <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:response-validator>
     <http:success-status-code-validator
       values="100..500" />
 </http:response-validator>
</http:request-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](/mulesoft/current/en-us/web-service-consumer-connector/latest/_images/web-service-consumer-configure-wsecurity.png)

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

```xml
<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>
```

## Configure WSC:EMPTY\_RESPONSE Error

When mandatory fields are missing from the response (Illegal Empty Response), you can configure the
**Error Handler** component to throw the `WSC:EMPTY_RESPONSE` error for the Web Service Consumer
Connector.

1.  In Studio, select the **On Error Continue** component of the Error handling section.

2.  Set **Type** to **WSC:EMPTY\_RESPONSE**.

![WSC:EMPTY\_RESPONSE selected for Type field](/mulesoft/current/en-us/web-service-consumer-connector/latest/_images/web-service-consumer-emptyresponse.png)

In the **Configuration XML** tab, the configuration looks like this:

```xml
<flow name="WSC-Example">
  <scheduler>
    <scheduling-strategy >
      <fixed-frequency />
    </scheduling-strategy>
  </scheduler>
  <set-variable value="test" variableName="variableSample"/>
  <ee:transform>
    <ee:message >
      <ee:set-payload ><![CDATA[ %dw 2.0
output application/xml
ns con http://service.soap.service.mule.org/
---
con#attachOperation: {
    text: vars.variableSample
}]]></ee:set-payload>
    </ee:message>
  </ee:transform>
  <wsc:consume config-ref="Web_Service_Consumer_Config" operation="attachOperation">
    <wsc:message-customizations forceXMLProlog="true"/>
  </wsc:consume>
    <error-handler >
      <on-error-continue enableNotifications="true" logException="true" type="WSC:EMPTY_RESPONSE">
      <logger level="INFO" message="The response was empty." />
      </on-error-continue>
    </error-handler>
</flow>
```

## Read Attributes in a Failure Scenario

The following example shows how to configure the Web Service Consumer Connector to read SOAP
attributes or additional transport data attributes in a failure scenario.

1.  In Studio, drag a **Scheduler** source to your flow.

2.  Drag a **Set variable** component alongside the **Scheduler** source.

3.  Set **Name** to `variableSample` and **Value** to `test`.

4.  Drag a **Transform Message** component alongside the **Set Variable** component.

5.  In the Datasense output view, add the following DataWeave expression:

```dataweave
 %dw 2.0
output application/xml
ns con http://service.soap.service.mule.org/
---
con#attachOperation: {
    text: vars.variableSample
}
```

6.  Drag the Web Service Consumer Connector **Consume** operation alongside the **Transform
    Message** component.

7.  Set a **Connector configuration** for the connector.

8.  Set **Operation** to `attachOperation`.

9.  Drag an **On Error Continue** component to the Error handling section of your flow.

10. Set **Type** to `WSC:BAD_RESPONSE`.

11. Drag a **Logger** component into the **On Error Continue** component.

12. Set **Message** to the expression `#[error.additionalData.statusCode]` to read SOAP attributes
    or additional transport data.

In the **Configuration XML** tab, the configuration looks like this:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:wsc="http://www.mulesoft.org/schema/mule/wsc" xmlns:compression="http://www.mulesoft.org/schema/mule/compression"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/compression http://www.mulesoft.org/schema/mule/compression/current/mule-compression.xsd
http://www.mulesoft.org/schema/mule/wsc http://www.mulesoft.org/schema/mule/wsc/current/mule-wsc.xsd">
	<flow name="WSC-Example">
  <scheduler>
    <scheduling-strategy >
      <fixed-frequency />
    </scheduling-strategy>
  </scheduler>
  <set-variable value="test" variableName="variableSample"/>
  <ee:transform>
    <ee:message >
      <ee:set-payload ><![CDATA[ %dw 2.0
output application/xml
ns con http://service.soap.service.mule.org/
---
con#attachOperation: {
    text: vars.variableSample
}]]></ee:set-payload>
    </ee:message>
  </ee:transform>
  <wsc:consume config-ref="Web_Service_Consumer_Config" operation="attachOperation">
    <wsc:message-customizations forceXMLProlog="true"/>
  </wsc:consume>
    <error-handler >
      <on-error-continue enableNotifications="true" logException="true" type="WSC:BAD_RESPONSE">
      <logger level="INFO" message="#[error.additionalData.statusCode]" />
      </on-error-continue>
    </error-handler>
</flow>
	</flow>
</mule>
```

## See Also

- [Salesforce Help](https://help.salesforce.com)

- [Web Service Consumer Connector Reference](https://docs.mulesoft.com/web-service-consumer-connector/latest/web-service-consumer-reference)
