Follow the instructions below to deploy a Jar service in a running WSO2 AS instance.
- Log on to the product's Management Console and select Services -> Add -> Jar Service.
- The "Add Jar Service" page appears. The "Artifact" and "Service Group Name" fields are mandatory. Others are optional.
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.
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.
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.
- Step 2: Select one or more classes to be exposed as Web services and click Next.
- 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.
- If the file is uploaded successfully, a message appears prompting you to refresh the page. Click OK.
- Refresh the "Deployed Services" page in the product's Management Console to view the newly added service listed.