Debian Codegraph @

docs/install.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>Axis installation instructions</title>
5 <link href="axis.css" rel="stylesheet" type="text/css">
6 </head>
7 <body>
8 <table cellspacing="0" width="100%" border="0">
9 <tbody>
10 <tr>
11 <td colspan="2"> <a href="http://ws.apache.org/axis"><img
12 border="0" align="left" src="images/axis.jpg"> </a>
13 <h1>Installing and deploying web applications using xml-axis </h1>
14 </td>
15 </tr>
16 </tbody>
17 </table>
18 <hr size="1" noshade="noshade">
19 <strong>Contents
20 </strong>
21 <ul>
22 <li> <a href="#intro">Introduction</a> </li>
23 <li> <a href="#webapp">Creating Webapps</a> </li>
24 <li> <a href="#depend">Installing Dependencies</a> </li>
25 <li> <a href="#websvc">Installing Web Services</a> </li>
26 <li> <a href="#start">Starting the web server</a> </li>
27 <li> <a href="#install-test">Installation testing</a> </li>
28 <li> <a href="#deploy">Deploying web services</a> </li>
29 <li> <a href="#test">Testing</a> </li>
30 <li> <a href="#advanced">Advanced Installation</a> </li>
31 <li> <a href="#broken">What if it doesn't work?</a> </li>
32 <li> <a href="#summary">Summary</a> </li>
33 <li> <a href="#soapmon">Appendix: Enabling the SOAP Monitor</a></li>
34 </ul>
35 <a name="intro"></a>
36 <h2>Introduction</h2>
37 <p>This document describes how to install Apache Axis. It assumes you
38 already know how to write and run Java code and are not afraid of XML.
39 You should also have an application server or servlet engine and be
40 familiar with operating and deploying to it. If you need an application
41 server, we recommend <a href="http://jakarta.apache.org/tomcat/">Jakarta
42 Tomcat</a>. [If you are installing Tomcat, get the latest 4.1.x
43 version, and the full distribution, not the LE version for Java 1.4, as
44 that omits the Xerces XML parser]. Other servlet engines are supported,
45 provided they implement version 2.2 or greater of the servlet API. Note
46 also that Axis client and server requires Java 1.3 or later. </p>
47 <p>For more details on using Axis, please see the <a
48 href="user-guide.html">user guide</a>. </p>
49 <h2>Things you have to know</h2>
50 A lot of problems with Axis are encountered by people who are new to
51 Java, server-side Java and SOAP. While you can learn about SOAP as you
52 go along, writing Axis clients and servers is not the right time to be
53 learning foundational Java concepts, such as what an array is, or basic
54 application server concepts such as how servlets work, and the basics
55 of the HTTP protocol.
56 <p> Things you need to know before writing a Web Service: </p>
57 <ol>
58 <li> Core Java datatypes, classes and programming concepts. </li>
59 <li> What threads are, race conditions, thread safety and
60 sychronization. </li>
61 <li> What a classloader is, what hierarchical classloaders are, and
62 the common causes of a "ClassNotFoundException". </li>
63 <li> How to diagnose trouble from exception traces, what a
64 NullPointerException (NPE) and other common exceptions are, and how to
65 fix them. </li>
66 <li> What a web application is; what a servlet is, where classes,
67 libraries and data go in a web application. </li>
68 <li> How to start your application server and deploy a web
69 application on it. </li>
70 <li> What a network is, the core concepts of the IP protocol suite
71 and the sockets API. Specifically, what is TCP/IP. </li>
72 <li> What HTTP is. The core protocol and error codes, HTTP headers
73 and perhaps the details of basic authentication. </li>
74 <li> What XML is. Not necessarily how to parse it or anything, just
75 what constitutes well-formed and valid XML. </li>
76 </ol>
77 Axis and SOAP depends on all these details. If you don't know them,
78 Axis (or anyone else's Web Service middleware) is a dangerous place to
79 learn. Sooner or later you will be forced to discover these details,
80 and there are easier places to learn than Axis.
81 <p> If you are completely new to Java, we recommend you start off with
82 things like the Java Tutorials on Sun's web site, and perhaps a classic
83 book like <a href="http://www.mindview.net/Books/TIJ/">Thinking in Java</a>,
84 until you have enough of a foundation to be able to work with Axis. It
85 is also useful to have written a simple web application, as this will
86 give you some knowledge of how HTTP works, and how Java application
87 servers integrate with HTTP.
88 You may find the course notes from
89 <a href="http://www.cs.indiana.edu/classes/a348-dger/fall2002/notes/">
90 Mastering the World Wide Web</a> useful in this regard, even though Axis
91 is only introduced in lecture 28.
92 </p>
93
94 <p> Be aware that there is a lot more needed to be learned in order to
95 use Axis and SOAP effectively than the listing above. The other big
96 area is "how to write internet scale distributed applications". Nobody
97 knows how to do that properly yet, so that you have to learn this by
98 doing. </p>
99 <h2>Step 0: Concepts</h2>
100 Apache Axis is an Open Source SOAP server and client. SOAP is a
101 mechanism for inter-application communication between systems written
102 in arbitrary languages, across the Internet. SOAP usually exchanges
103 messages over HTTP: the client POSTs a SOAP request, and receives
104 either an HTTP success code and a SOAP response or an HTTP error code.
105 Open Source means that you get the source, but that there is no formal
106 support organisation to help you when things go wrong.
107 <p> SOAP messages are XML messages. These messages exchange structured
108 information between SOAP systems. Messages consist of one or more SOAP
109 elements inside an envelope, Headers and the SOAP Body. SOAP has two
110 syntaxes for describing the data in these elements, <i>Section 5</i>,
111 which is a clear descendant of the XML RPC system, and <i>XML Schema</i>,
112 which is the newer (and usually better) system. Axis handles the magic
113 of converting Java objects to SOAP data when it sends it over the wire
114 or receives results. SOAP Faults are sent by the server when something
115 goes wrong; Axis converts these to Java exceptions. </p>
116 <p> SOAP is intended to link disparate systems. It is not a mechanism
117 to tightly bind Java programs written by the same team together. It can
118 bind Java programs together, but not as tightly as RMI or Corba. If you
119 try sending many Java objects that RMI would happily serialize, you
120 will be disappointed at how badly Axis fails. This is by design: if
121 Axis copied RMI and serialized Java objects to byte streams, you would
122 be stuck to a particular version of Java everywhere. </p>
123 <p> Axis implements the JAX-RPC API, one of the standard ways to
124 program Java services. If you look at the specification and tutorials
125 on Sun's web site, you will understand the API. If you code to the API,
126 your programs will work with other implementations of the API, such as
127 those by Sun and BEA. Axis also provides extension features that in
128 many ways extends the JAX-RPC API. You can use these to write better
129 programs, but these will only work with the Axis implementation. But
130 since Axis is free and you get the source, that should not matter. </p>
131 <p> Axis is compiled in the JAR file <i>axis.jar</i>; it implements
132 the JAX-RPC API declared in the JAR files <i>jaxrpc.jar</i> and <i>saaj.jar</i>.
133 It needs various helper libraries, for logging, WSDL processing and
134 introspection. All these files can be packaged into a web application, <i>axis.war</i>,
135 that can be dropped into a servlet container. Axis ships with some
136 sample SOAP services. You can add your own by adding new compiled
137 classes to the Axis webapp and registering them. </p>
138 <p> Before you can do that, you have to install it and get it working. </p>
139 <a name="webapp"></a>
140 <h2>Step 1: Preparing the webapp</h2>
141 <p> Here we assume that you have a web server up and running on the
142 localhost at port 8080. If your server is on a different port, replace
143 references to 8080 to your own port number. </p>
144 <p>In your Application Server installation, you should find a directory
145 into which web applications ("webapps") are to be placed. Into this
146 directory copy the webapps/axis directory from the xml-axis
147 distribution. You can actually name this directory anything you want,
148 just be aware that the name you choose will form the basis for the URL
149 by which clients will access your service. The rest of this document
150 assumes that the default webapp name, "axis" has been used; rename
151 these references if appropriate. <a name="depend"></a> </p>
152 <h2>Step 2: Setting up the libraries</h2>
153 <p>In the Axis directory, you will find a WEB-INF sub-directory. This
154 directory contains some basic configuration information, but can also
155 be used to contain the dependencies and web services you wish to deploy.</p>
156 <p> Axis needs to be able to find an XML parser. If your application
157 server or Java runtime does not make one visible to web applications,
158 you need to download and add it. Java 1.4 includes the Crimson parser,
159 so you <i>can</i> omit this stage, though the Axis team prefer Xerces.
160 </p>
161 <p> To add an XML parser, acquire the JAXP 1.1 XML compliant parser of
162 your choice. We recommend Xerces jars from the <a
163 href="http://xml.apache.org/dist/xerces-j/">xml-xerces distribution</a>,
164 though others mostly work. Unless your JRE or app server has its own
165 specific requirements, you can add the parser's libraries to
166 axis/WEB-INF/lib.&nbsp; The examples in this guide use Xerces.&nbsp;
167 This guide adds xml-apis.jar and xercesImpl.jar to the AXISCLASSPATH so
168 that Axis can find the parser (<a href="#Classpath_setup">see below</a>).<br>
169 </p>
170 <p>If you get ClassNotFound errors relating to Xerces or DOM then you
171 do not have an XML parser installed, or your CLASSPATH (or
172 AXISCLASSPATH) variables are not correctly configured.<br>
173 </p>
174 <h3>Tomcat 4.x and Java 1.4</h3>
175 Java 1.4 changed the rules as to to how packages beginning in java.*
176 and javax.* get loaded. Specifically, they only get loaded from <i>endorsed</i>
177 directories. jaxrpc.jar and saaj.jar contain javax packages, so they
178 may not get picked up. If happyaxis.jsp (see below) cannot find the
179 relevant packages, copy them from axis/WEB-INF/lib to
180 CATALINA_HOME/common/lib and restart Tomcat. <a name="start"></a>
181 <h3>WebLogic 8.1</h3>
182 WebLogic 8.1 ships with <code>webservices.jar</code> that conflicts with Axis'
183 <code>saaj.jar</code> and prevents Axis 1.4 from working right out of the box.
184 This conflict exists because WebLogic uses an older definition of
185 <code>javax.xml.soap.*</code> package from
186 <a href="http://java.sun.com/webservices/docs/1.0/api/javax/xml/soap">
187 Java Web Services Developer Pack Version 1.0</a>, whereas Axis uses a newer
188 revision from J2EE 1.4.
189 <p>
190 However, there are two alternative configuration changes that enable Axis based
191 web services to run on Weblogic 8.1.</p>
192 <ul>
193 <li>In a webapp containing Axis, set &lt;prefer-web-inf-classes&gt; element in
194 <code>WEB-INF/weblogic.xml</code> to true. An example of <code>weblogic.xml</code>
195 is shown below:
196 <pre>
197 &lt;weblogic-web-app&gt;
198 &lt;container-descriptor&gt;
199 &lt;prefer-web-inf-classes&gt;true&lt;/prefer-web-inf-classes&gt;
200 &lt;/container-descriptor&gt;
201 &lt;/weblogic-web-app&gt;
202 </pre>
203 <p>
204 If set to <code>true</code>, the <code>&lt;prefer-web-inf-classes&gt;</code>
205 element will force WebLogic's classloader to load classes located in the
206 WEB-INF directory of a web application in preference to application or system
207 classes. This is a recommended approach since it only impacts a single web module.</p>
208 </li>
209 <li>In a script used to start WebLogic server, modify <code>CLASSPATH</code>
210 property by placing Axis's <code>saaj.jar</code> library in front of WeLlogic's
211 <code>webservices.jar</code>. <b>NOTE:</b> This approach impacts all applications
212 deployed on a particular WebLogic instance and may prevent them from using
213 WebLogic's webservices.</li>
214 </ul>
215 <p>For more information on how WebLogic's class loader works, see
216 <a href="http://e-docs.bea.com/wls/docs81/programming/classloading.html">
217 WebLogic Server Application Classloading</a>.</p>
218 <h2>Step 3: starting the web server</h2>
219 <p>This varies on a product-by-product basis. In many cases it is as
220 simple as double clicking on a startup icon or running a command from
221 the command line.</p>
222 <a name="install-test"></a>
223 <h2>Step 4: Validate the Installation</h2>
224 <p> After installing the web application and dependencies, you should
225 make sure that the server is running the web application. </p>
226 <h3> Look for the start page </h3>
227 Navigate to the start page of the webapp, usually <a
228 href="http://127.0.0.1:8080/axis/">http://127.0.0.1:8080/axis/</a>,
229 though of course the port may differ.<br>
230 <br>
231 You should now see an Apache-Axis start page. If you do not, then the
232 webapp is not actually installed, or the appserver is not running.
233 <h3>Validate Axis with happyaxis</h3>
234 Follow the link <i> Validate the local installation's configuration</i><br>
235 This will bring you to <i>happyaxis.jsp</i> a test page that verifies
236 that needed and optional libraries are present. The URL for this will
237 be something like <a href="http://localhost:8080/axis/happyaxis.jsp">
238 http://localhost:8080/axis/happyaxis.jsp</a>
239 <p> If any of the needed libraries are missing, Axis will not work. <br>
240 <b>You must not proceed until all needed libraries can be found, and
241 this validation page is happy.</b> <br>
242 Optional components are optional; install them as your need arises. If
243 you see nothing but an internal server error and an exception trace,
244 then you probably have multiple XML parsers on the CLASSPATH (or
245 AXISCLASSPATH), and this
246 is causing version confusion. Eliminate the extra parsers, restart the
247 app server and try again. </p>
248 <h3>Look for some services</h3>
249 <p> From the start page, select <i>View the list of deployed Web
250 services</i>. This will list all registered Web Services, unless the
251 servlet is configured not to do so. On this page, You should be able to
252 click on <i>(wsdl)</i> for each deployed Web service to make sure that
253 your web service is up and running. </p>
254 <p> Note that the 'instant' JWS Web Services that Axis supports are not
255 listed in this listing here.&nbsp; The install guide covers this topic
256 in detail.<br>
257 </p>
258 <h3>Test a SOAP Endpoint</h3>
259 Now it's time to test a service. Although SOAP 1.1 uses HTTP POST to
260 submit an XML request to the <i>endpoint</i>, Axis also supports a
261 crude HTTP GET access mechanism, which is useful for testing. First
262 let's retrieve the version of Axis from the version endpoint, calling
263 the <code>getVersion</code> method:<br>
264 <br>
265 <a href="http://localhost:8080/axis/services/Version?method=getVersion">http://localhost:8080/axis/services/Version?method=getVersion
266 </a><br>
267 <br>
268 This should return something like:
269 <pre class="xml"> &lt;?xml version="1.0" encoding="UTF-8" ?&gt; <br> &lt;soapenv:Envelope <br> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" <br> xmlns:xsd="http://www.w3.org/2001/XMLSchema" <br> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;<br> &lt;soapenv:Body&gt;<br> &lt;getVersionResponse <br> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;<br> &lt;getVersionReturn <br> xsi:type="xsd:string"&gt;<br> Apache Axis version: 1.1 Built on Apr 04, 2003 (01:30:37 PST)<br> &lt;/getVersionReturn&gt; <br> &lt;/getVersionResponse&gt;<br> &lt;/soapenv:Body&gt;<br> &lt;/soapenv:Envelope&gt;<br></pre>
270 The Axis version and build date may of course be different.
271 <h3>Test a JWS Endpoint</h3>
272 Now let's test a JWS web service. Axis' JWS Web Services are java files
273 you save into the Axis webapp <i>anywhere but the WEB-INF tree</i>,
274 giving them the .jws extension. When someone requests the .jws file by
275 giving its URL, it is compiled and executed. The user guide covers JWS
276 pages in detail.
277 <p> To test the JWS service, we make a request against a built-in
278 example, EchoHeaders.jws (look for this in the axis/ directory). </p>
279 <p> Point your browser at <a
280 href="http://localhost:8080/axis/EchoHeaders.jws?method=list">
281 http://localhost:8080/axis/EchoHeaders.jws?method=list </a>.</p>
282 <p> This should return an XML listing of your application headers, such
283 as </p>
284 <pre class="xml">&lt;?xml version="1.0" encoding="UTF-8" ?&gt; <br>&lt;soapenv:Envelope <br> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" <br> xmlns:xsd="http://www.w3.org/2001/XMLSchema" <br> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;<br> &lt;soapenv:Body&gt;<br> &lt;listResponse <br> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;<br> &lt;listReturn xsi:type="soapenc:Array" <br> soapenc:arrayType="xsd:string[6]" <br> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt;<br> &lt;item&gt;accept:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*&lt;/item&gt; <br> &lt;item&gt;accept-language:en-us&lt;/item&gt; <br> &lt;item&gt;accept-encoding:gzip, deflate&lt;/item&gt; <br> &lt;item&gt;user-agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)&lt;/item&gt; <br> &lt;item&gt;host:localhost:8080&lt;/item&gt; <br> &lt;item&gt;connection:Keep-Alive&lt;/item&gt; <br> &lt;/listReturn&gt;<br> &lt;/listResponse&gt;<br> &lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;<br><br></pre>
285 Again, the exact return values will be different, and you may need to
286 change URLs to correct any host, port and webapp specifics. <a
287 name="websvc"></a>
288 <h2>Step 5: Installing new Web Services</h2>
289 <p>So far you have got Axis installed and working--now it is time to
290 add your own Web Service. </p>
291 <p> The process here boils down to (1) get the classes and libraries of
292 your new service into the Axis WAR directory tree, and (2) tell the
293 AxisEngine about the new file. The latter is done by submitting an XML
294 deployment descriptor to the service via the Admin web service, which
295 is usually done with the AdminClient program or the &lt;axis-admin&gt;
296 Ant task. Both of these do the same thing: they run the Axis SOAP
297 client to talk to the Axis adminstration service, which is a SOAP
298 service in its own right. It's also a special SOAP service in one
299 regard--it is restricted to local callers only (not remote access) and
300 is password protected to stop random people from administrating your
301 service. There is a default password that the client knows; if you
302 change it then you need to pass the new password to the client. </p>
303 <p> The first step is to add your code to the server. </p>
304 <p>In the WEB-INF directory, look for (or create) a "classes" directory
305 (i.e. axis/WEB-INF/classes ). In this directory, copy the compiled Java
306 classes you wish to install, being careful to preserve the directory
307 structure of the Java packages. </p>
308 <p>If your classes services are already packaged into JAR files, feel
309 free to drop them into the WEB-INF/lib directory instead. Also add any
310 third party libraries you depend on into the same directory.</p>
311 <p> After adding new classes or libraries to the Axis webapp, you must
312 restart the webapp. This can be done by restarting your application
313 server, or by using a server-specific mechanism to restart a specific
314 webapp. </p>
315 <p><span class="note">Note:</span> If your web service uses the simple
316 authorization handlers provided with xml-axis (this is actually <u>not</u>
317 recommended as these are merely illustrations of how to write a handler
318 than intended for production use), then you will need to copy the
319 corresponding users.lst file into the WEB-INF directory.</p>
320 <a name="deploy"></a>
321 <h2>Step 6: Deploying your Web Service</h2>
322 <p>The various classes and JARs you have just set up implement your new
323 Web Service. What remains to be done is to tell Axis how to expose this
324 web service. Axis takes a Web Service Deployment Descriptor (WSDD) file
325 that describes in XML what the service is, what methods it exports and
326 other aspects of the SOAP endpoint. </p>
327 <p> The users guide and reference guide cover these WSDD files; here we
328 are going to use one from the Axis samples: the stock quote service. </p>
329 <h3><a name="Classpath_setup"></a>Classpath setup</h3>
330 In order for these examples to work, java must be able to find
331 axis.jar, commons-discovery.jar, commons-logging.jar, jaxrpc.jar,
332 saaj.jar, log4j-1.2.8.jar (or whatever is appropriate for your chosen
333 logging implementation), and the XML parser jar file or files (e.g.,
334 xerces.jar).&nbsp; These examples do this by adding these files to
335 AXISCLASSPATH and then specifying the AXISCLASSPATH when you run them.
336 Also for these examples, we have copied the
337 xml-apis.jar and xercesImpl.jar files into the AXIS_LIB
338 directory.&nbsp; An
339 alternative would be to add your XML parser's jar file directly to the
340 AXISCLASSPATH variable or to add all these files to your CLASSPATH
341 variable.<br>
342 <br>
343 On Windows, this can be done via the following. For this document we
344 assume that you have installed Axis in C:\axis. To store this
345 information
346 permanently in WinNT/2000/XP you will need to right click on "My
347 Computer" and select "Properties". Click the "Advanced" tab and create
348 the new environmental variables.&nbsp; It is often better to use
349 WordPad to create the variable string and then paste it into the
350 appropriate text field.<br>
351 <pre class="xml"> set AXIS_HOME=c:\axis<br> set AXIS_LIB=%AXIS_HOME%\lib<br> set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;<br> %AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;<br> %AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar<br></pre>
352 Unix users have to do something similar. Below we have installed AXIS
353 into /usr/axis and are using the bash shell. See your shell's
354 documentation for differences. To make variables permenate you will
355 need to add them to your shell's startup (dot) files. Again, see your
356 shell's documentation.
357 <pre class="xml"> set AXIS_HOME=/usr/axis<br> set AXIS_LIB=$AXIS_HOME/lib<br> set AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:<br> $AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:<br> $AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar<br> export AXIS_HOME; export AXIS_LIB; export AXISCLASSPATH<br></pre>
358 To use Axis client code, you can select AXISCLASSPATH when
359 invoking Java by entering
360 <pre class="xml">java -cp %AXISCLASSPATH% ...</pre>
361 or
362 <pre class="xml">java -cp "$AXISCLASSPATH" ...</pre>
363 depending on the platform. You may omit the quotes if your CLASSPATH
364 doesn't have spaces in it.<br>
365 <br>
366 Also, it is probably a good time to add the AXISCLASSPATH variable to
367 your CLASSPATH variable.&nbsp; This will enable you to not include the
368 AXISCLASSPATH variable when launching the examples in this guide.&nbsp;
369 This document assumes that you have NOT done this.<br>
370 <h3>Find the deployment descriptor</h3>
371 <p> Look in axis/samples/stock for the file deploy.wsdd. This is the
372 deployment descriptor we want to tell Axis about. Deployment
373 descriptors are an Axis-specific XML file that tells Axis how to deploy
374 (or undeploy) a Web Service, and how to configure Axis itself. The Axis
375 Administration Web Service lets the AdminClient program and its Ant
376 task counterpart submit a new WSDD file for interpretation. The Axis
377 'engine' will update its configuration, then save its state. </p>
378 <p> By default Axis saves it state into the global configuration file
379 axis/WEB-INF/server-config.wsdd. Sometimes you see a warning message
380 about such a file not being found--don't worry about this, because Axis
381 auto-creates the file after you deploy something to it. You can check
382 in the webapp to see what this file looks like--and even copy it to
383 other systems if you want to give them identical configurations. Note
384 that Axis needs an expanded web application <i>and</i> write access to
385 the WEB-INF dir to save its state in this location. </p>
386 <h3>Run the admin client</h3>
387 Execute the following command from the samples/stock directory.&nbsp;
388 If you are not in this directory you will get a
389 "java.io.FileNotFoundException:
390 deploy.wsdd (The system cannot find the file specified)" exception.
391 <blockquote> <b>On Windows</b> <br>
392 <code class="java">java -cp %AXISCLASSPATH%
393 org.apache.axis.client.AdminClient
394 -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd<br>
395 </code>&nbsp;<b><br>
396 On UNIX</b> <br>
397 <code class="java">java -cp $AXISCLASSPATH
398 org.apache.axis.client.AdminClient <br>
399 -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd</code> </blockquote>
400 If you get some java client error (like ClassNotFoundException), then
401 you haven't set up your AXISCLASSPATH (or CLASSPATH) variable right,
402 mistyped the
403 classname, or did some other standard error. Tracking down such
404 problems are foundational Java development skills--if you don't know
405 how to do these things, learn them now!
406 <p><span class="note">Note:</span> You may need to replace localhost
407 with your host name, and 8080 with the port number used by your web
408 server. If you have renamed the web application to something other than
409 "axis" change the URL appropriately.</p>
410 <p> If you get some AxisFault listing, then the client is working, but
411 the deployment was unsuccessful. This is where the knowledge of the
412 sockets API to TCP and the basics of the HTTP that Web Service
413 development requires begins to be needed. If you got some socket error
414 like connection refused, the computer at the far end
415 isn't talking to you, so find the cause of that and fix it. If you get
416 an HTTP error code back find out what the error means and correct the
417 problem.&nbsp; These skills are fundamental to using web services.<br>
418 </p>
419 <p> The <a href="user-guide.html">user's guide</a> covers the
420 AdminClient in more detail, and there is also an <a
421 href="ant/axis-admin.html">Ant task</a> to automate the use of Axis in
422 your Ant build scripts. </p>
423 <a name="test"></a>
424 <h2>Step 7: Testing</h2>
425 <p>This step is optional, but highly recommended. For illustrative
426 purposes, it is presumed that you have installed and deployed the stock
427 quote demo.</p>
428 <ul>
429 <li> Change directory to the distribution directory for xml-axis and
430 execute the following command (or its Unix equivalent):
431 <blockquote> <b>On Windows</b> <code class="java"><br>
432 java -cp .;%AXISCLASSPATH% samples.stock.GetQuote <br>
433 -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX</code><br>
434 <br>
435 <span style="font-weight: bold;">On UNIX</span><br>
436 <code class="java">java -cp $AXISCLASSPATH samples.stock.GetQuote
437 <br>
438 -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX</code>&nbsp;<code
439 class="java"></code><br>
440 <br>
441 </blockquote>
442 </li>
443 <li>You should get back "55.25" as a result.</li>
444 </ul>
445 <p><span class="note">Note:</span> Again, you may need to replace
446 localhost with your host name, and 8080 with the port number used by
447 your web server. If you have renamed the web application to something
448 other than "axis" change the URL appropriately. </p>
449 <a name="advanced"></a>
450 <h2>Advanced Installation: adding Axis to your own Webapp</h2>
451 If you are experienced in web application development, and especially
452 if you wish to add web services to an existing or complex webapp, you
453 can take an alternate approach to running Axis. Instead of adding your
454 classes to the Axis webapp, you can add Axis to your application.
455 <p> The core concepts are </p>
456 <ol>
457 <li>Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other
458 dependent libraries to your WAR file. </li>
459 <li>Copy all the Axis Servlet declarations and mappings from
460 axis/WEB-INF/web.xml and add them to your own web.xml </li>
461 <li>Build and deploy your webapp. </li>
462 <li>Run the Axis AdminClient against your own webapp, instead of
463 Axis, by changing the URL you invoke it with. </li>
464 </ol>
465 The process is also covered in Chapter 15 of <a
466 href="http://manning.com/antbook">Java Development with Ant</a>, which
467 can be downloaded as a <a
468 href="http://www.manning.com/hatcher/chap15.pdf">PDF file</a>. <a
469 name="broken"></a>
470 <h2>What if it doesn't work?</h2>
471 Axis is a complicated system to install. This is because it depends on
472 the underlying functionality of your app server, has a fairly complex
473 configuration, and, like all distributed applications, depends upon the
474 network too.
475 <p> We see a lot of people posting their problems on the axis-user
476 mailing list, and other Axis users as well as the Axis developers do
477 their best to help when they can. But before you rush to post your own
478 problems to the mailing list, a word of caution: </p>
479 <p> Axis is free. This means nobody gets paid to man the support lines.
480 All the help you get from the community is voluntary and comes from the
481 kindness of their hearts. They may be other users, willing to help you
482 get past the same hurdles they had to be helped over, or they may be
483 the developers themselves. But it is all voluntary, so you may need to
484 keep your expectations low! </p>
485 <ol>
486 <li>Post to the <a href="mailto:[email protected]">user mail</a>
487 list, not the developer list. You may think the developer mail list is
488 a short cut to higher quality answers. But the developers are also on
489 the user list along with many other skilled users--so more people will
490 be able to answer your questions. Also, it is helpful for all user
491 issues to be on one list to help build the searchable mailing list
492 archive. </li>
493 <li> Don't ask non-Axis-related questions. The list is not the place
494 to ask about non-Axis, non-SOAP, problems. Even questions about the MS
495 Soap toolkit or .NET client side, don't get many positive answers--we
496 avoid them. That also goes for the Sun Java Web Services Developer
497 Pack, or the Jboss.net stuff that they've done with Axis. </li>
498 <li>Never bother posting to the soapbuilders mailing list either,
499 that is only for people developing SOAP toolkits, not using them--all
500 off-topic messages are pointedly ignored. </li>
501 <li> There is no guarantee that anyone will be able to solve your
502 problem. The usual response in such a situation is silence, for a good
503 reason: if everybody who didn't know the answer to a question said "I
504 don't know", the list would be overflowed with noise. Don't take
505 silence personally. </li>
506 <li> Never expect an immediate answer. Even if someone knows the
507 answer, it can take a day or two before they read their mail. So if you
508 don't get an answer in an hour or two, don't panic and resend. Be
509 patient. And put the time to use by trying to solve your problems
510 yourself. </li>
511 <li> Do your homework first. This document lists the foundational
512 stuff you need to understand. It has also warned you that it can take a
513 day to get a reply. Now imagine you get a HTTP Error '404' on a SOAP
514 call. Should you rush to post a 'help' request, or should you try and
515 find out what an HTTP error code is, what #404 usually means and how to
516 use a Java debugger. We provide the source to make that debugging
517 easier :) </li>
518 <li> Post meaningful subject lines. You want your message read, not
519 deleted unread. A subject line of 'Axis problem', 'Help with Axis',
520 etc. is not meaningful, and is not likely to get many readers. </li>
521 <li> Search the <a
522 href="http://nagoya.apache.org/eyebrowse/SummarizeList?listId=49">
523 mailing list archives</a> FIRST to see if someone had the same problem.
524 This list is searchable--and may save you much time in getting an
525 answer to your problem. </li>
526 <li> Use the <a href="http://nagoya.apache.org/bugzilla/">bugzilla</a>
527 database to search for Axis bugs, both open and closed. </li>
528 <li> Consult the <a
529 href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages">
530 Axis Wiki</a> For its Frequently Asked Questions (FAQ), installation
531 notes, interoperability issues lists, and other useful information. </li>
532 <li> Don't email people for help directly, unless you know them. It's
533 rude and presumptious. Messages sent over the mail list benefit the
534 whole community--both the original posters and people who search the
535 list. Personal messages just take up the recipients time, and are
536 unwelcome. Usually, if not ignored outright, recipients of personal
537 requests will just respond 'ask the mail list' anyway! </li>
538 <li> Know that configuration problems are hard to replicate, and so
539 can be difficult to get help on. We have tried with the happyaxis.jsp
540 demo to automate the diagnostics gathering for you, but it can be hard
541 for people to be of help here, especially for obscure platforms. </li>
542 <li> Keep up to date with Axis releases, even the beta copies of
543 forthcoming releases. You wouldn't want your problem to be a bug that
544 was already known and fixed in a more recent release. Often the common
545 response to any question is 'have you tried the latest release'. </li>
546 <li> Study and use the source, and fix it when you find defects. Even
547 fix the documentation when you find defects. It is only through the
548 participation of Axis' users that it will ever get better. </li>
549 </ol>
550 Has this put you off joining and participating in the Axis user mail
551 list? We hope not--this list belongs to the people who use Axis and so
552 will be your peers as your project proceeds. We just need for you to be
553 aware that it is not a 24x7 support line for people new to server side
554 Java development, and that you will need to be somewhat self sufficient
555 in this regard. It is not a silver bullet. However, knowing how to make
556 effective use of the list will help you develop better with Axis. <a
557 name="summary"></a>
558 <h2>Summary</h2>
559 Axis is simply an implementation of SOAP which can be added to your own
560 webapp, and a webapp which can host your own web services. Installing
561 it can be a bit fiddly, especially given Java 1.4's stricter
562 requirements. If you follow a methodical process, including testing
563 along the way, using happyaxis and the bundled test services, you will
564 find it easier to get started with Axis.
565 <h2> <a NAME="soapmon"></a>Appendix: Enabling the SOAP Monitor </h2>
566 <p>
567 SOAP Monitor allows for the monitoring of SOAP requests and responses via
568 a web browser with Java plug-in 1.3 or higher. For a more comprehensive
569 explanation of its usage, read <a href="user-guide.html#soapmon">Using the
570 SOAP Monitor</a> in the User's Guide.
571 </p><p>
572 By default, the SOAP Monitor is not enabled. The basic steps for enabling
573 it are compiling the SOAP Monitor java applet, deploying the SOAP Monitor
574 web service and adding request and response flow definitions for each monitored
575 web service. In more detail:
576 <ol>
577 <li> Go to $AXIS_HOME/webapps/axis (or %AXIS_HOME%\webapps\axis)
578 and compile SOAPMonitorApplet.java.
579 <blockquote> <span style="font-weight: bold;">On Windows</span>
580 <code class="java"><br/>
581 javac -classpath %AXIS_HOME%\lib\axis.jar SOAPMonitorApplet.java</code><br/>
582 <br/>
583 <span style="font-weight: bold;">On Unix</span>
584 <code class="java"><br/>
585 javac -classpath $AXIS_HOME/lib/axis.jar SOAPMonitorApplet.java</code><br/>
586 </blockquote>
587 Copy all resulting class files (i.e. SOAPMonitorApplet*.class) to the root
588 directory of the web application using the SOAP Monitor
589 (e.g. .../tomcat/webapps/axis)
590 </li>
591 <li> Deploy the SOAPMonitorService web service with the admin client and the
592 deploy-monitor.wsdd file (shown below).
593 <blockquote>Go to the directory deploy-monitor.wsdd is located and execute
594 the command below. The command assume that /axis is the intended
595 web application and it is available on port 8080.<br/>
596 <b>On Windows</b> <br/>
597 <code class="java">java -cp %AXISCLASSPATH%
598 org.apache.axis.client.AdminClient
599 -lhttp://localhost:8080/axis/services/AdminService deploy-monitor.wsdd<br/>
600 </code>&nbsp;<b><br/>
601 On UNIX</b> <br/>
602 <code class="java">java -cp $AXISCLASSPATH
603 org.apache.axis.client.AdminClient <br/>
604 -lhttp://localhost:8080/axis/services/AdminService deploy-monitor.wsdd</code> </blockquote>
605 <span style="font-weight: bold;">SOAPMonitorService Deployment Descriptor (deploy-monitor.wsdd)</span>
606 <pre class="xml">&lt;deployment xmlns=&quot;http://xml.apache.org/axis/wsdd/&quot;
607 xmlns:java=&quot;http://xml.apache.org/axis/wsdd/providers/java&quot;&gt;
608 &lt;handler name=&quot;soapmonitor&quot;
609 type=&quot;java:org.apache.axis.handlers.SOAPMonitorHandler&quot;&gt;
610 &lt;parameter name=&quot;wsdlURL&quot;
611 value=&quot;/axis/SOAPMonitorService-impl.wsdl&quot;/&gt;
612 &lt;parameter name=&quot;namespace&quot;
613 value=&quot;http://tempuri.org/wsdl/2001/12/SOAPMonitorService-impl.wsdl&quot;/&gt;
614 &lt;parameter name=&quot;serviceName&quot; value=&quot;SOAPMonitorService&quot;/&gt;
615 &lt;parameter name=&quot;portName&quot; value=&quot;Demo&quot;/&gt;
616 &lt;/handler&gt;
617 &lt;service name=&quot;SOAPMonitorService&quot; provider=&quot;java:RPC&quot;&gt;
618 &lt;parameter name=&quot;allowedMethods&quot; value=&quot;publishMessage&quot;/&gt;
619 &lt;parameter name=&quot;className&quot;
620 value=&quot;org.apache.axis.monitor.SOAPMonitorService&quot;/&gt;
621 &lt;parameter name=&quot;scope&quot; value=&quot;Application&quot;/&gt;
622 &lt;/service&gt;
623 &lt;/deployment&gt;
624 </pre>
625 </li>
626 <li>For each service that is to be monitored, add request and response flow definitions
627 to the service's deployment descriptor and deploy (or redeploy) the service. The
628 <span style="font-weight: bold;">requestFlow</span> and <span style="font-weight: bold;">
629 responseFlow</span> definitions follow the start tag of the <span style="font-weight: bold;">
630 &lt;service&gt;</span> element. If a service is already deployed, undeploy it and deploy
631 it with the modified deployment descriptor. An example is shown below:
632 <pre class="xml">...
633 &lt;service name=&quot;xmltoday-delayed-quotes&quot; provider=&quot;java:RPC&quot;&gt;
634 &lt;requestFlow&gt;
635 &lt;handler type=&quot;soapmonitor&quot;/&gt;
636 &lt;/requestFlow&gt;
637 &lt;responseFlow&gt;
638 &lt;handler type=&quot;soapmonitor&quot;/&gt;
639 &lt;/responseFlow&gt;
640 ...</pre>
641 </li>
642 <li>With a web browser, go to http[s]://host[:port][/webapp]/SOAPMonitor
643 (e.g. http://localhost:8080/axis/SOAPMonitor) substituting the correct values
644 for your web application. This will show the SOAP Monitor applet for viewing service
645 requests and responses. Any requests to services that have been configured
646 and deployed correctly should show up in the applet.
647 </li>
648 <ol>
649 </p>
650 <hr size="1" noshade="noshade">
651 <div class="copyright" align="center">Copyright &copy; 2001-2003,
652 Apache Software Foundation</div>
653 </body>
654 </html>