Entering content frame

Component documentation External Web Services Runtime Data Generator Locate the document in its SAP Library structure

Purpose

When a component is deployed, two steps are performed:

...

       1.      The component is deployed on the SAP J2EE Engine – the component is registered on the server

       2.      The application starts.

The standard way of deploying a Web service (WS) on the J2EE Engine enables the deployment of the component, and the generation of any additional deployment Java classes and objects necessary to register the service and its integration and interoperability within the server.

The SAP J2EE Engine supports the external generation of the WS deployment information and importing it when the component is deployed. The generation process is done via the command line and the generated data is packed in a JAR file. This archive file is required for the service to be registered at runtime.

Features

Generating Deployment Data

The following constructor and methods of the com.sap.engine.services.webservices.server.deploy.external.ExternalWSDeployGenerator are invoked:

·        public ExternalWSDeployGenerator(String baseWorkingDir) – the parameter of the constructor specifies a directory used for generating and packing data in a JAR file.

·        void deployModule(String workingModule, String resultArchive) – this method generates the JAR file with the additional data. The workingModule specifies the path to the WS archive file in the EAR of the service. The resultArchivespecifies the path to the result JAR file.

·        void deployModule(String workingModule) – this method has the same functions as the above method, the only difference is that the path to the result JAR file is not specified – by default, it is generated in the base directory defined in the constructor of this class.

After the deployment data is generated in the JAR file, the Web service is ready for registering on the SAP J2EE Engine.

Runtime WS Registration

To register the developed WS at runtime, you have to look up the wsContext/wsContainerInterface to get an instance of com.sap.engine.interfaces.webservices.server.WSContainerInterface.

·        String NAME = "wsContainerInterface" – creates a JNDI name for that interface instance, under which it is looked up in the naming context.

·        String registerWebServices(String archiveFile) – the name of the generated JAR file is passed and all Web services contained in it are registered. This method returns an identifier, under which the WSs have been registered.

·        void unregisterWebServices(String id) – unregisters the WSs via the identifier, under which they have been registered on the server.

·        boolean isServiceEndpointRegistered(String transportAddress) – checks if the Service Endpoint (SE) is not already used by another WS registration. This method returns transportAddress, the identifier under which the SE has been registered.

Note

If the SE is already booked under this identifier, then change the ID in the ws-configuration tag of the ws-deployment-descriptor.xml. You can find a schema for this deployment descriptor in com.sap.engine.services.webservices.server.deploy.schemas.ws-deployment-descriptor.xsd.

Caution

This is a runtime registration, which means all registered WSs are available until the SAP J2EE Engine is running.

Example

This is a runtime registration of a Web service, which has already looked up the wsContainerInterface instance:

Context ctx = new InitialContext();

WSContainerInterface wsContainer = ctx.lookup("wsContext/wsContainerInterface");

String id = wsContainer.registerWebServices("D:\develop\webServicesResultArchive.jar");

...

...

...

wsContainer.unregisterWebServices(id);

 

Command Line Data Generation

Use the command line for external generation of the WS deployment information. The following parameters data must be provided :

·        param[0] – the base working directory

·        param[1] – the working module

·        param[2] – the result archive (optional)

Example

If the input parameters are:

param[0] - D:\temp
param[1] - D:\develop\testWebServicesArchive.jar
param[2] - D:\develop\webServicesResultArchive.jar

Then on the command line, enter:

WSExternalDeployGenerator  "D:\temp" "D:\develop\testWebServicesArchive.jar" "D:\develop\webServicesResultArchive.jar"

Example

If the input parameters are:

param[0] - D:\temp
param[1] - D:\develop\testWebServicesArchive.jar

Then on the command line, enter:

WSExternalDeployGenerator  "D:\temp" "D:\develop\testWebServicesArchive.jar"

By default, the result archive file will be located in D:\temp\testWebServicesArchive.jar.

 

Leaving content frame