Installing the WS Interface in Axis
Ponder2 can accept Web Service calls, either from another Ponder2 service or from an external program. It can also receive external events via a Web Service call.
To receive Web Service calls, Ponder2 uses an Apache Axis service which communicates with the CommandInterpreter using Java RMI.
The Web Service interface for Axis used a .jws file called Ponder2.jws. This file must be placed into the Axis main directory. This is normally under the Apache TomCat installation in .../tomcat/webapps/axis. The following commands assume a Unix system.
$ cp ponder2.jws /somewhere/tomcat/webapps/axis/Ponder2.jws
The Ponder2.jws file is the Web Service entrypoint for Web Service calls to the SMC. It communicates with Ponder2 using RMI and therefore requires the RMI interface to be available in the Axis library. Knowledge of the interface is set up by copying the Ponder2 JAR file and the Ponder2 Comms JAR files to the Axis lib directory. You may also need qdparser.jar so that should be copied too. For example:
$ cp ponder2.jar /somewhere/tomcat/webapps/axis/WEB-INF/lib $ cp ponder2comms.jar /somewhere/tomcat/webapps/axis/WEB-INF/lib $ cp qdparser.jar /somewhere/tomcat/webapps/axis/WEB-INF/lib
Restart the Axis server and test the new service by going to page http://localhost:8080/axis/Ponder2.jws you should see a message telling you that there is a "Web Service here." Click on the WSDL link and you will get a page with the WSDL for the service on it. If running Safari, you will see a blank page and will have to use the View Source menu item to see the WSDL description.
From now on, if you want to run Ponder2 so that it can receive Web Service or RMI calls you must start it using the following command. For a detailed explanation about this command and what the codebase means see Ponder2Comms RMI. You also need to ensure that all the JAR files in the commslib directory are included in the classpath environment variable.
java -Djava.rmi.server.codebase="list of URLs of jar files" net.ponder2.Main -address rmi://localhost/Ponder2
You should get the following output if the SMC sucessfully registers its RMI name (make sure that rmiregistry is running):
Local RMI address is Ponder2
Remote RMI address is rmi://localhost/Ponder2
Shell: trying port 13570
Shell port 13570 readyYou can test the setup by leaving Ponder2 running, and in another terminal window enter:
$ telnet localhost 13570 Connected to localhost. Escape character is '^]'. Ponder2 Shell Rev: 161 Date: 2006-12-12 23:17:13 +0100 (Tue, 12 Dec 2006) No wild chars yet $
Now enter the following XML, remember the . at the end:
<xml>
<use name="/">
<add name="myself">
<use name="/" location="http://localhost:8080/axis/Ponder2.jws"/>
</add>
</use>
</xml>
.You should get something similar to the following output in your SMC window if it is all working properly:
Remote getObject called for path /
HTTPTransmitter: Invoke returns <result>
<oids>
<oid isdomain='true' uid='0.261111505645675'>
<address uri='rmi://localhost/Ponder2'/>
<address uri='http://localhost:8080/axis/Ponder2.jws'/>
</oid>
</oids>
</result>Use ctrl-C to kill the SMC.
Note: If you get the following error, you do not have all the required JAR files from commslib in your classpath properly.
Exception in thread "Thread-3" java.lang.NoClassDefFoundError: org/apache/axis/client/Service
at net.ponder2.comms.HttpProtocol.install(HttpProtocol.java:53)Note: To use the Ponder2 Web Services at any time you must have the Java rmiregistry running on the same machine as the Ponder2 SMC.
