Advanced Web Service Deployment
Although JWS files are convenient, sometimes you'll need more complex Web service configurations. For example, some pre- or post-processing might be needed for a particular Web service, or perhaps the Web service isn't a Java program and a special dispatcher is needed (more on these later). In these cases, you can't use JWS files, and you need a more robust deployment mechanism. This is when you'll use the server-config.xml file and the AdminClient (mentioned previously).
For example, let's say we want to deploy the same InventoryCheck service in the JWS scenario, but this time we also want to have a handler email a copy of each response message. To do this, we must first create a deployment XML file for the AdminClient:
<m:deploy xmlns:m="AdminService"> <handler name="email" class="com.skatestown.services.EMailHandler" /> <service name="InvetoryCheck" pivot="RPCDispatcher" response="email"> <option name="className" value="com.skatestown.services.InventoryCheck" /> <option name="methodName" value="doCheck" /> </service> </m:deploy>
Notice that we added a handler called email, whose class name is com.skatestown.services. EMailHandler. In addition, a new service chain is defined that invokes the RPCDispatcher and this new email handler. The RPCDispatcher is the handler that will locate and invoke the Java method for the Web service. Notice that in the definition of the service, we provide some options—className and methodName. These options will be used in the RPCDispatchhandler—it will create a new instance of com.skatestown.service.InventoryCheck class and then invoke the doCheck method (of course passing in the parameters from the SOAP request message). To deploy these new resources, the AdminClient is used:
> java org.apache.axis.client.AdminClient deploy.xml
Once deployed, we need to copy the InventoryCheck.class file into the axis/WEB-INF/ classes directory. We should then be set to run the client.