axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/functional AltStockQuoteService.jws TestStockSample.java
Date Sun, 08 Jul 2001 14:18:40 GMT
gdaniels    01/07/08 07:18:40

  Modified:    java/samples/addr AddressBookProxy.java deploy.xml
               java/samples/bidbuy TestClient.java deploy.xml v3.java
               java/samples/echo TestClient.java deploy.xml
               java/samples/encoding DataSer.java
               java/src/org/apache/axis AxisEngine.java MessageContext.java
               java/src/org/apache/axis/deployment
                        SimpleDeploymentManager.java
               java/src/org/apache/axis/encoding ArraySerializer.java
                        Base64Serializer.java BeanSerializer.java
                        BooleanDeserializerFactory.java DateSerializer.java
                        DeserializationContext.java DeserializerBase.java
                        DeserializerFactory.java SOAPEncoding.java
                        SOAPTypeMappingRegistry.java
                        TypeMappingRegistry.java
               java/src/org/apache/axis/handlers DebugHandler.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/message MessageElement.java
                        SOAPBodyElement.java SOAPSAXHandler.java
               java/src/org/apache/axis/providers/java JavaProvider.java
                        MsgProvider.java
               java/src/org/apache/axis/utils Admin.java
               java/test build_functional_tests.xml
               java/test/RPCDispatch TestRPC.java TestSerializedRPC.java
               java/test/encoding DataSer.java TestDeser.java
               java/test/functional TestStockSample.java
  Added:       java/src/org/apache/axis AxisServiceConfig.java
               java/test/functional AltStockQuoteService.jws
  Log:
  (Apologies for the size of this checkin, I ended up doing a bit much
   in parallel)
  
  * Store type mappings as XML.  We support two syntaxes right now,
    one like this (the old <bean> syntax):
  
    <beanMappings>
     <ns:type classname="some.bean" xmlns:ns="myNamespace"/>
    </beanMappings>
  
    and the other like this:
  
    <typeMappings>
     <typeMapping type="xsd:string" classname="java.lang.String"
                  serializer="ser.StringSer" deserializerFactory="tst.Factory"/>
    </typeMappings>
  
    These should probably be condensed into a single <typeMappings> outer
    element containing <typeMapping> and <beanMapping> elements.
  
    We no longer use the typemap-supp.reg file, and a complete engine config
    is stored in the [client,server]-config.xml file.
  
  * Give SOAPServices a serviceDescription field.  This allows us to figure
    out by parse time whether a service is message-based (i.e. has
    MsgDispatcher as its pivot) or RPC-based, which lets us build the
    appropriate MessageElements.
  
  * Body-based dispatch now occurs in the BodyFactory inside SOAPSAXHandler
    instead of in the SOAPBodyElement constructor, because we might need
    the service to be able to determine which kind of SOAPBodyElement to
    build (see above).
  
    ** NOTE : one consequence of this is that we no longer do body-based
    dispatch OUTSIDE the context of a parse.  I removed the unit test in
    TestRPC which tested this, on the assumption that it's not going to be
    a real use-case.  If we want to be able to do this in situations where
    we just pass a dynamically constructed message into the engine, we
    should add the code back to the SOAPBodyElement constructor and re-
    instate the test.
  
  * Modify the way ID/HREF works at parse time, decoupling deserialization-
    based tasks from parsing.  The HREFs will only get resolved at deser
    time (i.e. when you call getValue() on MessageElement).  This is cleaner
    for now, and if we move to a "real" streaming model where processing
    happens during the parse, we can consider reinstating the fixup-based
    model.
  
  * Give MessageElement a getValueAsType() method, which will try to
    deserialize this element as a particular XSD type.  See DebugHandler for
    an example (note that we no longer use the DebugHeader class by default).
  
  * Add an AxisServiceConfig interface which service provider classes can
    implement to let the engine know about service metadata.  Right now the
    only method there is getMethods(), which allows a class (a JWS class in
    particular) to specify which are available for access via SOAP.  Add a
    modified StockQuoteService JWS to the functional tests, and test the
    new functionality.
  
  Revision  Changes    Path
  1.3       +2 -2      xml-axis/java/samples/addr/AddressBookProxy.java
  
  Index: AddressBookProxy.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/addr/AddressBookProxy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AddressBookProxy.java	2001/06/29 19:58:22	1.2
  +++ AddressBookProxy.java	2001/07/08 14:18:35	1.3
  @@ -94,13 +94,13 @@
               QName qn1 = new QName(serviceName, "Address");
               Class cls = Address.class;
               call.addSerializer(cls, qn1, new BeanSerializer(cls));
  -            call.addDeserializerFactory(qn1, cls, BeanSerializer.getFactory(cls));
  +            call.addDeserializerFactory(qn1, cls, BeanSerializer.getFactory());
               
               // register the PhoneNumber class
               QName qn2 = new QName(serviceName, "PhoneNumber");
               cls = PhoneNumber.class;
               call.addSerializer(cls, qn2, new BeanSerializer(cls));
  -            call.addDeserializerFactory(qn2, cls, BeanSerializer.getFactory(cls));
  +            call.addDeserializerFactory(qn2, cls, BeanSerializer.getFactory());
           } catch (Exception ex) {
               throw new IllegalArgumentException("Exception configurizing bean serialization: "+ex);
           }
  
  
  
  1.3       +4 -4      xml-axis/java/samples/addr/deploy.xml
  
  Index: deploy.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/addr/deploy.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- deploy.xml	2001/06/29 18:36:51	1.2
  +++ deploy.xml	2001/07/08 14:18:35	1.3
  @@ -17,10 +17,10 @@
       <option name="scope" value="Session" />
     </service>
   
  -  <bean xmlns:book2="urn:AddressFetcher2">
  +  <beanMappings xmlns:book2="urn:AddressFetcher2">
       <book2:Address       classname="samples.addr.Address"/>
       <book2:PhoneNumber      classname="samples.addr.PhoneNumber"/>
  -  </bean>
  +  </beanMappings>
   
   <!--
   Commented out this test for now. This seems to conflict somehow with the first
  @@ -36,10 +36,10 @@
       <option name="scope" value="Application" />
     </service>
   
  -  <bean xmlns:book3="urn:AddressFetcher3">
  +  <beanMappings xmlns:book3="urn:AddressFetcher3">
       <book3:Address       classname="samples.addr.Address"/>
       <book3:PhoneNumber      classname="samples.addr.PhoneNumber"/>
  -  </bean>
  +  </beanMappings>
   -->
   
   </m:deploy>
  
  
  
  1.6       +3 -3      xml-axis/java/samples/bidbuy/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/TestClient.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestClient.java	2001/06/29 19:58:31	1.5
  +++ TestClient.java	2001/07/08 14:18:35	1.6
  @@ -112,19 +112,19 @@
                                  "PurchaseOrder");
           Class cls = PurchaseOrder.class;
           call.addSerializer(cls, poqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory(cls));
  +        call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory());
   
           // register the Address class
           QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
           cls = Address.class;
           call.addSerializer(cls, aqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory(cls));
  +        call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory());
   
           // register the LineItem class
           QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
           cls = LineItem.class;
           call.addSerializer(cls, liqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory(cls));
  +        call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory());
   
           try {
               // Default return type based on what we expect
  
  
  
  1.7       +4 -4      xml-axis/java/samples/bidbuy/deploy.xml
  
  Index: deploy.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/deploy.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- deploy.xml	2001/06/21 02:45:23	1.6
  +++ deploy.xml	2001/07/08 14:18:35	1.7
  @@ -30,11 +30,11 @@
       <option name="methodName" value="Ping" />
     </service>
   
  -  <bean xmlns:bid="http://www.soapinterop.org/Bid">
  +  <beanMappings xmlns:bid="http://www.soapinterop.org/Bid">
       <bid:PurchaseOrder classname="samples.bidbuy.PurchaseOrder"/>
       <bid:Address       classname="samples.bidbuy.Address"/>
       <bid:LineItem      classname="samples.bidbuy.LineItem"/>
  -  </bean>
  +  </beanMappings>
   
     <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
   
  @@ -60,8 +60,8 @@
       <option name="methodName" value="LookupAsString" />
     </service>
   
  -  <bean xmlns:reg="http://www.soapinterop.org/Registry">
  +  <beanMappings xmlns:reg="http://www.soapinterop.org/Registry">
       <reg:Service classname="samples.bidbuy.Service"/>
  -  </bean>
  +  </beanMappings>
   
   </m:deploy>
  
  
  
  1.7       +3 -3      xml-axis/java/samples/bidbuy/v3.java
  
  Index: v3.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/v3.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- v3.java	2001/06/29 19:58:33	1.6
  +++ v3.java	2001/07/08 14:18:35	1.7
  @@ -197,19 +197,19 @@
                                "PurchaseOrder");
         Class cls = PurchaseOrder.class;
         call.addSerializer(cls, poqn, new BeanSerializer(cls));
  -      call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory(cls));
  +      call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory());
   
         // register the Address class
         QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
         cls = Address.class;
         call.addSerializer(cls, aqn, new BeanSerializer(cls));
  -      call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory(cls));
  +      call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory());
   
         // register the LineItem class
         QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
         cls = LineItem.class;
         call.addSerializer(cls, liqn, new BeanSerializer(cls));
  -      call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory(cls));
  +      call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory());
   
         LineItem[]     lineItems = new LineItem[numItems];
         
  
  
  
  1.12      +1 -1      xml-axis/java/samples/echo/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/TestClient.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestClient.java	2001/07/08 00:50:33	1.11
  +++ TestClient.java	2001/07/08 14:18:35	1.12
  @@ -156,7 +156,7 @@
           QName ssqn = new QName("http://soapinterop.org/xsd", "SOAPStruct");
           Class cls = SOAPStruct.class;
           call.addSerializer(cls, ssqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(ssqn, cls, BeanSerializer.getFactory(cls));
  +        call.addDeserializerFactory(ssqn, cls, BeanSerializer.getFactory());
   
           // execute the tests
           test("String", "abcdefg");
  
  
  
  1.2       +2 -2      xml-axis/java/samples/echo/deploy.xml
  
  Index: deploy.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/deploy.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- deploy.xml	2001/07/02 16:11:04	1.1
  +++ deploy.xml	2001/07/08 14:18:35	1.2
  @@ -15,7 +15,7 @@
       <option name="methodName" value="*" />
     </service>
   
  -  <bean xmlns:echo="http://soapinterop.org/xsd">
  +  <beanMappings xmlns:echo="http://soapinterop.org/xsd">
       <echo:SOAPStruct classname="samples.echo.SOAPStruct"/>
  -  </bean>
  +  </beanMappings>
   </m:deploy>
  
  
  
  1.5       +1 -1      xml-axis/java/samples/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/encoding/DataSer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DataSer.java	2001/05/22 18:42:22	1.4
  +++ DataSer.java	2001/07/08 14:18:36	1.5
  @@ -15,7 +15,7 @@
       public static final QName myTypeQName = new QName("typeNS", "Data");
       
       public static class DataSerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() {
  +        public DeserializerBase getDeserializer(Class cls) {
               return new DataSer();
           }
       }
  
  
  
  1.22      +4 -8      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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AxisEngine.java	2001/07/01 03:30:37	1.21
  +++ AxisEngine.java	2001/07/08 14:18:36	1.22
  @@ -92,7 +92,7 @@
       
       /** This Engine's global type mappings     */
       protected TypeMappingRegistry _typeMappingRegistry =
  -                                     new SOAPTypeMappingRegistry();
  +                                     new TypeMappingRegistry();
       
       protected Properties props = new Properties();
       
  @@ -146,6 +146,8 @@
           propVal = props.getProperty("debugFile");
           Debug.setToFile(propVal != null);
           
  +        _typeMappingRegistry.setParent(SOAPTypeMappingRegistry.getSingleton());
  +        
           Debug.Print( 1, "Enter: AxisEngine::init" );
           
           readConfiguration();
  @@ -193,13 +195,6 @@
             e.printStackTrace();
             return;
           }
  -
  -        // Load the registry of deployed types
  -        TypeMappingRegistry tmr = new TypeMappingRegistry("typemap-supp.reg");
  -        tmr.setParent(new SOAPTypeMappingRegistry());
  -        _typeMappingRegistry = tmr;
  -        
  -        tmr.init();
       }
   
       /** Write out our engine configuration.
  @@ -275,6 +270,7 @@
                                       DeserializerFactory deserFactory,
                                       Serializer serializer)
       {
  +      Debug.Print(3, "Registering type mapping " + qName + " -> " + cls.getName());
           if (deserFactory != null)
               _typeMappingRegistry.addDeserializerFactory(qName, cls, deserFactory);
           if (serializer != null)
  
  
  
  1.42      +6 -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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- MessageContext.java	2001/07/07 13:24:02	1.41
  +++ MessageContext.java	2001/07/08 14:18:36	1.42
  @@ -316,8 +316,13 @@
         Debug.Print(2,"MessageContext: setServiceHandler("+sh+")");
         serviceHandler = sh;
         if (sh != null && sh instanceof SOAPService) {
  -        TypeMappingRegistry tmr = ((SOAPService)sh).getTypeMappingRegistry();
  +        SOAPService service = (SOAPService)sh;
  +        TypeMappingRegistry tmr = service.getTypeMappingRegistry();
           setTypeMappingRegistry(tmr);
  +        
  +        if (serviceDesc == null) {
  +          serviceDesc = service.getServiceDescription();
  +        }
         }
       }
   
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/AxisServiceConfig.java
  
  Index: AxisServiceConfig.java
  ===================================================================
  package org.apache.axis;
  
  /** If a Java class which acts as the target for an Axis service
   * implements this interface, it may convey metadata about its
   * configuration to the Axis engine.
   * 
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public interface AxisServiceConfig
  {
    /** Get the allowed method names.
     * 
     * (The only method right now)
     * 
     * @return a space-delimited list of method names which may be called
     *         via SOAP.
     */
    public String getMethods();
  }
  
  
  
  1.4       +1 -0      xml-axis/java/src/org/apache/axis/deployment/SimpleDeploymentManager.java
  
  Index: SimpleDeploymentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/SimpleDeploymentManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleDeploymentManager.java	2001/05/05 09:03:31	1.3
  +++ SimpleDeploymentManager.java	2001/07/08 14:18:36	1.4
  @@ -104,6 +104,7 @@
        * Deploy the given WSDD Deployable Item
        */
       public void deployItem(DeployableItem item) throws DeploymentException {
  +      System.out.println("Deploying '" +item.getQName().toString()+"', "+item);
           items.put(item.getQName().toString(), item);
       }
   
  
  
  
  1.8       +1 -1      xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ArraySerializer.java	2001/07/08 11:59:49	1.7
  +++ ArraySerializer.java	2001/07/08 14:18:36	1.8
  @@ -89,7 +89,7 @@
       }
   
       public static class Factory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() {
  +        public DeserializerBase getDeserializer(Class cls) {
               return new ArraySerializer();
           }
       }
  
  
  
  1.2       +1 -1      xml-axis/java/src/org/apache/axis/encoding/Base64Serializer.java
  
  Index: Base64Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/Base64Serializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Base64Serializer.java	2001/07/08 00:54:59	1.1
  +++ Base64Serializer.java	2001/07/08 14:18:36	1.2
  @@ -81,7 +81,7 @@
       static public class Base64DeserializerFactory 
           implements DeserializerFactory 
       {
  -        public DeserializerBase getDeserializer() {return new Base64Deser();}
  +        public DeserializerBase getDeserializer(Class cls) {return new Base64Deser();}
       }
   
       /** 
  
  
  
  1.6       +21 -16    xml-axis/java/src/org/apache/axis/encoding/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/BeanSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BeanSerializer.java	2001/06/07 14:01:48	1.5
  +++ BeanSerializer.java	2001/07/08 14:18:36	1.6
  @@ -61,6 +61,7 @@
   
   import java.beans.BeanInfo;
   import java.beans.Introspector;
  +import java.beans.IntrospectionException;
   import java.beans.PropertyDescriptor;
   
   import org.apache.axis.encoding.*;
  @@ -128,21 +129,32 @@
        * An array of nothing, defined only once.
        */
       private static final Object[] noArgs = new Object[] {};
  +    
  +    public static DeserializerFactory getFactory()
  +    {
  +      return new BeanSerFactory();
  +    }
   
       /**
        * BeanSerializer Factory that creates instances with the specified
        * class.  Caches the PropertyDescriptor
        */
  -    private static class BeanSerFactory implements DeserializerFactory {
  -        private Class cls;
  -        private PropertyDescriptor[] pd;
  -
  -        public BeanSerFactory(Class cls) throws Exception{
  -            this.cls = cls;
  -            this.pd = Introspector.getBeanInfo(cls).getPropertyDescriptors();
  -        }
  +    public static class BeanSerFactory implements DeserializerFactory {
  +        private Hashtable propertyDescriptors = new Hashtable();
   
  -        public DeserializerBase getDeserializer() {
  +        public DeserializerBase getDeserializer(Class cls) {
  +            PropertyDescriptor [] pd =
  +                  (PropertyDescriptor [])propertyDescriptors.get(cls);
  +            
  +            if (pd == null) {
  +              try {
  +                pd = Introspector.getBeanInfo(cls).getPropertyDescriptors();
  +              } catch (IntrospectionException e) {
  +                return null;
  +              }
  +                propertyDescriptors.put(cls, pd);
  +            }
  +            
               BeanSerializer bs = new BeanSerializer();
               bs.setCls(cls);
               bs.setPd(pd);
  @@ -162,13 +174,6 @@
            */
           private static final ObjectStreamField[] serialPersistentFields = 
               {new ObjectStreamField("cls", Class.class)};
  -    }
  -
  -    /**
  -     * Accessor for the BeanSerializerFactory
  -     */
  -    public static DeserializerFactory getFactory(Class cls) throws Exception {
  -        return new BeanSerFactory(cls);
       }
   
       /**
  
  
  
  1.3       +1 -1      xml-axis/java/src/org/apache/axis/encoding/BooleanDeserializerFactory.java
  
  Index: BooleanDeserializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/BooleanDeserializerFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BooleanDeserializerFactory.java	2001/07/08 00:50:34	1.2
  +++ BooleanDeserializerFactory.java	2001/07/08 14:18:37	1.3
  @@ -94,6 +94,6 @@
           }
       }
   
  -    public DeserializerBase getDeserializer() { return new BooleanDeser(); }
  +    public DeserializerBase getDeserializer(Class cls) { return new BooleanDeser(); }
   
   }
  
  
  
  1.5       +1 -1      xml-axis/java/src/org/apache/axis/encoding/DateSerializer.java
  
  Index: DateSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DateSerializer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DateSerializer.java	2001/05/21 00:44:43	1.4
  +++ DateSerializer.java	2001/07/08 14:18:37	1.5
  @@ -159,7 +159,7 @@
       }
   
       static public class DateDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new DateDeser(); }
  +        public DeserializerBase getDeserializer(Class cls) { return new DateDeser(); }
       }
   
       /** 
  
  
  
  1.11      +0 -46     xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
  
  Index: DeserializationContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DeserializationContext.java	2001/05/05 22:16:56	1.10
  +++ DeserializationContext.java	2001/07/08 14:18:37	1.11
  @@ -75,8 +75,6 @@
   {
       public SOAPSAXHandler baseHandler;
       public Hashtable idMappings = new Hashtable();
  -    public Hashtable fixups = new Hashtable();
  -    public boolean hasUnresolvedHrefs = false;
       
       private MessageContext msgContext;
   
  @@ -90,50 +88,6 @@
       public SOAPSAXHandler getSAXHandler()
       {
           return baseHandler;
  -    }
  -    
  -    public void addFixupHandler(String id, DeserializerBase handler)
  -    {
  -        DeserializerBase oldHandler = (DeserializerBase)fixups.get(id);
  -        
  -        /** !!! This is kind of messy.  Basically, if multiple references
  -         * to the same object occur, we need to make sure that when it gets
  -         * found, all of the fixup points are loaded with the correct value.
  -         * 
  -         * Right now this happens by checking the deserializer types and
  -         * copying the targets across to the new one.  To make this nicer,
  -         * we should integrate knowledge of the HREF attribute further up
  -         * the chain (in SOAPSAXHandler), to avoid even creating a new
  -         * deserializer once one is already registered for a given ID.
  -         * 
  -         */
  -        if (oldHandler != null) {
  -            // Make sure types match...
  -            if (!handler.getClass().equals(oldHandler.getClass())) {
  -                System.err.println("Non-compatible deserializers for multiple refs to ID " + id);
  -                return;
  -            }
  -            
  -            handler.copyValueTargets(oldHandler);
  -        }
  -        
  -        fixups.put(id, handler);
  -        hasUnresolvedHrefs = true;
  -    }
  -    
  -    public DeserializerBase getHandlerForID(String id)
  -    {
  -        DeserializerBase handler = (DeserializerBase)fixups.get(id);
  -        if (handler != null) {
  -            fixups.remove(id);
  -            hasUnresolvedHrefs = !fixups.isEmpty();
  -        }
  -        return handler;
  -    }
  -    
  -    public boolean unresolvedHrefs()
  -    {
  -        return hasUnresolvedHrefs;
       }
       
       public void pushElementHandler(DeserializerBase handler)
  
  
  
  1.8       +3 -1      xml-axis/java/src/org/apache/axis/encoding/DeserializerBase.java
  
  Index: DeserializerBase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializerBase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeserializerBase.java	2001/05/07 02:20:58	1.7
  +++ DeserializerBase.java	2001/07/08 14:18:37	1.8
  @@ -57,6 +57,8 @@
   
   import org.xml.sax.*;
   import org.xml.sax.helpers.*;
  +
  +import org.apache.axis.Constants;
   import org.apache.axis.message.*;
   
   import java.util.*;
  @@ -206,7 +208,7 @@
           this.context = context;
       }
       
  -    /** Base-class startElement() handler.  Deals with HREFs
  +    /** Base-class startElement() handler.
        */
       public void startElement(String namespace, String localName,
                                String qName, Attributes attributes)
  
  
  
  1.3       +1 -1      xml-axis/java/src/org/apache/axis/encoding/DeserializerFactory.java
  
  Index: DeserializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializerFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeserializerFactory.java	2001/06/07 14:01:49	1.2
  +++ DeserializerFactory.java	2001/07/08 14:18:37	1.3
  @@ -2,5 +2,5 @@
   
   public interface DeserializerFactory extends java.io.Serializable
   {
  -    public DeserializerBase getDeserializer();
  +    public DeserializerBase getDeserializer(Class cls);
   }
  
  
  
  1.7       +1 -1      xml-axis/java/src/org/apache/axis/encoding/SOAPEncoding.java
  
  Index: SOAPEncoding.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPEncoding.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SOAPEncoding.java	2001/07/01 12:58:53	1.6
  +++ SOAPEncoding.java	2001/07/08 14:18:37	1.7
  @@ -10,7 +10,7 @@
   import java.io.IOException;
   import java.math.BigDecimal;
   
  -public class SOAPEncoding implements Serializer, java.io.Serializable { 
  +public class SOAPEncoding implements Serializer { 
       private Hashtable typemap = new Hashtable();
       private Hashtable namemap = new Hashtable();
       
  
  
  
  1.21      +58 -63    xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SOAPTypeMappingRegistry.java	2001/07/08 11:59:49	1.20
  +++ SOAPTypeMappingRegistry.java	2001/07/08 14:18:37	1.21
  @@ -59,6 +59,8 @@
   import org.apache.axis.utils.QName;
   import org.xml.sax.*;
   
  +import java.lang.reflect.Constructor;
  +
   import java.util.Date;
   import java.util.List;
   import java.math.BigDecimal;
  @@ -98,71 +100,63 @@
       }
   
       public static abstract class BasicDeser extends DeserializerBase {
  +        StringBuffer val = new StringBuffer();
  +        
           public void characters(char [] chars, int start, int end)
               throws SAXException
  +        {
  +            val.append(chars, start, end);
  +        }
  +        public void endElement(String namespace, String localName,
  +                               String qName)
  +            throws SAXException
           {
  -            value = makeValue(new String(chars, start, end));
  +            value = makeValue(val.toString());
               valueComplete();
           }
  +        
           abstract Object makeValue(String source);
  -    }
  -    class IntDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Integer(source); }
  -    }
  -    class IntDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new IntDeser(); }
  -    }
  -    class FloatDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Float(source); }
       }
  -    class FloatDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new FloatDeser(); }
  -    }
  -    class LongDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Long(source); }
  -    }
  -    class LongDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new LongDeser(); }
  -    }
  -    class StringDeser extends BasicDeser {
  -        public void characters(char [] chars, int start, int end) {
  -            String work = new String(chars, start, end);
  -            if (value == null)
  -                value = work;
  -            else
  -                value = (String)value + work;
  +    
  +    /** A deserializer for any simple type with a (String) constructor.
  +     * 
  +     * The factory below will build one of these configured for the
  +     * desired Class each time.
  +     */
  +    public static class BasicDeserializer extends BasicDeser {
  +        Constructor constructor;
  +        public BasicDeserializer(Class cls)
  +        {
  +            try {
  +                constructor = cls.getDeclaredConstructor(
  +                                   new Class [] { String.class });
  +            } catch (Exception e) {
  +                // TODO : Handle errors / throw?
  +                e.printStackTrace();
  +            }
           }
  -        Object makeValue(String source) { return null; }
  -    }
  -    class StringDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new StringDeser(); }
  -    }
  -    class DoubleDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Double(source); }
  -    }
  -    class DoubleDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new DoubleDeser(); }
  -    }
  -    class ShortDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Short(source); }
  -    }
  -    class ShortDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new ShortDeser(); }
  -    }
  -    class ByteDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Byte(source); }
  -    }
  -    class ByteDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new ByteDeser(); }
  -    }
  -    class DecimalDeser extends BasicDeser {
  -        Object makeValue(String source) { return new BigDecimal(source); }
  -    }
  -    class DecimalDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new DecimalDeser(); }
  +        
  +        public Object makeValue(String source)
  +        {
  +            try {
  +                return constructor.newInstance(new Object [] { source });
  +            } catch (Exception e) {
  +                // TODO: Handle errors / throw?
  +                e.printStackTrace();
  +                return null;
  +            }
  +        }
       }
       
  +    public static class BasicDeserializerFactory implements DeserializerFactory {
  +        public DeserializerBase getDeserializer(Class cls)
  +        {
  +            return new BasicDeserializer(cls);
  +        }
  +    }
  +
       private ArraySerializer arraySer = new ArraySerializer();
  +    private BasicDeserializerFactory factory = new BasicDeserializerFactory();
   
       /**
        * Alias common DeserializerFactories across the various popular schemas
  @@ -222,16 +216,17 @@
           addSerializer(java.util.Date.class, XSD_DATE, new DateSerializer());
           addSerializer(byte[].class, XSD_BASE64, new Base64Serializer());
           addSerializer(java.math.BigDecimal.class, XSD_DECIMAL, se);
  +        
  +        addDeserializersFor(XSD_STRING, java.lang.String.class, factory);    
  +        addDeserializersFor(XSD_BOOLEAN, java.lang.Boolean.class, factory);
  +        addDeserializersFor(XSD_DOUBLE, java.lang.Double.class, factory);
  +        addDeserializersFor(XSD_FLOAT, java.lang.Float.class, factory);
  +        addDeserializersFor(XSD_INT, java.lang.Integer.class, factory);
  +        addDeserializersFor(XSD_LONG, java.lang.Long.class, factory);
  +        addDeserializersFor(XSD_SHORT, java.lang.Short.class, factory);
  +        addDeserializersFor(XSD_BYTE, java.lang.Byte.class, factory);
  +        addDeserializersFor(XSD_DECIMAL, java.math.BigDecimal.class, factory);
           
  -        addDeserializersFor(XSD_STRING, java.lang.String.class, new StringDeserializerFactory());    
  -        addDeserializersFor(XSD_BOOLEAN, java.lang.Boolean.class, new BooleanDeserializerFactory());
  -        addDeserializersFor(XSD_DOUBLE, java.lang.Double.class, new DoubleDeserializerFactory());
  -        addDeserializersFor(XSD_FLOAT, java.lang.Float.class, new FloatDeserializerFactory());
  -        addDeserializersFor(XSD_INT, java.lang.Integer.class, new IntDeserializerFactory());
  -        addDeserializersFor(XSD_LONG, java.lang.Long.class, new LongDeserializerFactory());
  -        addDeserializersFor(XSD_SHORT, java.lang.Short.class, new ShortDeserializerFactory());
  -        addDeserializersFor(XSD_BYTE, java.lang.Byte.class, new ByteDeserializerFactory());
  -        addDeserializersFor(XSD_DECIMAL, java.math.BigDecimal.class, new DecimalDeserializerFactory());
           addDeserializersFor(XSD_BASE64, byte[].class, new Base64Serializer.Base64DeserializerFactory());
   
           // handle the various datetime QNames...
  
  
  
  1.17      +84 -59    xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java
  
  Index: TypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TypeMappingRegistry.java	2001/07/08 11:30:50	1.16
  +++ TypeMappingRegistry.java	2001/07/08 14:18:37	1.17
  @@ -63,6 +63,7 @@
   import org.apache.axis.message.*;
   import org.w3c.dom.Element;
   import org.w3c.dom.Document;
  +import org.w3c.dom.NodeList;
   import org.xml.sax.*;
   import org.xml.sax.helpers.AttributesImpl;
   import java.io.*;
  @@ -71,31 +72,12 @@
    * @author James Snell (jasnell@us.ibm.com)
    * @author Sam Ruby (rubys@us.ibm.com)
    */
  -public class TypeMappingRegistry implements Serializer, Serializable { 
  -
  -    // default location for save/load
  -    private String fileName = null;
  -
  -    /**
  -     * Constructor for persistent registries
  -     */
  -    public TypeMappingRegistry(String fileName) {
  -        this();
  -        this.fileName = fileName;
  -    }
  -
  +public class TypeMappingRegistry implements Serializer { 
       /**
        * Default constructor (transient registry)
        */
       public TypeMappingRegistry() {}
   
  -    /**
  -     * Init (ie. load settings...)
  -     */
  -    public void init() {
  -       load();
  -    }
  -
       static class SerializerDescriptor implements Serializable {
           QName typeQName;
           Serializer serializer;
  @@ -120,6 +102,11 @@
       Hashtable s;
       Hashtable d;
       
  +    public boolean isEmpty()
  +    {
  +      return (d == null || d.isEmpty());
  +    }
  +    
       /**
        * Define a "parent" TypeMappingRegistry that will be used to service
        * any requests that are not satisfied by this this instance.  This
  @@ -150,7 +137,6 @@
                                 Serializer serializer) {
           if (s == null) s = new Hashtable();
           s.put(_class, new SerializerDescriptor(qName, serializer));
  -        save();
       }
       
       public void addDeserializerFactory(QName qname,
  @@ -158,7 +144,6 @@
                                          DeserializerFactory deserializerFactory) {
           if (d == null) d= new Hashtable();
           d.put(qname, new DeserializerDescriptor(_class, deserializerFactory));
  -        save();
       }
   
       public Serializer getSerializer(Class _class) {
  @@ -192,7 +177,7 @@
           if (d != null) {
               DeserializerDescriptor desc = (DeserializerDescriptor)d.get(qname);
               if ((desc != null) && (desc.factory != null))
  -               return desc.factory.getDeserializer();
  +               return desc.factory.getDeserializer(desc.cls);
           }
           if (parent != null) return parent.getDeserializer(qname);
           return null;
  @@ -200,12 +185,10 @@
       
       public void removeSerializer(Class _class) {
           if (s != null) s.remove(_class);
  -        save();
       }
       
       public void removeDeserializer(QName qname) {
           if (d != null) d.remove(qname);
  -        save();
       }
       
       public boolean hasSerializer(Class _class) {
  @@ -220,38 +203,6 @@
           return false;
       }
       
  -    public void save() {
  -        if (fileName == null) return;
  -        
  -        try {
  -            FileOutputStream out = new FileOutputStream(fileName);
  -            Hashtable reg = new Hashtable();
  -            if (s!=null) reg.put("SERIALIZERS", s);
  -            if (d!=null) reg.put("DESERIALIZERS", d);
  -            ObjectOutputStream oos = new ObjectOutputStream(out);
  -            oos.writeObject(reg);
  -            oos.close();
  -        } catch (Exception e) {
  -            e.printStackTrace( System.err );
  -        }
  -    }
  -    
  -    private void load() {
  -        if (fileName == null) return;
  -
  -        try {
  -            FileInputStream in = new FileInputStream(fileName);
  -            ObjectInputStream ois = new ObjectInputStream(in);
  -            Hashtable reg = (Hashtable)ois.readObject();
  -            s = (Hashtable)reg.get("SERIALIZERS");
  -            d = (Hashtable)reg.get("DESERIALIZERS");
  -            ois.close();
  -        } catch (FileNotFoundException fnfe) {
  -        } catch (Exception e) {
  -            e.printStackTrace( System.err );
  -        }
  -    }
  -    
       public Attributes setTypeAttribute(Attributes attributes, QName type,
                                          SerializationContext context)
       {
  @@ -289,8 +240,6 @@
       
       public void dump(PrintStream out, String header) {
           out.println(header);
  -        if (fileName != null) 
  -           out.println("  File: " + fileName);
           out.println("  Deserializers:");
           if (d != null) {
               java.util.Enumeration e = d.keys();
  @@ -303,5 +252,81 @@
           }
           if (parent != null)
               parent.dump(out, "Parent");
  +    }
  +
  +    public static final QName typeMappingQName = new QName("axis",
  +                                                           "typeMapping");
  +    
  +    public void dumpToSerializationContext(SerializationContext ctx)
  +      throws IOException
  +    {
  +      if (d == null) {
  +        return;
  +      }
  +      
  +      Enumeration enum = d.keys();
  +      while (enum.hasMoreElements()) {
  +        QName typeQName = (QName)enum.nextElement();
  +        DeserializerDescriptor desc = 
  +                                    (DeserializerDescriptor)d.get(typeQName);
  +        if (desc.cls == null)
  +          continue;
  +
  +        AttributesImpl attrs = new AttributesImpl();
  +        attrs.addAttribute("", "type", "type",
  +                           "CDATA", ctx.qName2String(typeQName));
  +        attrs.addAttribute("", "class", "class",
  +                           "CDATA", desc.cls.getName());
  +        
  +        String dser = desc.factory.getClass().getName();
  +        attrs.addAttribute("", "dser", "dser",
  +                           "CDATA", dser);
  +        
  +        SerializerDescriptor serDesc = (SerializerDescriptor)s.get(desc.cls);
  +        if (serDesc != null) {
  +          attrs.addAttribute("", "ser", "ser",
  +                             "CDATA",
  +          serDesc.serializer.getClass().getName());
  +        }
  +        
  +        ctx.startElement(typeMappingQName, attrs);
  +        ctx.endElement();
  +      }
  +    }
  +
  +    public void dumpToElement(Element root)
  +    {
  +      if ((d == null) || (parent == null)) {
  +        return;
  +      }
  +
  +      Document doc = root.getOwnerDocument();
  +      
  +      Enumeration enum = d.keys();
  +      while (enum.hasMoreElements()) {
  +        QName typeQName = (QName)enum.nextElement();
  +        DeserializerDescriptor desc = 
  +                                    (DeserializerDescriptor)d.get(typeQName);
  +        if (desc.cls == null)
  +          continue;
  +        
  +        Element mapEl = doc.createElement("typeMapping");
  +
  +        mapEl.setAttribute("type", "ns:" + typeQName.getLocalPart());
  +        mapEl.setAttribute("xmlns:ns", typeQName.getNamespaceURI());
  +        
  +        mapEl.setAttribute("classname", desc.cls.getName());
  +        
  +        String dser = desc.factory.getClass().getName();
  +        mapEl.setAttribute("deserializerFactory", dser);
  +        
  +        SerializerDescriptor serDesc = (SerializerDescriptor)s.get(desc.cls);
  +        if (serDesc != null) {
  +          mapEl.setAttribute("serializer", serDesc.serializer.
  +                                                   getClass().getName());
  +        }
  +
  +        root.appendChild(mapEl);
  +      }
       }
   }
  
  
  
  1.16      +7 -2      xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java
  
  Index: DebugHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DebugHandler.java	2001/06/12 15:43:09	1.15
  +++ DebugHandler.java	2001/07/08 14:18:38	1.16
  @@ -58,6 +58,7 @@
   import java.util.* ;
   
   import org.apache.axis.* ;
  +import org.apache.axis.encoding.*;
   import org.apache.axis.utils.* ;
   import org.apache.axis.message.DebugHeader;
   import org.apache.axis.message.SOAPEnvelope;
  @@ -79,8 +80,12 @@
               SOAPEnvelope message = (SOAPEnvelope)msg.getAsSOAPEnvelope();
               SOAPHeader header = message.getHeaderByName(Constants.URI_DEBUG, 
                                                           "Debug");
  -            if ((header != null) && (header instanceof DebugHeader)) {
  -                int debugVal = ((DebugHeader)header).getDebugLevel();
  +            
  +            if (header != null) {
  +                int debugVal = 
  +                      ((Integer)header
  +                             .getValueAsType(SOAPTypeMappingRegistry.XSD_INT))
  +                      .intValue();
                   Debug.Print( 1, "Setting debug level to: " + debugVal );
                   Debug.setDebugLevel(debugVal);
                   header.setProcessed(true);
  
  
  
  1.13      +20 -0     xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SOAPService.java	2001/07/01 14:32:16	1.12
  +++ SOAPService.java	2001/07/08 14:18:38	1.13
  @@ -85,6 +85,10 @@
        */
       private TypeMappingRegistry typeMap;
       
  +    /** Our service description
  +     */
  +    private ServiceDescription serviceDescription;
  +    
       /** Standard, no-arg constructor.
        */
       public SOAPService()
  @@ -103,6 +107,16 @@
           typeMap = map;
       }
       
  +    public ServiceDescription getServiceDescription()
  +    {
  +      return serviceDescription;
  +    }
  +    
  +    public void setServiceDescription(ServiceDescription sd)
  +    {
  +      serviceDescription = sd;
  +    }
  +    
       /** Convenience constructor for wrapping SOAP semantics around
        * "service handlers" which actually do work.
        */
  @@ -188,6 +202,12 @@
         Element  root = doc.createElement( "service" );
   
         fillInDeploymentData(root);
  +      
  +      if (!getTypeMappingRegistry().isEmpty()) {
  +        Element elem = doc.createElement("typeMappings");
  +        getTypeMappingRegistry().dumpToElement(elem);
  +        root.appendChild(elem);
  +      }
         
         Debug.Print( 1, "Exit: SOAPService::getDeploymentData" );
         return( root );
  
  
  
  1.24      +56 -15    xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- MessageElement.java	2001/07/01 03:30:56	1.23
  +++ MessageElement.java	2001/07/08 14:18:38	1.24
  @@ -60,8 +60,10 @@
   import org.xml.sax.helpers.AttributesImpl;
   import org.w3c.dom.*;
   import org.apache.axis.Constants;
  +import org.apache.axis.AxisFault;
   import org.apache.axis.message.events.*;
   import org.apache.axis.encoding.*;
  +import org.apache.axis.utils.Debug;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.DOM2Writer;
   import java.util.*;
  @@ -172,30 +174,62 @@
       {
           return null;
       }
  +    
  +    public MessageElement getRealElement()
  +    {
  +      if (href == null)
  +        return this;
  +      
  +      return context.getElementByID(href.substring(1));
  +    }
   
       public Object getValue()
       {
  -        if (value instanceof ElementRecorder) {
  -            // !!! Lazy deserialization here... We have the SAX events,
  -            //     but haven't run them through a deserializer yet.
  -            StringWriter xml = new StringWriter();
  -            try {
  -               SerializationContext xmlContext = new SerializationContext(xml, context.getMessageContext());
  -               ((ElementRecorder)value).outputChildren(xmlContext);
  -            } catch (Exception e) {
  -               if (DEBUG_LOG) e.printStackTrace();
  -               return null;
  -            }
  -            return xml.getBuffer().toString();
  +        if (value != null)
  +            return value;
  +        
  +        if (href != null) {
  +            return getRealElement().getValue();
           }
           
           if (deserializer != null) {
               value = deserializer.getValue();
               deserializer = null;
  +        } else {
  +            // No attached deserializer, try it as a String...
  +            try {
  +                value = getValueAsType(SOAPTypeMappingRegistry.XSD_STRING);
  +            } catch (AxisFault fault) {
  +                Debug.Print(1, "Couldn't deserialize as String : " + fault);
  +            }
           }
           
           return value;
       }
  +
  +    public Object getValueAsType(QName typeQName) throws AxisFault
  +    {
  +      MessageElement realEl = getRealElement();
  +      
  +      if (realEl.typeQName != null) {
  +          if (!realEl.typeQName.equals(typeQName))
  +            throw new AxisFault("Couldn't convert " + realEl.typeQName +
  +                                " to requested type " + typeQName);
  +          return getValue();
  +      }
  +      
  +      DeserializerBase dser = realEl.context.getDeserializer(typeQName);
  +      if (dser == null)
  +        throw new AxisFault("No deserializer for type " + typeQName);
  +      
  +      try {
  +        realEl.publishToHandler(dser);
  +      } catch (SAXException e) {
  +        throw new AxisFault(e);
  +      }
  +      
  +      return dser.getValue();
  +    }
       
       public void startElement(String namespace, String localName,
                                String qName, Attributes attributes)
  @@ -258,6 +292,14 @@
       public DeserializerBase getContentHandler()
       {
           if (isDeserializing()) {
  +          
  +          if (href != null) {
  +            deserializer = context.getElementByID(href.substring(1));
  +            System.out.println("Got href dser " + deserializer);
  +            if (deserializer != null)
  +              return deserializer;
  +          }
  +          
               // Look up type and return an appropriate deserializer
               if ((typeQName != null) && (deserializer == null)) {
                   deserializer = context.getDeserializer(typeQName);
  @@ -279,9 +321,8 @@
           if (DEBUG_LOG) {
               System.err.println("Creating recorder for " + this.getName());
           }
  -        value = new ElementRecorder();
  -        recorder = (ElementRecorder)value;
  -        return (ElementRecorder)value;
  +        recorder = new ElementRecorder();
  +        return recorder;
       }
       
       public void setContentHandler(DeserializerBase handler)
  
  
  
  1.5       +0 -13     xml-axis/java/src/org/apache/axis/message/SOAPBodyElement.java
  
  Index: SOAPBodyElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPBodyElement.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SOAPBodyElement.java	2001/06/26 21:01:07	1.4
  +++ SOAPBodyElement.java	2001/07/08 14:18:38	1.5
  @@ -69,19 +69,6 @@
                         Attributes attributes, DeserializationContext context)
       {
           super(namespace, localPart, attributes, context);
  -
  -        /** The algorithm we use here is to find the first
  -         * element without an ID attribute (assuming that
  -         * ID'ed attributes are multi-ref encodings).
  -         */
  -        if (context!= null && getID()==null) {
  -            MessageContext msgContext = context.getMessageContext();
  -            if (msgContext.getServiceHandler() == null) {
  -                Debug.Print(2, "Dispatching to body namespace '",
  -                            namespace, "'");
  -                msgContext.setTargetService(namespace);
  -            }
  -        }
       }
       
       public SOAPBodyElement()
  
  
  
  1.18      +31 -29    xml-axis/java/src/org/apache/axis/message/SOAPSAXHandler.java
  
  Index: SOAPSAXHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPSAXHandler.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SOAPSAXHandler.java	2001/06/12 15:43:14	1.17
  +++ SOAPSAXHandler.java	2001/07/08 14:18:38	1.18
  @@ -64,6 +64,7 @@
   import org.apache.axis.utils.NSStack;
   import org.xml.sax.*;
   import org.xml.sax.helpers.DefaultHandler;
  +import org.apache.axis.utils.Debug;
   
   /** The main SOAP envelope parsing class.  This whole system is based on
    * SAX event-style parsing, and this is the core "engine".  Subclasses
  @@ -134,11 +135,37 @@
                                                                      context);
               }
               
  +            /** We're about to create a body element.  So we really need
  +             * to know at this point if this is an RPC service or not.  It's
  +             * possible that no one has set the service up until this point,
  +             * so if that's the case we should attempt to set it based on the
  +             * namespace of the first body element without an ID (assuming
  +             * that ID'ed attributes are multi-ref encodings).  Setting the
  +             * service may (should?) result in setting the service
  +             * description, which can then tell us what to create.
  +             */
  +            String id = attributes.getValue("id");
  +
  +            if (id == null &&
  +                context.getMessageContext().getServiceHandler() == null) {
  +                Debug.Print(2, "Dispatching to body namespace '",
  +                            namespace, "'");
  +                context.getMessageContext().setTargetService(namespace);
  +            }
  +            
  +            /** Now we make a plain SOAPBodyElement IF we either:
  +             * a) have an ID attribute, or
  +             * b) have a non-RPC service
  +             */
               ServiceDescription serviceDesc = context.getServiceDescription();
  -            if ((serviceDesc != null) && (!serviceDesc.isRPC())) {
  +            if (((serviceDesc != null) &&
  +                (!serviceDesc.isRPC())) ||
  +                (id != null)) {
                   return new SOAPBodyElement(namespace, localName, attributes, context);
               }
   
  +            /** We're RPC, so make an RPCElement.
  +             */
               RPCElement body = (RPCElement) 
                   RPCElement.getFactory().createElement(namespace,
                                                        localName,
  @@ -149,26 +176,17 @@
           }
       }
   
  -    /** These guys know how to create the right MessageElements (and thus
  -     * sub-handlers) for particular XML elements.  Right now the headers
  -     * can be registered (see DebugHeader for an example), but the bodies
  -     * are fixed as RPCElements.
  -     */
  -    
       // Header factory.
       ElementRegistry headerRegistry =
                               new ElementRegistry(SOAPHeader.factory());
       
  -    // Body factory. Only doing rpc bodies for right now...
  +    // Body factory.
       ElementFactory bodyFactory = new BodyFactory();
   
       public SOAPSAXHandler(MessageContext msgContext)
       {
           envelope = new SOAPEnvelope(this);
           this.context = new DeserializationContext(this,msgContext);
  -
  -        // just testing...
  -        headerRegistry.registerFactory(Constants.URI_DEBUG, "Debug", DebugHeader.getFactory());
       }
       
       public int getState()
  @@ -449,7 +467,6 @@
                   return false;
               }
               
  -            context.addFixupHandler(href.substring(1), elementHandler);
               return false;
           }
   
  @@ -587,23 +604,8 @@
                   
                   element.setEnvelope(envelope);
                   element.setPrefix(namespaces.getPrefix(namespace));
  -                
  -                DeserializerBase handler = null;
  -                if (context.unresolvedHrefs() && (element.getID() != null)) {
  -                    handler = context.getHandlerForID(element.getID());
  -                    if (handler == null) {
  -                        handler = element.getContentHandler();
  -                    }  else {
  -                        if (DEBUG_LOG) {
  -                            System.out.println("found handler for ID " + element.getID() + " : " + handler);
  -                        }
  -                        element.setContentHandler(handler);
  -                    }
  -                } else {
  -                    handler = element.getContentHandler();
  -                }
  -                
  -                pushElementHandler(handler);
  +
  +                pushElementHandler(element.getContentHandler());
   
                   elementHandler.setDeserializationContext(context);
                   
  
  
  
  1.5       +7 -0      xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
  
  Index: JavaProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JavaProvider.java	2001/07/01 12:38:46	1.4
  +++ JavaProvider.java	2001/07/08 14:18:38	1.5
  @@ -220,6 +220,13 @@
                   new SOAPEnvelope() :
                   (SOAPEnvelope)resMsg.getAsSOAPEnvelope();
               
  +            /** If the class knows what it should be exporting,
  +             * respect its wishes.
  +             */
  +            if (obj instanceof AxisServiceConfig) {
  +              methodName = ((AxisServiceConfig)obj).getMethods();
  +            }
  +            
               processMessage(msgContext, serviceName, methodName, reqEnv, resEnv, jc, obj);
               
               if (resMsg == null) {
  
  
  
  1.2       +0 -12     xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java
  
  Index: MsgProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MsgProvider.java	2001/05/31 09:25:07	1.1
  +++ MsgProvider.java	2001/07/08 14:18:38	1.2
  @@ -93,18 +93,6 @@
           Class[]         argClasses = new Class[2];
           Object[]        argObjects = new Object[2];
           
  -        /** !!! KLUDGE WARNING
  -         * We need some way of associating ServiceDescriptions with actual
  -         * services... and then at the point when we figure out which service
  -         * we'll be calling (which might be right away (static dispatch), after
  -         * looking at the URL (transport-level dispatch), or even after looking
  -         * into the SOAP message itself...)
  -         */
  -        if (clsName.equals("org.apache.axis.utils.Admin")) {
  -            ServiceDescription sd = new ServiceDescription("Admin", false);
  -            msgContext.setServiceDescription(sd);
  -        }
  -        
           SOAPBodyElement reqBody = reqEnv.getFirstBody();
           
           StringWriter writer = new StringWriter();
  
  
  
  1.52      +108 -32   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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- Admin.java	2001/07/01 14:32:17	1.51
  +++ Admin.java	2001/07/08 14:18:39	1.52
  @@ -118,12 +118,30 @@
     private static void registerTypeMappings(Element root, SOAPService service)
       throws Exception
     {
  -    NodeList list = root.getElementsByTagName("bean");
  -    Debug.Print(2, "Registering " + list.getLength() + " service-specific beans.");
  +    TypeMappingRegistry reg = service.getTypeMappingRegistry();
  +    NodeList list = root.getElementsByTagName("beanMappings");
       for (int i = 0; list != null && i < list.getLength(); i++) {
         Element el = (Element)list.item(i);
  -      registerBeanMapping(el, service.getTypeMappingRegistry());
  +      registerTypes(el, reg, true);
       }
  +    
  +    list = root.getElementsByTagName("typeMappings");
  +    for (int i = 0; list != null && i < list.getLength(); i++) {
  +      Element el = (Element)list.item(i);
  +      registerTypes(el, reg, false);
  +    }
  +  }
  +  
  +  private static void registerTypes(Element root,
  +                               TypeMappingRegistry map,
  +                               boolean isBean)
  +    throws Exception
  +  {
  +    NodeList list = root.getChildNodes();
  +    for (int i = 0; (list != null) && (i < list.getLength()); i++) {
  +      if (!(list.item(i) instanceof Element)) continue;
  +      registerTypeMapping((Element)list.item(i), map, isBean);
  +    }
     }
   
     /**
  @@ -151,7 +169,8 @@
     {
       Element el = doc.getDocumentElement();
       if (!el.getTagName().equals("engineConfig"))
  -      throw new Exception("Wanted 'engineConfig' element, got '" + el.getTagName() + "'");
  +      throw new Exception("Wanted 'engineConfig' element, got '" +
  +        el.getTagName() + "'");
       
       NodeList nl = el.getElementsByTagName("handlers");
       deploy(nl, engine);
  @@ -162,6 +181,15 @@
       nl = el.getElementsByTagName("transports");
       deploy(nl, engine);
       
  +    nl = el.getElementsByTagName("typeMappings");
  +    deploy(nl, engine);
  +    /*
  +    if (nl.getLength() > 0)
  +      registerTypes((Element)nl.item(0),
  +                    engine.getTypeMappingRegistry(),
  +                    false);
  +    */
  +    
       engine.saveConfiguration();
     }
     
  @@ -200,6 +228,9 @@
           else if (type.equals("transport")) {
             registerTransport(item, engine);
           }
  +        else if (type.equals("typeMapping")) {
  +          registerTypeMapping(item, engine.getTypeMappingRegistry(), false);
  +        }
         }
       }
     }
  @@ -290,10 +321,13 @@
   
           // A streamlined means of deploying both a serializer and a deserializer
           // for a bean at the same time.
  -        else if ( type.equals( "bean" ) ) {
  -          Debug.Print( 2, "Deploying bean: " + name );
  +        else if ( type.equals( "beanMappings" ) ) {
             TypeMappingRegistry engineTypeMap = engine.getTypeMappingRegistry();
  -          registerBeanMapping(elem, engineTypeMap);
  +          registerTypes(elem, engineTypeMap, true);
  +        }
  +        else if (type.equals("typeMappings")) {
  +          TypeMappingRegistry engineTypeMap = engine.getTypeMappingRegistry();
  +          registerTypes(elem, engineTypeMap, false);
           } else
             throw new AxisFault( "Admin.error",
                                  "Unknown type to " + action + ": " + type,
  @@ -341,6 +375,11 @@
       el = doc.createElement("transports");
       list(el, engine.getTransportRegistry());
       tmpEl.appendChild(el);
  +    
  +    Debug.Print(2, "Outputting registry");
  +    el = doc.createElement("typeMappings");
  +    engine.getTypeMappingRegistry().dumpToElement(el);
  +    tmpEl.appendChild(el);
   
       return( doc );
     }
  @@ -525,6 +564,11 @@
                  ": couldn't find pivot Handler '" + pivot + "'");
         
         service.setPivotHandler( tmpH );
  +      
  +      if (pivot.equals("MsgDispatcher")) {
  +        ServiceDescription sd = new ServiceDescription("msgService", false);
  +        service.setServiceDescription(sd);
  +      }
       }
       
       if ( response != null && !"".equals(response) ) {
  @@ -646,45 +690,77 @@
      * @param root the type mapping element.
      * @param map the TypeMappingRegistry which gets this mapping.
      */
  -  private static void registerBeanMapping(Element root, TypeMappingRegistry map)
  +  private static void registerTypeMapping(Element elem,
  +                                          TypeMappingRegistry map,
  +                                          boolean isBean)
       throws Exception
     {
  -    NodeList  list = root.getChildNodes();
  -    for ( int i = 0 ; list != null && i < list.getLength() ; i++ ) {
  -      Node    node  = list.item(i);
  -      if ( node.getNodeType() != Node.ELEMENT_NODE ) continue ;
  -      Element elem  = (Element) node ;
  -
  -      // Retrieve classname attribute
  -
  -      String classname = elem.getAttribute("classname");
  -      if ((classname == null) || classname.equals(""))
  -        throw new AxisFault("Server.Admin.error",
  -                            "No classname attribute in bean mapping",
  -                            null, null);
  +    Serializer ser;
  +    DeserializerFactory dserFactory;
       
  -      // Resolve class name
  +    // Retrieve classname attribute
  +    String classname = elem.getAttribute("classname");
  +    if ((classname == null) || classname.equals(""))
  +      throw new AxisFault("Server.Admin.error",
  +        "No classname attribute in type mapping",
  +        null, null);
  +    
  +    // Resolve class name
   
  -      Class cls;
  -      try {
  -        cls = Class.forName(classname);
  -      } catch (Exception e) {
  -        throw new AxisFault( "Admin.error", e.toString(), null, null);
  -      }
  +    Class cls;
  +    QName qn;
  +    
  +    try {
  +      cls = Class.forName(classname);
  +    } catch (Exception e) {
  +      throw new AxisFault( "Admin.error", e.toString(), null, null);
  +    }
   
  +    if (isBean) {
         // Resolve qname based on prefix and localpart
   
         String namespaceURI = elem.getNamespaceURI();
         String localName    = elem.getLocalName();
  -      QName qn = new QName(namespaceURI, localName);
  +      qn = new QName(namespaceURI, localName);
         
         Debug.Print(2, "Registering mapping for " + qn + " -> " + classname);
   
         // register both serializers and deserializers for this bean
  -
  -      map.addSerializer(cls, qn, new BeanSerializer(cls));
  -      map.addDeserializerFactory(qn, cls, BeanSerializer.getFactory(cls));
  +      ser = new BeanSerializer(cls);
  +      dserFactory = BeanSerializer.getFactory();
  +    } else {
  +      String typeName = elem.getAttribute("type");
  +      int idx = typeName.indexOf(":");
  +      String prefix = typeName.substring(0, idx);
  +      String localPart = typeName.substring(idx + 1);
  +      
  +      qn = new QName(XMLUtils.getNamespace(prefix, elem), localPart);
  +      
  +      classname = elem.getAttribute("serializer");
  +      Debug.Print(3, "Serializer class is " + classname);
  +      try {
  +        ser = (Serializer)Class.forName(classname).newInstance();
  +      } catch (Exception e) {
  +        throw new AxisFault( "Admin.error",
  +                             "Couldn't load serializer class " + e.toString(),
  +                             null, null);
  +      }
  +      classname = elem.getAttribute("deserializerFactory");
  +      Debug.Print(3, "DeserializerFactory class is " + classname);
  +      try {
  +        dserFactory = (DeserializerFactory)Class.forName(classname).
  +                                                 newInstance();
  +      } catch (Exception e) {
  +        throw new AxisFault( "Admin.error",
  +                             "Couldn't load deserializerFactory " +
  +                                e.toString(),
  +                             null, null);
  +      }
  +      
       }
  +    
  +    map.addSerializer(cls, qn, ser);
  +    map.addDeserializerFactory(qn, cls, dserFactory);
     }
     
     public static void main(String args[]) throws Exception {
  
  
  
  1.7       +1 -0      xml-axis/java/test/build_functional_tests.xml
  
  Index: build_functional_tests.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build_functional_tests.xml	2001/06/27 14:57:55	1.6
  +++ build_functional_tests.xml	2001/07/08 14:18:39	1.7
  @@ -61,6 +61,7 @@
       <!-- first, put the JWS where the functional test can see it -->
       <mkdir dir="build/jws" />
       <copy file="samples/stock/StockQuoteService.jws" todir="build/jws" />
  +    <copy file="test/functional/AltStockQuoteService.jws" todir="build/jws" />
       
       <!-- now, run the actual test -->
       <junit dir="." printsummary="yes" haltonfailure="yes" fork="yes">
  
  
  
  1.14      +2 -0      xml-axis/java/test/RPCDispatch/TestRPC.java
  
  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestRPC.java	2001/06/25 14:31:14	1.13
  +++ TestRPC.java	2001/07/08 14:18:39	1.14
  @@ -120,6 +120,7 @@
           assertEquals("cba", rpc("reverseString", new Object[] {"abc"}, true));
       }
   
  +    /*
       public void testReverseBodyDispatch() throws Exception {
           // Register the reverseString service
           SOAPService reverse = new SOAPService(RPCDispatcher, "RPCDispatcher");
  @@ -130,6 +131,7 @@
           // invoke the service and verify the result
           assertEquals("cba", rpc("reverseString", new Object[] {"abc"}, false));
       }
  +    */
   
       /**
        * Test a method that reverses a data structure
  
  
  
  1.3       +1 -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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSerializedRPC.java	2001/06/25 14:31:16	1.2
  +++ TestSerializedRPC.java	2001/07/08 14:18:39	1.3
  @@ -131,7 +131,7 @@
        */
       public void testSerReverseData() throws Exception {
           BeanSerializer ser = new BeanSerializer(Data.class);
  -        DeserializerFactory dSerFactory = ser.getFactory(Data.class);
  +        DeserializerFactory dSerFactory = BeanSerializer.getFactory();
           QName qName = new QName("urn:foo", "Data");
           engine.registerTypeMapping(qName, Data.class, dSerFactory,
                                      ser);
  
  
  
  1.2       +1 -1      xml-axis/java/test/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataSer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DataSer.java	2001/05/04 00:20:45	1.1
  +++ DataSer.java	2001/07/08 14:18:39	1.2
  @@ -13,7 +13,7 @@
       public static final String FLOATMEMBER = "floatMember";
       
       public static class DataSerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() {
  +        public DeserializerBase getDeserializer(Class cls) {
               return new DataSer();
           }
       }
  
  
  
  1.10      +3 -2      xml-axis/java/test/encoding/TestDeser.java
  
  Index: TestDeser.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestDeser.java	2001/06/12 15:43:24	1.9
  +++ TestDeser.java	2001/07/08 14:18:39	1.10
  @@ -21,6 +21,7 @@
   
       private String header;
       private String footer;
  +    private AxisServer server = new AxisServer();
   
       public TestDeser(String name) {
           this(name, Constants.URI_CURRENT_SCHEMA_XSI, 
  @@ -65,7 +66,7 @@
        */
       protected void deserialize(String data, Object expected) {
          Message message = new Message(header + data + footer);
  -       message.setMessageContext(new MessageContext(new AxisServer()));
  +       message.setMessageContext(new MessageContext(server));
   
          SOAPEnvelope envelope = (SOAPEnvelope)message.getAsSOAPEnvelope();
          assertNotNull("envelope", envelope);
  @@ -81,7 +82,7 @@
          assertNotNull("param", param);
   
          Object result = param.getValue();
  -       if (!equals(expected,result)) assertEquals(expected, result);
  +       if (!equals(result, expected)) assertEquals(expected, result);
       }
   
       public void testString() {
  
  
  
  1.5       +10 -0     xml-axis/java/test/functional/TestStockSample.java
  
  Index: TestStockSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestStockSample.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestStockSample.java	2001/06/27 04:45:16	1.4
  +++ TestStockSample.java	2001/07/08 14:18:40	1.5
  @@ -83,6 +83,16 @@
           String[] args = { "-uuser1", "-wpass1", "XXX", "-sjws/StockQuoteService.jws" };
           float val = new GetQuote().getQuote(args);
           assertEquals("TestStockSample.doTestStockJWS(): stock price should be 66.25", val, 66.25, 0.01);
  +        
  +        // This should FAIL
  +        args[3] = "-sjws/AltStockQuoteService.jws";
  +        try {
  +          val = new GetQuote().getQuote(args);
  +        } catch (Exception e) {
  +          e.printStackTrace();
  +          return;
  +        }
  +        assertNull("not null");
       }
       
       public void doTestDeploy () throws Exception {
  
  
  
  1.1                  xml-axis/java/test/functional/AltStockQuoteService.jws
  
  Index: AltStockQuoteService.jws
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "AXIS" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.*;
  import java.util.* ;
  import java.net.URL;
  
  import org.w3c.dom.* ;
  import org.apache.axis.AxisServiceConfig;
  import org.apache.axis.utils.XMLUtils ;
  
  import org.apache.axis.utils.Debug;
  
  /**
   * See \samples\stock\readme for info.
   *
   * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class AltStockQuoteService implements AxisServiceConfig {
    public String getMethods() {
      return "echo";
    }
    
    public String echo(String s)
    {
      return s;
    }
    
    public float getQuote (String symbol) throws Exception {
      // get a real (delayed by 20min) stockquote from 
      // http://www.xmltoday.com/examples/stockquote/. The IP addr 
      // below came from the host that the above form posts to ..
  
      // NOTE THAT THIS RETURNS 66.25 WHERE THE ORDINARY EXAMPLE RETURNS 55.25!
      if ( symbol.equals("XXX") ) return( (float) 66.25 );
  
      Document doc = null ;
      
      doc = XMLUtils.newDocument( "http://www.xmltoday.com/examples/" +
                                  "stockquote/getxmlquote.vep?s="+symbol );
  
      Element  elem = doc.getDocumentElement();
      NodeList list = elem.getElementsByTagName("stock_quote");
  
      elem = (Element) list.item(0);
      list = elem.getElementsByTagName( "price" );
      elem = (Element) list.item( 0 );
      String quoteStr = elem.getAttribute("value");
      try {
        return Float.valueOf(quoteStr).floatValue();
      } catch (NumberFormatException e1) {
        // maybe its an int?
        try {
          return Integer.valueOf(quoteStr).intValue() * 1.0F;
        } catch (NumberFormatException e2) {
          return -1.0F;
        }
      }
    }
  }
  
  
  

Mime
View raw message