Return-Path:
Alpha 1 VersionAxis User's Guide
Table of Contents
@@ -67,8 +68,7 @@
"axis-dev@xml.apache.org"
This release contains:
You'll note the param is now named "testParam" as expected.
-OK - so now you know how to access SOAP services as a client. But how do you - publish your own services?
+OK - so now you know the basics of accessing SOAP services as a client. But + how do you publish your own services?
Let's say we have a simple class like the following:
public class Calculator { @@ -214,14 +214,75 @@ Got result : 1 %
JWS files are great quick ways to get your classes out there as Web Services, + but they're not always the best choice. For one thing, you need the source code + - there might be times when you want to expose a pre-existing class on your + system without source. Also, the amount of configuration you can do as to how + the service gets accessed is pretty limited - you can't specify custom type + mappings, or control which Handlers get invoked when people are using your service.
+<admin:deploy xmlns:admin="AdminService"> + <service name="MyService" pivot="RPCDispatcher"> + <option name="classname" value="MyService"/> + <option name="methods" value="*"/> + </service> +</admin:deploy>+
Pretty simple, really - the outermost element tells the engine that this is + a deployment (other options are "undeploy" and "list" - + see the deployment reference). Then we deploy a service
+Now let's start to explore some of the more powerful features of the Axis engine. + Let's say you want to track how many times your service has been called, and + by whom.
+<admin:deploy xmlns:admin="AdminService"> + <!-- define the logging handler configuration --> + <handler name="track" class="org.apache.axis.handlers.LogHandler"> + <option name="filename" value="MyService.log"/> + </handler> + + <!-- define the service, using the log handler we just defined --> + <service name="MyService" request="track" pivot="RPCDispatcher"> + </service> +</admin:deploy>+
Note that by default, the Axis server is configured to only accept administration + requests from the machine on which it resides - if you wish to enable remote + administration, you must set the "enableRemoteAdmin" property of the + AdminService to true. To do this, find the "server-config.xml" + file in your webapp's WEB-INF directory. In it, you'll see a deployment for + the AdminService. Add an option as follows:
+<service name="AdminService" pivot="RPCDispatcher"> + <option name="className" value="org.apache.axis.util.Admin"/> + <option name="methodName" value="*"/> + <option name="enableRemoteAdmin" value="true"/> +</service>+
WARNING: enabling remote administration may give unauthorized parties access
+ to your machine. If you do this, please make sure to add security to your configuration!
+
TBD - how to use bean mappings
+Axis includes the ability to serialize arbitrary Java classes which follow + the standard JavaBean pattern of get/set accessors. All you need to do is tell + Axis which Java classes map to which XML Schema types. Configuring a bean mapping + looks like this:
+<beanMapping>
+Let's take a look at how this works. Go look at the docs/examples/example4/BeanService.java + file. (we won't reproduce it here, it's pretty basic) The key thing to notice + is that the argument to the service method is an Order object. Since Order is + not a basic type which Axis understands by default, trying to run the service + without a type mapping will result in a fault (if you want to try this for yourself, + you can use the simple-deploy.xml file in the example4 directory). But if we + put a beanMapping into our deployment, all will be well.
Just as JWS deployment is sometimes not flexible enough to meet all needs, + the default bean serialization model isn't robust enough to handle every case + either. At times there will be non-bean Java classes (especially in the case + of pre-existing assets) which you need to map to/from XML, and there also may + be some custom XML schema types which you want to map into Java in particular + ways. Axis gives you the ability to write custom serializers/deserializers, + and some tools to help make your life easier when you do so.
+TBD - this section will be expanded in a future version! + For now, take a look at the ArraySerializer, the BeanSerializer (both in org.apache.axis.encoding), + and the DataSer example (in samples/encoding) to see how custom serializers + work.