Skip to content

Commit

Permalink
Merge pull request #2566 from mulesoft/W-15639219-wsc-1.9-kt
Browse files Browse the repository at this point in the history
W-15639219-wsc-1.9-kt
  • Loading branch information
sathya0 authored May 3, 2024
2 parents a00f084 + c1041c9 commit 60ce81e
Show file tree
Hide file tree
Showing 69 changed files with 1,555 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web-service-consumer/1.8/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Web Service Consumer Connector 1.8 - Mule 4
:page-aliases: connectors::web-service/web-service-consumer.adoc


Anypoint Connector for Web Service Consumer (Web Service Consumer Connector) consumes a SOAP web service from a Mule app to acquire data from an external source. In many cases, you can use Anypoint Connector for Workday (Workday Connector) or Anypoint Connector for ServiceNow (ServiceNow Connector) to connect to a service provider, however, when no connector is available for a specific web service, the easiest way to consume the service is to use the Web Service Consumer Connector.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Web Service Consumer Additional Configuration Information - Mule 4
:page-aliases: connectors::web-service/web-service-consumer-configure.adoc


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.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
= Web Service Consumer Connector Reference - Mule 4
:page-aliases: connectors::web-service/web-service-consumer-reference.adoc



Web Service Consumer Connector Version 1.7

Web Service Consumer Connector Version 1.8

Anypoint Connector for Web Service Consumer (Web Service Consumer Connector) consumes a SOAP Web service
to acquire data from an external source.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Using Anypoint Studio to Configure Web Service Consumer 1.8 - Mule 4
:page-aliases: connectors::web-service/web-service-consumer-consume.adoc


Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files.

Expand Down
15 changes: 15 additions & 0 deletions web-service-consumer/1.9/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: web-service-consumer-connector
version: '1.9'
display_version: 1.9 (Mule 4)
title: Web Service Consumer Connector
nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
page-component-desc: Consumes a SOAP Web service to acquire data from an external source.
page-connector-type: Connector
page-connector-level: Select
page-exchange-group-id: org.mule.connectors
page-exchange-asset-id: mule-wsc-connector
page-runtime-version: 4.1.1
page-release-notes-page: release-notes::connector/connector-wsc.adoc
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions web-service-consumer/1.9/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.xref:index.adoc[Web Service Consumer Connector]
* xref:index.adoc[Web Service Consumer Connector Overview]
* xref:web-service-consumer-reference.adoc[Web Service Consumer Connector Reference]
* xref:web-service-consumer-studio.adoc[Web Service Consumer Connector Studio Configuration]
* xref:web-service-consumer-config-topics.adoc[Web Service Consumer Connector Additional Configuration Information]
* xref:web-service-consumer-examples.adoc[Web Service Consumer Connector Examples]
* xref:web-service-consumer-examples.adoc[Web Service Consumer Connector Examples]
** xref:web-service-example-1.adoc[Web Service Consumer Connector Example 1]
** xref:web-service-example-2.adoc[Web Service Consumer Connector Example 2]
* xref:web-service-consumer-troubleshooting.adoc[Troubleshooting Web Service Consumer Connector]
45 changes: 45 additions & 0 deletions web-service-consumer/1.9/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
= Web Service Consumer Connector 1.9 - Mule 4
:page-aliases: connectors::web-service/web-service-consumer.adoc

Anypoint Connector for Web Service Consumer (Web Service Consumer Connector) consumes a SOAP web service from a Mule app to acquire data from an external source. In many cases, you can use Anypoint Connector for Workday (Workday Connector) or Anypoint Connector for ServiceNow (ServiceNow Connector) to connect to a service provider, however, when no connector is available for a specific web service, the easiest way to consume the service is to use the Web Service Consumer Connector.

The main features of the connector include:

* Ability to consume DOC literal web services
* Use of SOAP multipart messages
* Use of SOAP headers
* Support for a DataSense for SOAP headers, SOAP body, and attachments
* Use of embedded DataWeave transformations inside the operation
* Support for a unified experience for SOAP with attachments and MTOM handling
* Custom HTTP configuration as a transport
* Support for Web Service Security (WS Security)
[NOTE]
Web Service Consumer Connector doesn't support RPC WSDLs (Remote procedure call Web Service Descripting Language).


