Return-Path:
(Skip this section if you want to dive right in - in many cases using the basic
features of Axis requires zero knowledge of these topics.) TBD - explanation of Axis architecture, Handlers,
- Chains, Services... How transports and global chains work, our deployment architecture,
- etc... Axis consists of several subsystems working together. In this section we'll
+ give you an overview of how the package works, but for more details please see
+ the Axis Architecture Guide, a separate document. Put simply, Axis is all about processing Messages. When the central Axis processing
+ logic runs, the There are two basic ways which Axis is invoked: In either case, the Axis framework's job is simply to pass the resulting MessageContext
+ through a configurable set of Handlers, each of which has an opportunity to
+ do whatever it is designed to do with the MessageContext. SOAP is an XML protocol, and as such... Central classes include DeserializationContext, Let's take a look at an example Web Service client that will call the echoString
@@ -360,14 +378,16 @@
what happens. You can also use the AdminClient to get a listing of all the deployed
components in the server: In there you'll see services, handlers, transports... In there you'll see services, handlers, transports, etc. Note that this listing
+ is an exact copy of the server's "server-config.wsdd" file, which
+ we'll talk about in more detail a little later. 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. We've
included a sample handler in the samples/log directory to do just this. To use
a handler class like this, you first need to deploy the Handler itself, and
then use the name that you give it in deploying a service. Here's a sample deploy.wsdd
- file: Axis Architecture - a Brief Primer
Handlers and the Message Path in Axis
+
+
+From XML to Objects and Back Again - Parsing and Encoding
+The Axis SAX Framework
+Consuming Web Services with Axis
Basics - Getting Started
% java org.apache.axis.client.AdminClient list
-
<big XML document returned here>More deployment - Handlers and Chains
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> @@ -390,11 +410,11 @@ class samples.log.LogHandler. We give this Handler an option to let it know which file to write its messages into.Then we define a service, MyService, which is an RPC service just like we saw - above in our first example. The difference is the "requestFlow" element inside - the <service> - this indicates a set of Handlers that should be invoked - when the service is invoked, before the provider. By inserting a reference to - "track", we ensure that the message will be logged each time this service is - invoked.
+ above in our first example. The difference is the <requestFlow> element + inside the <service> - this indicates a set of Handlers that should be + invoked when the service is invoked, before the provider. By inserting a reference + to "track", we ensure that the message will be logged each time this service + is invoked.
Remote Administration
Note that by default, the Axis server is configured to only accept administration @@ -417,23 +437,22 @@ 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:
-<beanMappings> - <ns:local xmlns:ns="someNamespace" classname="my.java.thingy"/> -</beanMappings>-Inside the <beanMappings> element is an arbitrary number of other elements, - each of which maps a Java class (presumably a bean) to an XML QName. The QName - of the element itself is the XML QName, and the value of the classname attribute - is the Java class name. So in this case, we'd be mapping the "my.java.thingy" - class to the XML QName [someNamespace]:[local].
+<beanMapping qname="ns:local" xmlns:ns="someNamespace" + languageSpecificType="java:my.java.thingy"/> ++The <beanMapping> tag maps a Java class (presumably a bean) to an XML + QName. You'll note that it has two important attributes, qname and languageSpecificType. + So in this case, we'd be mapping the "my.java.thingy" class to the XML QName + [someNamespace]:[local].
Let's take a look at how this works in practice. Go look at the samples/userguide/example5/BeanService.java file. (we won't reproduce it here, it's pretty straightforward) 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 this service without a type mapping will result in a fault (if you want to try this - for yourself, you can use the bad-deploy.xml file in the example4 directory). + for yourself, you can use the bad-deploy.wsdd file in the example5 directory). But if we put a beanMapping into our deployment, all will be well. Here's how - to run this example (from the example4 directory):
-% java org.apache.axis.client.AdminClient -llocal:// deploy.xml + to run this example (from the example5 directory): +% java org.apache.axis.client.AdminClient -llocal:///AdminService deploy.wsdd <Admin>Done processing</Admin> % java Client -llocal:// -n "Glen" @@ -458,7 +477,25 @@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.
+ work. +Deploying custom mappings - the <typeMapping> tag
+Now that you've built your serializers and deserializers, you need to tell + Axis which types they should be used for. You do this with a typeMapping tag + in WSDD, which looks like this:
+<typeMapping qname="ns:local" xmlns:ns="someNamespace" + languageSpecificType="java:my.java.thingy" + serializer="" + deserializer=""/>+This looks a lot like the <beanMapping> tag we saw earlier, but there + are two extra attributes. One, serializer, is the Java class name of + the Serializer class which should be used to write the specified Java class + (i.e. my.java.thingy) into XML. The other, deserializer, is the class + name of a Deserializer factory that generates Deserializers which can + be used to unmarshall XML into the correct Java class.
+(the <beanMapping> tag is really just shorthand for a <typeMapping> + tag with serializer="org.apache.axis.encoding.BeanSerializer" and + deserializer="org.apache.axis.encoding.BeanSerializer$BeanSerFactory", + but clearly it can save a lot of typing!)
Using WSDL with Axis
The Web Service Description Language is a specification authored by IBM and Microsoft, and supported by many other 1.20 +0 -1 xml-axis/java/samples/transport/FileTest.java Index: FileTest.java =================================================================== RCS file: /home/cvs/xml-axis/java/samples/transport/FileTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- FileTest.java 2001/11/15 19:48:42 1.19 +++ FileTest.java 2001/11/26 02:21:38 1.20 @@ -6,7 +6,6 @@ import org.apache.axis.client.Service; import org.apache.axis.client.Transport; import org.apache.axis.encoding.XMLType; -import org.apache.axis.suppliers.TransportSupplier; import org.apache.axis.utils.Options; /** Tests the simple File transport. To run: 1.56 +0 -2 xml-axis/java/src/org/apache/axis/AxisEngine.java Index: AxisEngine.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- AxisEngine.java 2001/11/26 00:58:34 1.55 +++ AxisEngine.java 2001/11/26 02:21:38 1.56 @@ -64,8 +64,6 @@ import org.apache.axis.encoding.TypeMappingRegistry; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.handlers.soap.SOAPService; -import org.apache.axis.registries.HandlerRegistry; -import org.apache.axis.registries.SupplierRegistry; import org.apache.axis.session.Session; import org.apache.axis.session.SimpleSession; import org.apache.axis.utils.JavaUtils; 1.28 +0 -1 xml-axis/java/src/org/apache/axis/FaultableHandler.java Index: FaultableHandler.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/FaultableHandler.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- FaultableHandler.java 2001/11/06 14:09:07 1.27 +++ FaultableHandler.java 2001/11/26 02:21:38 1.28 @@ -56,7 +56,6 @@ package org.apache.axis ; import org.apache.axis.handlers.BasicHandler; -import org.apache.axis.registries.HandlerRegistry; import org.apache.axis.utils.JavaUtils; import org.apache.log4j.Category; 1.65 +0 -1 xml-axis/java/src/org/apache/axis/MessageContext.java Index: MessageContext.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- MessageContext.java 2001/11/08 12:53:10 1.64 +++ MessageContext.java 2001/11/26 02:21:38 1.65 @@ -58,7 +58,6 @@ import org.apache.axis.client.AxisClient; import org.apache.axis.encoding.TypeMappingRegistry; import org.apache.axis.handlers.soap.SOAPService; -import org.apache.axis.registries.HandlerRegistry; import org.apache.axis.session.Session; import org.apache.axis.utils.AxisClassLoader; import org.apache.log4j.Category; 1.87 +0 -42 xml-axis/java/src/org/apache/axis/utils/Admin.java Index: Admin.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- Admin.java 2001/11/13 14:26:10 1.86 +++ Admin.java 2001/11/26 02:21:38 1.87 @@ -72,12 +72,7 @@ import org.apache.axis.encoding.*; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.handlers.BasicHandler; -import org.apache.axis.registries.HandlerRegistry; -import org.apache.axis.registries.SupplierRegistry; import org.apache.axis.server.AxisServer; -import org.apache.axis.suppliers.SimpleChainSupplier; -import org.apache.axis.suppliers.TargetedChainSupplier; -import org.apache.axis.suppliers.TransportSupplier; import org.apache.log4j.Category; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -534,43 +529,6 @@ } catch (IOException e) { return null; } - } - - /** - * Return an XML Element containing the configuration info for one - * of the engine's Handler registries. - * - * @param root the Element to work with (same as the one we return) - * @param registry the registry to write into this Element - * @return Element our config element, suitable for pumping back through - * Admin processing later, to redeploy. - */ - public static Element list(Element root, HandlerRegistry registry) - throws AxisFault - { - Document doc = root.getOwnerDocument(); - - Element elem = null ; - Hashtable opts = null ; - String[] names ; - Handler h ; - int i ; - - names = registry.list(); - - for( i = 0 ; names != null && i < names.length ; i++ ) { - h = registry.find(names[i]); - if (h == null) - throw new AxisFault("Server", JavaUtils.getMessage("noHandler02", names[i]), null, null); - elem = h.getDeploymentData(doc); - - if ( elem == null ) continue ; - - elem.setAttribute( "name", names[i] ); - root.appendChild( doc.importNode(elem,true) ); - } - - return root; } /** 1.21 +0 -1 xml-axis/java/test/RPCDispatch/TestSerializedRPC.java Index: TestSerializedRPC.java =================================================================== RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestSerializedRPC.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- TestSerializedRPC.java 2001/11/20 18:56:06 1.20 +++ TestSerializedRPC.java 2001/11/26 02:21:39 1.21 @@ -12,7 +12,6 @@ import org.apache.axis.message.RPCElement; import org.apache.axis.message.RPCParam; import org.apache.axis.message.SOAPEnvelope; -import org.apache.axis.registries.HandlerRegistry; import org.apache.axis.server.AxisServer; import org.xml.sax.SAXException;