Repository navigation
Expand file tree
/
Copy pathuserguide.html
More file actions
363 lines (313 loc) · 14.3 KB
/
Copy pathuserguide.html
File metadata and controls
363 lines (313 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<?xml version="1.0" encoding=""?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="" />
<title>Apache Axis2 User's Guide- Introducing Axis2</title>
<link href="../css/axis-docs.css" rel="stylesheet" type="text/css"
media="all" />
</head>
<body xml:lang="en" lang="en">
<h1>Apache Axis2 User's Guide</h1>
<p>This guide provides a starting place for users new to Apache Axis2. It
also provides information for more experienced users, such as how to use
Axis2 to create and deploy Web services as well as how to use WSDL to
generate both clients and services.</p>
For more experienced users of Apache Axis2, we would recommend you start with
the <a href="adv-userguide.html">Advance User's Guide.</a> <a
name="intro"></a>
<h1>- Introducing Axis2</h1>
<p>This section introduces Axis2 and its structure, including an explanation
of various directories/files included in the latest Axis2 <a
href="http://ws.apache.org/axis2/download.cgi">download</a>.</p>
<h2>Content</h2>
<ul>
<li><a href="userguide.html#intro"><strong>Introducing
Axis2</strong></a><br />
<ul>
<li><a href="userguide.html#whatis"><strong>What is
Axis2?</strong></a></li>
<li><a href="userguide.html#underhood"><strong>What's under the
hood?</strong></a></li>
<li><a href="userguide.html#handlessoap"><strong>How Axis2 handles SOAP
messages</strong></a></li>
<li><a href="userguide.html#distributions"><strong>Axis2
distributions</strong></a></li>
<li><a href="userguide.html#sbd"><strong>The Axis2 Standard Binary
Distribution</strong></a></li>
<li><a href="userguide.html#hierarchy"><strong>Axis2.war Directory
hierarchy</strong></a></li>
<li><a href="userguide.html#docs"><strong>Axis2 Documents
Distribution</strong></a></li>
<li><a href="userguide.html#clients"><strong>Axis2 and
clients</strong></a></li>
</ul>
</li>
<li><a href="userguide-installingtesting.html#installingtesting">Installing
and testing client code</a></li>
<li><a href="userguide-introtoservices.html#introservices">Introduction to
Services</a><br />
<ul>
<li><a href="userguide-introtoservices.html#messageexchange">Message
Exchange Patterns</a></li>
</ul>
</li>
<li><a href="userguide-creatingclients.html#createclients">Creating
Clients</a><br />
<ul>
<li><a href="userguide-creatingclients.html#choosingclient">Choosing a
Client Generation Method</a></li>
<li><a href="userguide-creatingclients.html#generating">Generating
Clients</a></li>
<li><a href="userguide-creatingclients.html#adb">Axis Data Binding
(ADB)</a></li>
</ul>
</li>
<li><a href="userguide-buildingservices.html#buildservices">Building
Services</a><br />
<ul>
<li><a href="userguide-buildingservices.html#getcomfortable">Getting
Comfortable with Available Options</a></li>
<li><a href="userguide-buildingservices.html#createscratch">Creating a
service from scratch</a></li>
<li><a href="userguide-buildingservices.html#deploypojo">Deploying
Plain Old Java Objects</a></li>
<li><a href="userguide-buildingservices.html#deployrun">Deploying and
running an Axis2 service created from WSDL</a></li>
</ul>
</li>
<li><a href="userguide-samples.html">Samples</a></li>
<li><a href="userguide-forfurtherstudy.html">For Further Study</a></li>
</ul>
<a name="whatis"></a>
<h2>What is Axis2?</h2>
<p>The Apache Axis2 project is a Java-based implementation of both the client
and server sides of the Web services equation. Designed to take advantage of
the lessons learned from Apache Axis 1.0, Apache Axis2 provides a complete
object model and a modular architecture that makes its straight forward to
add functionality and support for new Web services-related specifications and
recommendations.</p>
<p>Axis2 enables you to easily perform the following tasks:</p>
<ul>
<li>Send SOAP messages</li>
<li>Receive and process SOAP messages</li>
<li>Create a Web service out of a plain Java class</li>
<li>Create implementation classes for both server and client using WSDL</li>
<li>Easily retrieve the WSDL for a service</li>
<li>Send and receive SOAP messages with attachments</li>
<li>Create or utilize a REST-based Web service</li>
<li>Create or utilize services that take advantage of the <a
href="http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf">WS-Security</a>,
<a
href="http://xml.coverpages.org/ws-reliablemessaging20030313.pdf">WS-ReliableMessaging</a>,
<a href="http://www.w3.org/2002/ws/addr/">WS-Addressing</a>, <a
href="http://dev2dev.bea.com/pub/a/2004/03/ws-coordination.html">WS-Coordination</a>,
and <a
href="ftp://www6.software.ibm.com/software/developer/library/WS-AtomicTransaction.pdf">WS-Atomic
Transaction</a> recommendations</li>
<li>Use Axis2's modular structure to easily add support for new
recommendations as they emerge</li>
</ul>
<p>Many more features exist as well, but this user guide concentrates on
showing you how to accomplish the first five tasks on this list.</p>
<a name="underhood"></a>
<h2>What's Under the Hood?</h2>
<p>To understand Axis2 and what it does, you must have a good idea of the
life cycle of a Web services message. Typically, it looks something like
this:</p>
<p><img alt="Lifecycle of a Web services message" src="images/fig01.jpg"
/><br clear="all" />
</p>
<p>The sending application creates the original SOAP message, an XML message
that consists of headers and a body. (For more information on SOAP, see "<a
href="userguide-introtoservices.html">Introduction to Services</a>".) If the
system requires the use of WS* recommendations such as WS-Addressing or
WS-Security, the message may undergo additional processing before it leaves
the sender. Once the message itself is ready, it is sent via a particular
transport such as HTTP, JMS, and so on.</p>
<p>The message works its way over to the receiver, which takes in the message
via the transport listener. (In other words, if the application doesn't have
an HTTP listener running, it's not going to receive any HTTP messages.)
Again, if the message is part of a system that requires the use of
WS-Security or other recommendations, it may need additional processing for
the purpose of checking credentials or decrypting sensitive information.
Finally, a dispatcher determines the specific application (or other
component, such as a Java method) for which the message was intended, and
sends it to that component. That component is part of an overall application
designed to work with the data being sent back and forth.</p>
<a name="handlessoap"></a>
<h2>How Axis2 Handles SOAP Messages</h2>
<p>Axis2 can handle processing for both the sender and the receiver in a
transaction. From the Axis2 perspective, the structure looks like this:</p>
<p><img alt="Axis2 handles SOAP messages" src="images/fig02.jpg" /><br
clear="all" />
</p>
<p>On each end, you have an application designed to deal with the (sent or
received) messages. In the middle, you have Axis2. Or rather, you CAN have
Axis2. The value of Web services is that the sender and receiver (each of
which can be either the server or the client) don't even have to be on the
same platform, much less running the same application. But assuming that
Axis2 is running on both sides, the process looks like this:</p>
<ul>
<li>The sender creates the SOAP message.</li>
<li>Axis "handlers" perform any necessary actions on that message such as
encryption of WS-Security related messages.</li>
<li>The Transport sender sends the message.</li>
<li>On the receiving end, the transport listener detects the message.</li>
<li>The transport listener passes the message on to any handlers on the
receiving side.</li>
<li>Once the message has been processed in the "pre-dispatch" phase, it is
handed off to the dispatchers, which pass it on to the appropriate
application.</li>
</ul>
<p>In Axis2, these actions are broken down into "phases", with several
pre-defined phases such as the "pre-dispatch", "dispatch," and "message
processing" being built into Axis2. Each phase is a collection of "handlers".
Axis2 enables you to control what handlers go into which phases, and the
order in which handlers are executed within phases. You can also add your own
phases and handlers.</p>
<p>Handlers come from "modules" that can be plugged into a running Axis2
system. These modules, such as Rampart, which provides an implementation of
WS-Security, and Sandesha, which provides an implementation of
WS-ReliableMessaging, are the main extensibility mechanism in Axis2.</p>
<a name="distributions"></a>
<h2>Axis2 Distributions</h2>
<p>Axis2 is released in several <a
href="http://ws.apache.org/axis2/download/1_1_1/download.cgi">distributions</a>.
Which one you need depends on what you'll be doing with it.</p>
<a name="sbd"></a>
<h3>The Axis2 Standard Binary Distribution</h3>
<p>If you're developing services and applications, you'll need the Axis2 <a
href="http://ws.apache.org/axis2/download/1_1_1/download.cgi#std-bin">Standard
Binary Distribution</a>. The distribution includes all of the necessary *.jar
files, as well as a variety of scripts that ease development. It has the
following structure:</p>
<p><b>Code Listing 1: Axis2 Standard Binary Distribution</b></p>
<pre>bin
axis2.bat
axis2.sh
axis2server.bat
axis2server.sh
java2wsdl.bat
java2wsdl.sh
wsdl2java.bat
wsdl2java.sh
setenv.sh
lib
activation-1.1.jar
...
XmlSchema.jar
repository
modules
modules.list
addressing-1.1.1.mar
..
services
services.list
version.aar
..
samples
...
webapp
...
conf
axis2.xml
LICENSE.txt
README.txt
NOTICE.txt
INSTALL.txt
release-notes.html</pre>
<p>The bin directory includes a number of useful scripts, including axis2.bat
(or axis2.sh), which enables you to easily execute a Java command without
having to manually add all of the Axis2 jar files to the classpath,
java2wsdl.bat (and .sh) and wsdl2java.bat (and .sh), which enables you to
easily generate Java code from a WSDL file and vice versa, and
axis2server.bat (and sh), a simple Web server that enables you to build
Axis2's capability to send and receive messages into your own application.</p>
<p>As expected, the lib directory includes all of the necessary jar files.
Services and modules are added to the repository directory. Axis2 comes with
a standard module implementing WS-Addressing, and you can add any other
necessary modules such as Rampart to the repository/modules directory.</p>
<p>conf directory includes the axis2.xml which is the global deployment
descriptor.</p>
<p>Finally, the samples directory includes all of the sample code distributed
with Axis2. You can find a list of the samples and their descriptions <a
href="userguide-samples.html">here</a>.</p>
<a name="hierarchy"></a>
<h2>axis2.war Distribution Directory Hierarchy</h2>
<p>axis2.war is available in <a
href="http://ws.apache.org/axis2/download/1_1_1/download.cgi#war">WAR (Web
Archive) Distribution</a>. The server side of Axis2 ships as a J2EE
application, and has the following structure shown in Code Listing 2.</p>
<p><b>Code Listing 2: Server Side of Axis2</b></p>
<pre>axis2-web
META-INF
WEB-INF
classes
conf
axis2.xml
lib
activation.jar
...
xmlSchema.jar
modules
modules.list
addressing.mar
...
soapmonitor.mar
services
services.list
aservice.aar
...
version.aar
web.xml</pre>
<p>Starting at the top, axis2-web is a collection of JSPs that make up the <a
href="webadminguide.html">Axis2 administration application</a>, through which
you can perform any needed actions such as adding services and engaging and
dis-engaging modules. The WEB-INF directory represents the actual Axis2
application, including all of the *.jar files, any included modules, and even
the deployed services themselves.</p>
<p>The classes directory holds any classes or properties files that are
needed by Axis2 itself, such as log4j.properties. Any actual services to be
handled by the system reside in the services directory in the form of an axis
archive, or *.aar file. This file contains any classes related to the
service, as well as the services.xml file, which controls any additional
requirements, such as the definition of message senders and message
receivers.</p>
<p>But the main file in all this it is axis2.xml, which controls how the
application deals with received messages. It defines message receivers and
transport receivers, as well as defining transport senders and determining
which modules are active. It also defines the order of phases, and the
handlers to be executed within each phase.</p>
<p>You can control all of this information through the use of the Web
application, but if you restart the Axis2 application, these changes are lost
and the server goes back to the definitions in the axis2.xml file.</p>
<p>Axis2 also provides a third distribution, the <a
href="http://ws.apache.org/axis2/download/1_1_1/download.cgi#src">source
distribution</a>, which enables you to generate this war file yourself.</p>
<a id="docs"></a>
<h2>Axis2 Documentation Distribution Directory Hierarchy</h2>
<p>The Documents distribution includes all Axis2 documentation including the
xdcos and javadocs. It has the following structure:</p>
<p><b>Code Listing 3: Axis2 Documents Distribution</b></p>
<pre>docs
javadocs
xdocs
LICENSE.txt
README.txt
release-notes.html</pre>
<p>The javadocs directory includes all of the standard <a
href="../../javadocs/index.html">API documentation</a> for the Axis2 API,
with more conversational documentation (like this document) in the xdocs
directory.</p>
<a name="clients"></a>
<h2>Axis2 and Clients</h2>
<p>Now that explains how Axis2 behaves as part of a Web application, but what
about a standalone client that is not part of a J2EE application? In that
case, a sender can use the Axis2 default properties, in other words, no
special handlers, and so on. But you also have the option to tell the client
to load its own copy of the axis2.xml file and behave accordingly.</p>
<p><strong>See Next Section</strong> - <a
href="userguide-installingtesting.html#installingtesting">Installing and
Testing Client Code</a></p>
</body>
</html>