Working with Services
Web services can be deployed in the ESB profile of WSO2 Enterprise Integrator (WSO2 EI) to facilitate various integration use cases:
- Proxy services for mediating messages
- Data services for exposing datasources
- Admin services for managing WSO2 EI internallyÂ
The following topics explain how you can manage the above services, in general, using the Management Console:
Using the service dashboard
When you log in to the product's management console, you can navigate to the list of services and click a service to open the dashboard. You can use the dashboard to perform functions such as viewing statistical information about a service, editing a service, redeploying a service, etc. When you click Try this service, you will be directed to a page that displays all the operations available for the service.
Note
When redeploying a proxy service, there is a two-second delay by default to allow the existing configuration to finish processing the current messages. You can change this delay by adding the hotupdate.timeout
parameter to the parameters section of <EI_HOME>/conf/axis2/axis2.xml
. For example, to eliminate the delay, add the following line:
<parameter name="hotupdate.timeout" locked="false">0</parameter>
Accessing the service WSDLs
A service deployed in the ESB can be accessed through endpoint URLs with the following format. Note that the default server ports are 8280 and 8243 for HTTP and HTTPS respectively.
http://{host ip of the server}:8280/services/{service name}
https://{host ip of the server}:8243/services/{service name}
You can access the WSDL file (service descriptor file) of a service by appending the service URL with the following:
- ?wsdl2:Â WSDL 2.0 description of the service
- ?wsdl:Â WSDL 1.1 description of the service
The WSDLs describe the operations that the service expose, the structure of the XML that is sent and received by each operation, and how to communicate with the service to retrieve the XML content. By default, six different types of endpoints are deployed for a service. Each of these endpoint types are represented by the WSDL 2.0 <endpoint> elements of the service, and by the <binding> elements to which these endpoints refer. The default endpoints are as follows:
- SOAP 1.2 over HTTP
- SOAP 1.1 over HTTP
- Plain old XML/REST over HTTP
- SOAP 1.2 over HTTPS
- SOAP 1.1 over HTTPS
- Plain old XML/REST over HTTPS
Using WSO2 EI Tools for services
The following tools are available in the ESB profile of WSO2 EI:
WSDL2Java: This tool is used to generate Java code to provide or consume a Web service for a given WSDL. You can use this tool to develop Web services for contract-first development. The tool provides many options to customize your code. You can now call this stub object from your client Java code. Note that when you instantiate a stub object generated from WSDL2java without passing any parameters, the underlying Axis2 runtime creates a configuration context for the new stub object. Therefore, when initializing multiple stub objects, many configuration context objects are created, which slows the performance of the client. To avoid performance problems, create a configuration context at the beginning of your client code and pass that same context to all stub objects. For example:
ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", "axis2.xml"); CustomerOrderServiceStub stub = new CustomerOrderServiceStub(configurationContext, "http://localhost:8088/services/CustomerOrderService");
- Java2WSDL: This tool allows you to generate the WSDL for the Java code that is already written to provide a Web service. This tool helps you to develop Web services in the code-first approach, where the development starts with the code and thereafter you derive the WSDL from the source.
Try It: This tool allows you to try your own Web Services Definition Language (WSDL) or any publicly available WSDL of the document/literal style. This tool provides a mechanism to test your WSDL by creating endpoints on-the-fly. It helps to test a WSDL before actually coding it, without the need for a third party WSDL validator tool. You can change the endpoint for the service if there are multiple endpoints. You can also specify a customized endpoint.
Note
The Try It tool does not support relative schema imports and WSDL imports at the moment. We will provide this feature in a future release.
- WSDL Validator: This tool validates a WSDL document and prints the result in the Validation Result section. You can upload your WSDL or you can provide a WSDL URL. The tool will validate your WSDL and print the result in the Validation Result section.