This component invokes a web service (usually externally hosted on a third-party system) based on the configured WSDL. This component uses Axis2 API to invoke the web services.
Unlike most static web service client options (like Axis wsdl2java) which generates client stub code for invocation of a given WSDL, this component employs a dynamic invocation mechanism to ensure that no code needs be written or deployed for invoking a component.
The incoming request parameters are automatically wrapped in a SOAP request packet (handling different types of SOAP headers for handling web service security, transactions etc.) and sent to underlying transport (usually the response is sent back to the client.
Configuration and Testing
Properties can be configured in the Configuration Property Sheet (CPS) of the component.
Component Configuration
Figure 1: Component Configuration panel in CPS
General
Use Operation Details from Input
If this property is set to true, component will use the webservice operation details from the input request. If this property is set to true the properties Use Connection Details From Input, Load WSDL From, WSDL URL,WSDL File, WebService Operation, WSDL Service, WSDL Port, Endpoint Address, Action, SOAPBody Namespace, Input parameter, Output Parameter will be disabled.
Use Connection Details from Input
If this property is set to true, then the property "End Point Address" can be provided dynamically in the input request. If this property is selected and the "End Point Address" is not given in the input request, then the value given in this panel for that property will be used.
Error Handling Configuration
Click on the ellipsis button against Error handling configuration property to configure Error Handling properties.
Figure 2: Error Handling Configuration
The remedial actions to be taken when a particular error occurs can be configured here.
Please refer Error Handling section Common Configurations page for details.
Load WSDL From
Source for WSDL can be configured here. It can be a File or a valid WSDL URL.
When File is selected, the WSDL file location can be configured.
Figure 3: Specifying WSDL File
When URL is selected, the WSDL URL can be configured.
Figure 4: Specifying WSDL URL
WebService Operation
The web service operation to be invoked can be configured here.
Click the ellipsis button against this property to select the operation from the available list of operations for the respective WSDL that is loaded.
Figure 5: WSDL operations
WSDL Service Configuration
The Operation can also be typed manually in offline mode but all the other properties have to be populated manually.
Figure 6: WSDL Service Configuration
WSDLService
The service element defines the ports supported by the Web service. For each of the supported protocols, there is one port element. The service element is a collection of ports.
Endpoint Address
Provides a unique network address that a client uses to communicate with a service endpoint.
Action
The SOAP Action field can be used to indicate the intent of the SOAP HTTP request. The value is a URI identifying the intent.
Other Properties under General Configurations
- WSDL Port: Name of a single endpoint defined as a combination of a binding and a network address; it represents the endpoint of the webservice.
- Socket Timeout: Sets the cocket timeout used when executing a request with the underlying HTTP client that is being used. WebsServiceConsumer uses Apache HttpClient as the default HTTP client implementation and therefore the property will set "http.socket.timeout" property of Apache HttpClient. A timeout value of zero is interpreted as an infinite timeout.
- Connection Timeout: The timeout until a connection is established. A value of zero means the timeout is not used.
- SOAP Body Namespace: Namespace attribute of soap:body element. This is usually specified in case of RPC encoded web services.
- Use WSDL At Runtime: WSDL will be parsed during runtime.
- Input Parameter: Input parameter name of the selected Operation. This is used to identify correct operation in the case of overloaded operations in the WSDL.
- Output Parameter: Output parameter name of the selected Operation. This is used to identify correct operation in the case of overloaded operations in the WSDL.
- HTTP Header protocol: Select the HTTP Protocol header to use. Chunked transfer will be used in HTTP/1.1 protocol. If there is a "Transport error: 501 Error: Not Implemented" with HTTP/1.1, HTTP/1.0 should be used.
- Store imported schemas: Save schemas imported in WSDL to schema repository.
For details regarding Target Namespace, Input Elements to Encrypt/Decrypt and Output Elements to Encrypt/Decrypt, please refer the respective sections in the Common Configurations page.
Advanced
HTTP Authentication
Click the ellipsis button to configure authentication details.
Use HTTP Authentication
This enables authentication, which provides properties to choose the type of Authentication to be used to connect to the web server and properties to provide the credentials required.
There are three Authentication types, which are Basic, Digest and NTLM.
Authentication Type - Basic
When Authentication Type is 'Basic', the following fields have to be specified.
Figure 7: Basic Authentication Type
- Username: User Name to connect to the web server.
- Password: Password for the username mentioned.
Authentication Type - Digest
When Authentication Type is 'Digest', the following fields have to be specified.
Figure 8: Digest Authentication Type
- Username: User Name to connect to the webserver.
- Password: Password for the username mentioned.
- Hostname: Host that needed to be authenticated with.
- Port: Port of the host that needed to be authenticated with.
- Domain: Domain name needed by NT Credentials for NT Domain.
Authentication Type - NTLM
When Authentication Type is 'NTLM', the following fields have to be populated.
Figure 9: NTLM Authentication Type
- Username: User Name to connect to the web server.
- Password: Password for the username mentioned.
- Hostname: Host that needed to be authenticated with.
- Port: Port of the host that needed to be authenticated with.
- Realm: Realm for authentication scope.
JMS Transport Settings
Please refer the corresponding section in the Common Configurations page for details; descriptions are the same.
Input Schema
The input schema is auto generated based on the configuration provided. Below is a sample Schema.
Figure 10: Input Schema
When the property "Use Connection Details From Input" is chosen, an additional element 'ConnectionProperties' is added to the input schema, as shown in the figure. We can provide End Point Address under this element. If JMS Transport is enabled, properties pertaining to JMS Transport MUST be filled.If JMS Transport is enabled, then endpoint address can be left empty, as component takes details from filled properties,but if URL is specified, they should follow guidelines laid by Apache Axis2
Figure 11: Input schema with ConnectionProperties
When the property "Use Operation Details From Input" is chosen, the wsdl operation details are added to the input schema, as shown in the figure.If JMS Transport is enabled, properties pertaining to JMS Transport MUST be filled.If JMS Transport is enabled, then endpoint address can be left empty, as component takes details from filled properties,but if URL is specified, they should follow guidelines laid by Apache Axis2.
Figure 12: Input schema with Operation Details
Output Schema
The output schema is auto generated based on the configuration provided. For the Input schema shown above, the schema would be as below.
Figure 13: Output Schema
Functional demonstration
Scenario 1
Invoking a web service operation using a WSDL from the following URL
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
Figure 14: Feeder and Display components connected to demonstrate Scenario 1
Sample Input
Figure 15: Sample input provided using feeder
Sample Output
Figure 16: Output displayed in Display Window
Scenario 2
Invoking a web service operation using a WSDL from the following URL, by setting the property "Use Operation Details From Input" to true
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
Configure the Web Service Consumer component as described and use Feeder and Display components to send sample input and check the response respectively.
Figure 17: Feeder and Display components connected to demonstrate Scenario 2
Sample Input
Figure 18: Sample input provided using feeder
Sample Output
Figure 19: Output displayed in Display Window