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 Main -> Services -> Add -> Jar Service.
- The Add Jar Service page opens. The Artifact and Service Group Name fields are mandatory. Others are optional.
Service HierarchySpecifying 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 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 Add more dependencies. The "-" sign removes the option to add more files.
If the above steps are successful, you will be shown all the classes in the .jar file/files that you uploaded.
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 or not to use the original WSDL in the service archive. This property can only be specified if you have already uploaded a WSDL in the above steps. If this is set to 'False', then the WSDL will be generated since it is not specified earlier.
- Select one or more classes to be exposed as Web services and click Next.
- You will be shown the set of classes selected 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. ClickOK.
- Refresh the Deployed Services page in the product's management console to view the newly added service listed.