== Before You Begin

To use this connector, you must be familiar with:

* SOAP and WSDLs
* Anypoint Connectors
* Mule runtime engine (Mule)
* Elements in a Mule flow
* Global elements
* DataWeave
* Creating a Mule app using Anypoint Studio

Before creating an app, you must have access to Anypoint Studio.


== Next Step

After you complete the prerequisites, you are ready to create an app and configure the connector using xref:web-service-consumer-studio.adoc[Anypoint Studio].

== See Also

* xref:connectors::introduction/introduction-to-anypoint-connectors.adoc[Introduction to Anypoint Connectors]
* xref:connectors::introduction/intro-use-exchange.adoc[Use Exchange to Discover Connectors, Templates, and Examples]
* https://anypoint.mulesoft.com/exchange/org.mule.connectors/mule-wsc-connector/[Web Service Consumer in Exchange]
* https://help.mulesoft.com[MuleSoft Help Center]
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
= Web Service Consumer Additional Configuration Information - Mule 4
:page-aliases: connectors::web-service/web-service-consumer-configure.adoc

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:

. In Studio, open the *Global Element Properties* window of the Web Service Consumer Connector.
. 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.
. Click *OK*

In Studio, configuring custom HTTP transport looks like this:

image::web-service-consumer-configure-transport.png[Configure Custom HTTP Transport]

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

[source,xml,linenums]
----
<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>
----



== 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:

. In Studio, open the *Global Element Properties* window of the Web Service Consumer Connector.
. On the *Security* tab, for *Username token security strategy*, select `Edit inline`.
. Complete the *Username*, and *Password* fields, and set *Add nonce* and *Add created* fields to `true`.
. Click *OK*.

In Studio, configuring web service security looks like this:

image::web-service-consumer-configure-wsecurity.png[Configure Web Service Security]

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

[source,xml,linenums]
----
<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.

. In Studio, select the *On Error Continue* component of the Error handling section.
. Set *Type* to *WSC:EMPTY_RESPONSE*.

image::web-service-consumer-emptyresponse.png[WSC:EMPTY_RESPONSE selected for Type field]

In the *Configuration XML* tab, the configuration looks like this:
[source,xml,linenums]
----
<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.

. In Studio, drag a *Scheduler* source to your flow.
. Drag a *Set variable* component alongside the *Scheduler* source.
. Set *Name* to `variableSample` and *Value* to `test`.
. Drag a *Transform Message* component alongside the *Set Variable* component.
. In the Datasense output view, add the following DataWeave expression:

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

[start=6]
. Drag the Web Service Consumer Connector *Consume* operation alongside the *Transform Message* component.
. Set a *Connector configuration* for the connector.
. Set *Operation* to `attachOperation`.
. Drag an *On Error Continue* component to the Error handling section of your flow.
. Set *Type* to `WSC:BAD_RESPONSE`.
. Drag a *Logger* component into the *On Error Continue* component.
. 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:
[source,xml,linenums]
----
<?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

* https://help.mulesoft.com[MuleSoft Help Center]
* xref:web-service-consumer-reference.adoc[Web Service Consumer Connector Reference]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
= Web Service Consumer Connector Examples - Mule 4

The following examples illustrate how to configure Anypoint Connector for Web Service Consumer (Web Service Consumer) Connector operations both in Anypoint Studio and the XML editor.

* xref:web-service-example-1.adoc[Web Service Consumer Connector Example 1]
This example transforms a variable value into XML and pass that value to the Web Service Consumer Connector, which subsequently consumes a web service.
* xref:web-service-example-2.adoc[Web Service Consumer Connector Example 2]
This example list an inventory of t-shirts and the Web Service Consumer Connector returns if there is an error such as `BAD_RESPONSE` or `EMPTY_RESPONSE`.
== See Also
* xref:connectors::introduction/introduction-to-anypoint-connectors.adoc[Introduction to Anypoint Connectors]
* https://help.mulesoft.com[MuleSoft Help Center]
Loading

0 comments on commit 60ce81e

Please sign in to comment.