butek 02/04/22 11:34:11 Modified: java/samples/jaxrpc README java/test/functional TestMessageSample.java Added: java/samples/jaxrpc deploy.wsdd perms.lst undeploy.wsdd users.lst java/samples/message TestMsg.java readme java/samples/misc deploy.wsdd readme Removed: java/samples/message testMessage.java Log: More sample readme fixes/additions. Plus a classname fix: testMessage SHOULD be TestMessage, but since we have problems changing names only by case, I changed this test to TestMsg. Revision Changes Path 1.2 +65 -35 xml-axis/java/samples/jaxrpc/README Index: README =================================================================== RCS file: /home/cvs/xml-axis/java/samples/jaxrpc/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- README 10 Apr 2002 13:55:44 -0000 1.1 +++ README 22 Apr 2002 18:34:11 -0000 1.2 @@ -1,27 +1,45 @@ -The JAX-RPC compliance samples assume you have a service up and running, -either through Tomcat or some other web service, or via the SimpleAxisServer. -If you do not have a service running, you can start the SimpleAxisServer: +To run the JAX-RPC compliance samples, you must do the following: +1. Set up your CLASSPATH. +2. Start a server. +3. Deploy the service. +4. Run the samples. + +1. Set up your CLASSPATH. + The CLASSPATH must contain: an XML parser (ie., Xerces), JUnit + (www.junit.org), all the jars in the lib directory, and the directory + containing the samples subdirectory. + +2. Start a server. + To run the sample, you will first need to run a server. To run a very + simple server you could run, in a separate window: + java org.apache.axis.transport.http.SimpleAxisServer -p 8080 + +3. Deploy the sample. + To deploy the samples, be sure you're in the JAX-RPC samples directory (samples/jaxrpc), then run: + java org.apache.axis.client.AdminClient deploy.wsdd + +4. Run the samples. + + Run the GetInfo sample: + java samples.jaxrpc.GetInfo <symbol> <datatype> + + where <symbol> is one of "IBM", "ALLR" (Allaire), or "CSCO" (Cisco) + (these are the only symbols this sample supports) + and <datatype> is one of "symbol", "name", or "address". + + Here's a simple, explicit example: + java samples.jaxrpc.GetInfo IBM address + This should result in the following output: + IBM: Armonk, NY + + + Run the GetQuote1 sample: + cd ../.. (cd to the directory containing the samples subdirectory. + This is required because the path given for the WSDL file + is relative to this directory.) + java samples.jaxrpc.GetQuote1 [options] <symbol> - java org.apache.axis.transport.http.SimpleAxisServer -p 8080 - -Set up the CLASSPATH. It must contain an XML parser (ie., xerces.jar); -all the jars in the lib directory; and the directory containing the samples -subdirectory. - -Since these tests are JAX-RPC-specific versions of other samples, they use -those other samples' deploy.wsdd files. We will discuss the GetQuote1 -sample, but the others follow a similar pattern; - -cd to the directory containing the deploy.wsdd file: - cd samples/stock/ - -Deploy the service: - java org.apache.axis.client.AdminClient deploy.wsdd - -Run the GetQuote1 sample: - java samples.jaxrpc.GetQuote1 [options] <symbol> - - options: + options: -d turn on debugging - more 'd means more info -h<HOST> server host name -l<URL> ie. http://localhost:80/axis/servlet/AxisServlet @@ -30,15 +48,27 @@ -u<USERID> user-id -w<PASSWD> password -If you use the authorization and authentication handlers (which samples/stock/deploy.wsdd specifies) you'll need to add a couple of files to your Servlet Engine's current dir: - -users.lst - - list of users and passwords - -perms.lst - - list of users and allowable actions per user - -Use the ones in the samples/stock directory. Note also that if you are running the SimpleAxisServer, these files must be in the directory from which that program is run. - -Here's an explicit example of running GetQuote1 using these files: - java samples.jaxrpc.GetQuote1 -uuser1 -wpass1 XXX + If you use the authorization and authentication handlers (which the given + deploy.wsdd does) you'll need to add a couple of files to your Servlet + Engine's current dir: + + users.lst + - list of users and passwords + + perms.lst + - list of users and allowable actions per user + + If you are running the SimpleAxisServer, this means that these files must + be in the directory from which that program is run. The easiest thing to + do is to cd to samples/jaxrpc and run SimpleAxisServer from there. + + Here's an explicit example of running GetQuote1 using these files: + java samples.jaxrpc.GetQuote1 -uuser1 -wpass1 XXX + This should result in the following output: + Using WSDL + XXX: 55.25 + Manually + XXX: 55.25 + WSDL + Reuse Call + Just a test + XXX: 55.25 1.1 xml-axis/java/samples/jaxrpc/deploy.wsdd Index: deploy.wsdd =================================================================== <!-- Use this file to deploy some handlers/chains and services --> <!-- Two ways to do this: --> <!-- java org.apache.axis.client.AdminClient deploy.wsdd --> <!-- after the axis server is running --> <!-- or --> <!-- java org.apache.axis.utils.Admin client|server deploy.wsdd --> <!-- from the same directory that the Axis engine runs --> <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="urn:xmltoday-delayed-quotes" provider="java:RPC"> <parameter name="className" value="samples.stock.StockQuoteService"/> <parameter name="allowedMethods" value="getQuote test"/> <parameter name="allowedRoles" value="user1,user2"/> <requestFlow name="checks"> <handler type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/> <handler type="java:org.apache.axis.handlers.SimpleAuthorizationHandler"/> </requestFlow> </service> <service name="urn:cominfo" provider="java:RPC"> <parameter name="className" value="samples.stock.ComInfoService" /> <parameter name="allowedMethods" value="getInfo" /> <parameter name="allowedRoles" value="user3"/> <requestFlow type="checks"/> </service> </deployment> 1.1 xml-axis/java/samples/jaxrpc/perms.lst Index: perms.lst =================================================================== user1 urn:xmltoday-delayed-quotes user2 urn:xmltoday-delayed-quotes user3 urn:cominfo 1.1 xml-axis/java/samples/jaxrpc/undeploy.wsdd Index: undeploy.wsdd =================================================================== <undeployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"> <service name="urn:xmltoday-delayed-quotes"/> <service name="urn:cominfo"/> </undeployment> 1.1 xml-axis/java/samples/jaxrpc/users.lst Index: users.lst =================================================================== user1 pass1 user2 user3 pass3 1.1 xml-axis/java/samples/message/TestMsg.java Index: TestMsg.java =================================================================== package samples.message; import org.apache.axis.client.Service; import org.apache.axis.client.Call; import org.apache.axis.message.SOAPBodyElement; import org.apache.axis.utils.Options; import org.apache.axis.utils.XMLUtils; import org.w3c.dom.Element; import java.net.URL; import java.util.Vector; public class TestMsg { public String doit(String[] args) throws Exception { Options opts = new Options(args); opts.setDefaultURL("http://localhost:8080/axis/services/MessageService"); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new URL(opts.getURL()) ); SOAPBodyElement[] input = new SOAPBodyElement[2]; input[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1", "Hello")); input[1] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1", "World")); Vector elems = (Vector) call.invoke( input ); SOAPBodyElement elem = null ; Element e = null ; elem = (SOAPBodyElement) elems.get(0); e = elem.getAsDOM(); String str = "Res elem[0]=" + XMLUtils.ElementToString(e); elem = (SOAPBodyElement) elems.get(1); e = elem.getAsDOM(); str = str + "Res elem[1]=" + XMLUtils.ElementToString(e); return( str ); } public static void main(String[] args) throws Exception { String res = (new TestMsg()).doit(args); System.out.println(res); } } 1.1 xml-axis/java/samples/message/readme Index: readme =================================================================== To run the encoding samples, you must do the following: 1. Set up your CLASSPATH. 2. Start a server. 3. Deploy the service. 4. Run the sample. 1. Set up your CLASSPATH. The CLASSPATH must contain: an XML parser (ie., Xerces), JUnit (www.junit.org), all the jars in the lib directory, and the directory containing the samples subdirectory. 2. Start a server. To run the sample, you will first need to run a server. To run a very simple server you could run, in a separate window: java org.apache.axis.transport.http.SimpleAxisServer -p 8080 3. Deploy the sample. To deploy the sample, run: java org.apache.axis.client.AdminClient deploy.wsdd 4. Run the sample. Finally, to run the client, run: java samples.message.TestMsg 1.1 xml-axis/java/samples/misc/deploy.wsdd Index: deploy.wsdd =================================================================== <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"> <service name="EchoService" provider="Handler"> <parameter name="handlerClass" value="org.apache.axis.handlers.EchoHandler"/> </service> </deployment> 1.1 xml-axis/java/samples/misc/readme Index: readme =================================================================== To run the encoding samples, you must do the following: 1. Set up your CLASSPATH. 2. Start a server. 3. Deploy the service. 4. Run the samples. 1. Set up your CLASSPATH. The CLASSPATH must contain: an XML parser (ie., Xerces), JUnit (www.junit.org), all the jars in the lib directory, and the directory containing the samples subdirectory. 2. Start a server. To run the sample, you will first need to run a server. To run a very simple server you could run, in a separate window: java org.apache.axis.transport.http.SimpleAxisServer -p 8080 3. Deploy the sample. To deploy the sample, run: java org.apache.axis.client.AdminClient deploy.wsdd 4. Run the samples. Finally, to run the client, run: java samples.misc.TestClient 1.3 +2 -2 xml-axis/java/test/functional/TestMessageSample.java Index: TestMessageSample.java =================================================================== RCS file: /home/cvs/xml-axis/java/test/functional/TestMessageSample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestMessageSample.java 19 Feb 2002 17:38:22 -0000 1.2 +++ TestMessageSample.java 22 Apr 2002 18:34:11 -0000 1.3 @@ -60,7 +60,7 @@ import org.apache.axis.client.AdminClient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import samples.message.testMessage; +import samples.message.TestMsg; /** Test the message sample code. */ @@ -79,7 +79,7 @@ public void doTestMessage() throws Exception { String[] args = { }; - String res = (new testMessage()).doit(args); + String res = (new TestMsg()).doit(args); String expected="Res elem[0]=<ns1:e1 xmlns:ns1=\"urn:foo\">Hello</ns1:e1>Res elem[1]=<ns2:e1 xmlns:ns2=\"urn:foo\">World</ns2:e1>"; assertEquals("test result elements", res, expected); }