Jar service deployment capability in WSO2 is provided by the following feature:
Name: Jar Service Hosting Feature
Identifier: org.wso2.carbon.jarservices.feature.group
Follow the instructions below to deploy a Jar service in a running Carbon instance.
1. Log on to the product's Management Console and select "Services -> Add -> Jar Service."
2. The "Add Jar Service" page appears. The "Artifact" and "Service Group Name" fields are mandatory. Others are optional.
Service Hierarchy
Specifying a service hierarchy is optional. It allows you to customize your service endpoint reference. If the business logic of the same service changes over time, you can maintain multiple versions of the service by using service hierarchy at the deployment. For example, consider a service named "Version"
If the service hierarchy is not mentioned, then the service endpoint reference is ../services/Version. With service hierarchy specified, for example as 1.0.0, the endpoint reference is ../services/1.0.0/Version.
Specifying a hierarchy is important if you want to manage services separately.
3. Step1: Specify the service archive details and click "Next".
You can add more files by clicking the "Add more dependencies" link. The - sign removes the option to add more files.
4. If Step 1 is successful, you will be shown all the classes in the .jar file/files uploaded in Step 1.
You can specify the following properties in the selected classes
- Service Name: Name of the Web service created from the selected class.
- Deployment Scope: There are four ways in which you can deploy a service. The scope of the service relates to the life cycle of the service instance. They are defined as follows.
- Application - Service instance lifetime is equal to the server lifetime. Service class will be initialized only once for a running server. This is useful in developing stateful Web services.
- Request - Service class is initialized for each and every request.
- SOAP Session - Axis2 supports a SOAP session using a SOAP specific cookie. Here, the service instance lifetime is equal to the lifetime of the SOAP session.
- Transport Session - Service instance lifetime is equal to the lifetime of the transport session.
- Use Original WSDL: Determines whether to use the original WSDL in the service archive or not. This property can only be specified if you have already uploaded a WSDL in Step 1. If this is set to 'False', then the WSDL will be generated since it is not specified in step 1.
5. Step 2: Select one or more classes to be exposed as Web services and click "Next."
6. Step3: You will be shown the set of classes selected in Step 2 along with the operations in each of those classes. All methods are selected by default. Deselect the ones you do not wish to expose as Web Service operations and click "Finish."
7. If the file is uploaded successfully, a message appears prompting you to refresh the page. Click "OK."
8. Refresh the "Deployed Services" page in the product's Management Console to view the newly added service listed.