axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/types VerifyTestCase.java
Date Thu, 30 May 2002 23:46:04 GMT
scheu       02/05/30 16:46:04

  Modified:    java/samples/security SignedSOAPEnvelope.java
               java/samples/transport FileTransport.java
               java/src/org/apache/axis EngineConfigurationFactory.java
               java/src/org/apache/axis/client Transport.java
               java/src/org/apache/axis/configuration
                        DefaultEngineConfigurationFactory.java
                        ServletEngineConfigurationFactory.java
               java/src/org/apache/axis/deployment/wsdd
                        WSDDDeployableItem.java WSDDService.java
               java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java
                        DeserializationContextImpl.java
                        DeserializerImpl.java
               java/src/org/apache/axis/encoding/ser ArrayDeserializer.java
                        ArraySerializerFactory.java Base64Deserializer.java
                        Base64Serializer.java Base64SerializerFactory.java
                        BaseSerializerFactory.java MapDeserializer.java
                        MapSerializerFactory.java SimpleDeserializer.java
                        SimpleNonPrimitiveSerializerFactory.java
                        SimplePrimitiveSerializerFactory.java
                        SimpleSerializer.java VectorDeserializer.java
                        VectorSerializer.java VectorSerializerFactory.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/message EnvelopeBuilder.java
                        RPCHandler.java SOAPBody.java SOAPEnvelope.java
               java/src/org/apache/axis/transport/http HTTPTransport.java
               java/src/org/apache/axis/utils tcpmon.java tcpmon.properties
               java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
                        Utils.java
               java/src/org/apache/axis/wsdl/toJava Utils.java
               java/test/encoding DataDeser.java DataDeserFactory.java
                        DataSerFactory.java TestDeser1999.java TestSer.java
               java/test/message PackageTests.java
               java/test/wsdl/arrays PersonalInfoBookServiceTestCase.java
               java/test/wsdl/interop3/compound1
                        SoapInteropCompound1BindingImpl.java build.xml
               java/test/wsdl/interop3/compound2 Compound2TestCase.java
                        SoapInteropCompound2BindingImpl.java build.xml
               java/test/wsdl/interop3/docLit DocLitTestCase.java
                        WSDLInteropTestDocLitPortBindingImpl.java build.xml
               java/test/wsdl/interop3/docLitParam build.xml
               java/test/wsdl/interop3/import1 build.xml
               java/test/wsdl/interop3/import2 build.xml
               java/test/wsdl/interop3/import3 build.xml
               java/test/wsdl/interop3/rpcEnc build.xml
               java/test/wsdl/roundtrip RoundtripTestSoapBindingImpl.java
               java/test/wsdl/types VerifyTestCase.java
  Log:
  Removed end of line ^M characters
  
  Revision  Changes    Path
  1.10      +185 -185  xml-axis/java/samples/security/SignedSOAPEnvelope.java
  
  Index: SignedSOAPEnvelope.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/security/SignedSOAPEnvelope.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SignedSOAPEnvelope.java	30 May 2002 03:06:05 -0000	1.9
  +++ SignedSOAPEnvelope.java	30 May 2002 23:46:00 -0000	1.10
  @@ -1,185 +1,185 @@
  -/*
  - * 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/>.
  - */
  -
  -package samples.security;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.Message;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.client.AxisClient;
  -import org.apache.axis.configuration.NullProvider;
  -import org.apache.axis.encoding.DeserializationContextImpl;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.SerializationContextImpl;
  -import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeaderElement;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.Mapping;
  -import org.apache.axis.utils.XMLUtils;
  -import org.apache.xml.security.c14n.Canonicalizer;
  -import org.apache.xml.security.signature.XMLSignature;
  -import org.w3c.dom.Document;
  -import org.w3c.dom.Element;
  -import org.xml.sax.InputSource;
  -
  -import java.io.FileInputStream;
  -import java.io.Reader;
  -import java.io.StringReader;
  -import java.io.StringWriter;
  -import java.security.KeyStore;
  -import java.security.PrivateKey;
  -import java.security.cert.X509Certificate;
  -
  -public class SignedSOAPEnvelope extends SOAPEnvelope {
  -    static String SOAPSECNS = "http://schemas.xmlsoap.org/soap/security/2000-12";
  -    static String SOAPSECprefix = "SOAP-SEC";
  -
  -    static String keystoreType = "JKS";
  -    static String keystoreFile = "keystore.jks";
  -    static String keystorePass = "xmlsecurity";
  -    static String privateKeyAlias = "test";
  -    static String privateKeyPass = "xmlsecurity";
  -    static String certificateAlias = "test";
  -    private MessageContext msgContext;
  -
  -    static {
  -        org.apache.xml.security.Init.init();
  -    }
  -
  -    public SignedSOAPEnvelope(MessageContext msgContext, SOAPEnvelope env, String baseURI, String keystoreFile) {
  -        this.msgContext = msgContext;
  -        init(env, baseURI, keystoreFile);
  -    }
  -
  -    public SignedSOAPEnvelope(SOAPEnvelope env, String baseURI) {
  -        init(env, baseURI, keystoreFile);
  -    }
  -
  -    private void init(SOAPEnvelope env, String baseURI, String keystoreFile) {
  -        try {
  -            System.out.println("Beginning Client signing...");
  -            env.addMapping(new Mapping(SOAPSECNS, SOAPSECprefix));
  -            env.addAttribute(Constants.NS_URI_SOAP_ENV, "actor", "some-uri");
  -            env.addAttribute(Constants.NS_URI_SOAP_ENV, "mustUnderstand", "1");
  -
  -            SOAPHeaderElement header = 
  -                new SOAPHeaderElement(XMLUtils.StringToElement(SOAPSECNS,
  -                                                               "Signature",
  -                                                               ""));
  -            env.addHeader(header);
  -
  -            Document doc = getSOAPEnvelopeAsDocument(env, msgContext);
  -
  -            KeyStore ks = KeyStore.getInstance(keystoreType);
  -            FileInputStream fis = new FileInputStream(keystoreFile);
  -
  -            ks.load(fis, keystorePass.toCharArray());
  -
  -            PrivateKey privateKey = (PrivateKey) ks.getKey(privateKeyAlias,
  -                    privateKeyPass.toCharArray());
  -
  -            Element soapHeaderElement = (Element) ((Element) doc.getFirstChild()).getElementsByTagNameNS("*", "Header").item(0);
  -            Element soapSignatureElement = (Element) soapHeaderElement.getElementsByTagNameNS("*", "Signature").item(0);
  -
  -            XMLSignature sig = new XMLSignature(doc, baseURI,
  -                    XMLSignature.ALGO_ID_SIGNATURE_DSA);
  -
  -            soapSignatureElement.appendChild(sig.getElement());
  -            sig.addDocument("#Body");
  -
  -
  -            X509Certificate cert =
  -                    (X509Certificate) ks.getCertificate(certificateAlias);
  -
  -
  -            sig.addKeyInfo(cert);
  -            sig.addKeyInfo(cert.getPublicKey());
  -            sig.sign(privateKey);
  -
  -            Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
  -            byte[] canonicalMessage = c14n.canonicalizeSubtree(doc);
  -
  -            InputSource is = new InputSource(new java.io.ByteArrayInputStream(canonicalMessage));
  -            DeserializationContextImpl dser = null;
  -            if (msgContext == null) {
  -                AxisClient tmpEngine = new AxisClient(new NullProvider());
  -                msgContext = new MessageContext(tmpEngine);
  -            }
  -            dser = new DeserializationContextImpl(is, msgContext,
  -                    Message.REQUEST, this);
  -
  -            dser.parse();
  -            System.out.println("Client signing complete.");
  -        } catch (Exception e) {
  -            e.printStackTrace();
  -            throw new RuntimeException(e.toString());
  -        }
  -    }
  -
  -    private Document getSOAPEnvelopeAsDocument(SOAPEnvelope env, MessageContext msgContext)
  -            throws Exception {
  -        StringWriter writer = new StringWriter();
  -        SerializationContext serializeContext = new SerializationContextImpl(writer, msgContext);
  -        env.output(serializeContext);
  -        writer.close();
  -
  -        Reader reader = new StringReader(writer.getBuffer().toString());
  -        Document doc = XMLUtils.newDocument(new InputSource(reader));
  -        if (doc == null)
  -            throw new Exception(
  -                    JavaUtils.getMessage("noDoc00", writer.getBuffer().toString()));
  -        return doc;
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package samples.security;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.Message;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.client.AxisClient;
  +import org.apache.axis.configuration.NullProvider;
  +import org.apache.axis.encoding.DeserializationContextImpl;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializationContextImpl;
  +import org.apache.axis.message.SOAPEnvelope;
  +import org.apache.axis.message.SOAPHeaderElement;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.utils.Mapping;
  +import org.apache.axis.utils.XMLUtils;
  +import org.apache.xml.security.c14n.Canonicalizer;
  +import org.apache.xml.security.signature.XMLSignature;
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
  +import org.xml.sax.InputSource;
  +
  +import java.io.FileInputStream;
  +import java.io.Reader;
  +import java.io.StringReader;
  +import java.io.StringWriter;
  +import java.security.KeyStore;
  +import java.security.PrivateKey;
  +import java.security.cert.X509Certificate;
  +
  +public class SignedSOAPEnvelope extends SOAPEnvelope {
  +    static String SOAPSECNS = "http://schemas.xmlsoap.org/soap/security/2000-12";
  +    static String SOAPSECprefix = "SOAP-SEC";
  +
  +    static String keystoreType = "JKS";
  +    static String keystoreFile = "keystore.jks";
  +    static String keystorePass = "xmlsecurity";
  +    static String privateKeyAlias = "test";
  +    static String privateKeyPass = "xmlsecurity";
  +    static String certificateAlias = "test";
  +    private MessageContext msgContext;
  +
  +    static {
  +        org.apache.xml.security.Init.init();
  +    }
  +
  +    public SignedSOAPEnvelope(MessageContext msgContext, SOAPEnvelope env, String baseURI, String keystoreFile) {
  +        this.msgContext = msgContext;
  +        init(env, baseURI, keystoreFile);
  +    }
  +
  +    public SignedSOAPEnvelope(SOAPEnvelope env, String baseURI) {
  +        init(env, baseURI, keystoreFile);
  +    }
  +
  +    private void init(SOAPEnvelope env, String baseURI, String keystoreFile) {
  +        try {
  +            System.out.println("Beginning Client signing...");
  +            env.addMapping(new Mapping(SOAPSECNS, SOAPSECprefix));
  +            env.addAttribute(Constants.NS_URI_SOAP_ENV, "actor", "some-uri");
  +            env.addAttribute(Constants.NS_URI_SOAP_ENV, "mustUnderstand", "1");
  +
  +            SOAPHeaderElement header = 
  +                new SOAPHeaderElement(XMLUtils.StringToElement(SOAPSECNS,
  +                                                               "Signature",
  +                                                               ""));
  +            env.addHeader(header);
  +
  +            Document doc = getSOAPEnvelopeAsDocument(env, msgContext);
  +
  +            KeyStore ks = KeyStore.getInstance(keystoreType);
  +            FileInputStream fis = new FileInputStream(keystoreFile);
  +
  +            ks.load(fis, keystorePass.toCharArray());
  +
  +            PrivateKey privateKey = (PrivateKey) ks.getKey(privateKeyAlias,
  +                    privateKeyPass.toCharArray());
  +
  +            Element soapHeaderElement = (Element) ((Element) doc.getFirstChild()).getElementsByTagNameNS("*", "Header").item(0);
  +            Element soapSignatureElement = (Element) soapHeaderElement.getElementsByTagNameNS("*", "Signature").item(0);
  +
  +            XMLSignature sig = new XMLSignature(doc, baseURI,
  +                    XMLSignature.ALGO_ID_SIGNATURE_DSA);
  +
  +            soapSignatureElement.appendChild(sig.getElement());
  +            sig.addDocument("#Body");
  +
  +
  +            X509Certificate cert =
  +                    (X509Certificate) ks.getCertificate(certificateAlias);
  +
  +
  +            sig.addKeyInfo(cert);
  +            sig.addKeyInfo(cert.getPublicKey());
  +            sig.sign(privateKey);
  +
  +            Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
  +            byte[] canonicalMessage = c14n.canonicalizeSubtree(doc);
  +
  +            InputSource is = new InputSource(new java.io.ByteArrayInputStream(canonicalMessage));
  +            DeserializationContextImpl dser = null;
  +            if (msgContext == null) {
  +                AxisClient tmpEngine = new AxisClient(new NullProvider());
  +                msgContext = new MessageContext(tmpEngine);
  +            }
  +            dser = new DeserializationContextImpl(is, msgContext,
  +                    Message.REQUEST, this);
  +
  +            dser.parse();
  +            System.out.println("Client signing complete.");
  +        } catch (Exception e) {
  +            e.printStackTrace();
  +            throw new RuntimeException(e.toString());
  +        }
  +    }
  +
  +    private Document getSOAPEnvelopeAsDocument(SOAPEnvelope env, MessageContext msgContext)
  +            throws Exception {
  +        StringWriter writer = new StringWriter();
  +        SerializationContext serializeContext = new SerializationContextImpl(writer, msgContext);
  +        env.output(serializeContext);
  +        writer.close();
  +
  +        Reader reader = new StringReader(writer.getBuffer().toString());
  +        Document doc = XMLUtils.newDocument(new InputSource(reader));
  +        if (doc == null)
  +            throw new Exception(
  +                    JavaUtils.getMessage("noDoc00", writer.getBuffer().toString()));
  +        return doc;
  +    }
  +}
  
  
  
  1.10      +74 -74    xml-axis/java/samples/transport/FileTransport.java
  
  Index: FileTransport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/FileTransport.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- FileTransport.java	30 May 2002 03:06:05 -0000	1.9
  +++ FileTransport.java	30 May 2002 23:46:00 -0000	1.10
  @@ -1,74 +1,74 @@
  -/*
  - * 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/>.
  - */
  -
  -package samples.transport;
  -
  -import org.apache.axis.client.Transport;
  -
  -/**
  - * A File Transport class.
  - * 
  - * @author Rob Jellinghaus (robj@unrealities.com)
  - * @author Doug Davis (dug@us.ibm.com)
  - * @author Glen Daniels (gdaniels@allaire.com)
  - */
  -public class FileTransport extends Transport
  -{
  -    public FileTransport()
  -    {
  -        transportName = "FileTransport";
  -    }
  -}
  -
  +/*
  + * 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/>.
  + */
  +
  +package samples.transport;
  +
  +import org.apache.axis.client.Transport;
  +
  +/**
  + * A File Transport class.
  + * 
  + * @author Rob Jellinghaus (robj@unrealities.com)
  + * @author Doug Davis (dug@us.ibm.com)
  + * @author Glen Daniels (gdaniels@allaire.com)
  + */
  +public class FileTransport extends Transport
  +{
  +    public FileTransport()
  +    {
  +        transportName = "FileTransport";
  +    }
  +}
  +
  
  
  
  1.8       +84 -84    xml-axis/java/src/org/apache/axis/EngineConfigurationFactory.java
  
  Index: EngineConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/EngineConfigurationFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EngineConfigurationFactory.java	30 May 2002 03:06:06 -0000	1.7
  +++ EngineConfigurationFactory.java	30 May 2002 23:46:00 -0000	1.8
  @@ -1,84 +1,84 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2002 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/>.
  - */
  -
  -package org.apache.axis;
  -
  -/**
  - * EngineConfigurationFactory is an interface used to construct
  - * concrete EngineConfiguration instances.
  - *
  - * @author Glyn Normington (glyn@apache.org)
  - */
  -public interface EngineConfigurationFactory {
  -    /**
  -     * Property name used for setting an EngineConfiguration to be used
  -     * in creating engines.
  -     */
  -    public static final String SYSTEM_PROPERTY_NAME = "axis.EngineConfigFactory";
  -
  -     /**
  -     * Get a default client engine configuration.
  -     *
  -     * @return a client EngineConfiguration
  -     */
  -    public EngineConfiguration getClientEngineConfig();
  -
  -    /**
  -     * Get a default server engine configuration.
  -     *
  -     * @return a server EngineConfiguration
  -     */
  -    public EngineConfiguration getServerEngineConfig();
  -}
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2002 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/>.
  + */
  +
  +package org.apache.axis;
  +
  +/**
  + * EngineConfigurationFactory is an interface used to construct
  + * concrete EngineConfiguration instances.
  + *
  + * @author Glyn Normington (glyn@apache.org)
  + */
  +public interface EngineConfigurationFactory {
  +    /**
  +     * Property name used for setting an EngineConfiguration to be used
  +     * in creating engines.
  +     */
  +    public static final String SYSTEM_PROPERTY_NAME = "axis.EngineConfigFactory";
  +
  +     /**
  +     * Get a default client engine configuration.
  +     *
  +     * @return a client EngineConfiguration
  +     */
  +    public EngineConfiguration getClientEngineConfig();
  +
  +    /**
  +     * Get a default server engine configuration.
  +     *
  +     * @return a server EngineConfiguration
  +     */
  +    public EngineConfiguration getServerEngineConfig();
  +}
  
  
  
  1.18      +136 -136  xml-axis/java/src/org/apache/axis/client/Transport.java
  
  Index: Transport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Transport.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Transport.java	30 May 2002 03:06:06 -0000	1.17
  +++ Transport.java	30 May 2002 23:46:00 -0000	1.18
  @@ -1,136 +1,136 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.client;
  -
  -import org.apache.axis.AxisEngine;
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.MessageContext;
  -
  -public class Transport {
  -
  -    /**
  -     * Transport Chain Name - so users can change the default.
  -     */
  -    public String transportName = null ;
  -
  -    /**
  -     * Transport URL, if any.
  -     */
  -    public String url = null;
  -
  -    public final void setupMessageContext(MessageContext context,
  -                                          Call message,
  -                                          AxisEngine engine)
  -        throws AxisFault
  -    {
  -        if (url != null)
  -            context.setProperty(MessageContext.TRANS_URL, url);
  -
  -        if (transportName != null)
  -            context.setTransportName(transportName);
  -
  -        setupMessageContextImpl(context, message, engine);
  -    }
  -
  -    public void setupMessageContextImpl(MessageContext context,
  -                                        Call message,
  -                                        AxisEngine engine)
  -        throws AxisFault
  -    {
  -        // Default impl does nothing
  -    }
  -
  -    /**
  -     * Allow the transport to grab any transport-specific stuff it might
  -     * want from a returned MessageContext
  -     */
  -    public void processReturnedMessageContext(MessageContext context)
  -    {
  -        // Default impl does nothing
  -    }
  -
  -    /**
  -     * Sets the transport chain name - to override the default.
  -     * @param name the name of the transport chain to use
  -     */
  -    public void setTransportName(String name) {
  -        transportName = name ;
  -    }
  -
  -    /**
  -     * Returns the name of the transport chain to use
  -     * @return the transport chain name (or null if the default chain)
  -     */
  -    public String getTransportName() {
  -        return( transportName );
  -    }
  -
  -    /**
  -     * Get the transport-specific URL
  -     */
  -    public String getUrl() {
  -        return url;
  -    }
  -
  -    /**
  -     * Set the transport-specific URL
  -     */
  -    public void setUrl(String url) {
  -        this.url = url;
  -    }
  -}
  -
  -
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.client;
  +
  +import org.apache.axis.AxisEngine;
  +import org.apache.axis.AxisFault;
  +import org.apache.axis.MessageContext;
  +
  +public class Transport {
  +
  +    /**
  +     * Transport Chain Name - so users can change the default.
  +     */
  +    public String transportName = null ;
  +
  +    /**
  +     * Transport URL, if any.
  +     */
  +    public String url = null;
  +
  +    public final void setupMessageContext(MessageContext context,
  +                                          Call message,
  +                                          AxisEngine engine)
  +        throws AxisFault
  +    {
  +        if (url != null)
  +            context.setProperty(MessageContext.TRANS_URL, url);
  +
  +        if (transportName != null)
  +            context.setTransportName(transportName);
  +
  +        setupMessageContextImpl(context, message, engine);
  +    }
  +
  +    public void setupMessageContextImpl(MessageContext context,
  +                                        Call message,
  +                                        AxisEngine engine)
  +        throws AxisFault
  +    {
  +        // Default impl does nothing
  +    }
  +
  +    /**
  +     * Allow the transport to grab any transport-specific stuff it might
  +     * want from a returned MessageContext
  +     */
  +    public void processReturnedMessageContext(MessageContext context)
  +    {
  +        // Default impl does nothing
  +    }
  +
  +    /**
  +     * Sets the transport chain name - to override the default.
  +     * @param name the name of the transport chain to use
  +     */
  +    public void setTransportName(String name) {
  +        transportName = name ;
  +    }
  +
  +    /**
  +     * Returns the name of the transport chain to use
  +     * @return the transport chain name (or null if the default chain)
  +     */
  +    public String getTransportName() {
  +        return( transportName );
  +    }
  +
  +    /**
  +     * Get the transport-specific URL
  +     */
  +    public String getUrl() {
  +        return url;
  +    }
  +
  +    /**
  +     * Set the transport-specific URL
  +     */
  +    public void setUrl(String url) {
  +        this.url = url;
  +    }
  +}
  +
  +
  
  
  
  1.10      +147 -147  xml-axis/java/src/org/apache/axis/configuration/DefaultEngineConfigurationFactory.java
  
  Index: DefaultEngineConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/DefaultEngineConfigurationFactory.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultEngineConfigurationFactory.java	30 May 2002 03:06:06 -0000	1.9
  +++ DefaultEngineConfigurationFactory.java	30 May 2002 23:46:00 -0000	1.10
  @@ -1,147 +1,147 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2002 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/>.
  - */
  -
  -package org.apache.axis.configuration;
  -
  -import org.apache.axis.EngineConfigurationFactory;
  -import org.apache.axis.EngineConfiguration;
  -import org.apache.axis.utils.JavaUtils;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -
  -/**
  - * This is a default implementation of EngineConfigurationFactory.
  - * It is user-overrideable by a system property without affecting
  - * the caller. If you decide to override it, use delegation if
  - * you want to inherit the behaviour of this class as using
  - * class extension will result in tight loops. That is, your
  - * class should implement EngineConfigurationFactory and keep
  - * an instance of this class in a member field and delegate
  - * methods to that instance when the default behaviour is
  - * required.
  - *
  - * @author Glyn Normington (glyn@apache.org)
  - */
  -public class DefaultEngineConfigurationFactory implements EngineConfigurationFactory
  -{
  -    protected static Log log =
  -        LogFactory.getLog(DefaultEngineConfigurationFactory.class.getName());
  -
  -    protected static final String CLIENT_CONFIG_FILE = "client-config.wsdd";
  -    protected static final String SERVER_CONFIG_FILE = "server-config.wsdd";
  -
  -    protected EngineConfigurationFactory userFactory = null;
  -
  -    private String clientConfigFile;
  -
  -    private String serverConfigFile;
  -
  -    /**
  -     * Create the default engine configuration and detect whether the user
  -     * has overridden this with their own.
  -     */
  -    public DefaultEngineConfigurationFactory() {
  -        String fClassName =
  -            System.getProperty(EngineConfigurationFactory.SYSTEM_PROPERTY_NAME);
  -
  -        if (fClassName != null) {
  -            try {
  -                userFactory = (EngineConfigurationFactory)Class.
  -                    forName(fClassName).newInstance();
  -            } catch (Exception e) {
  -                // Report diagnostics but use the default factory.
  -                log.error(JavaUtils.getMessage("exception00"), e);
  -            }
  -        }
  -
  -        clientConfigFile = System.getProperty("axis.ClientConfigFile");
  -        if (clientConfigFile == null) {
  -            clientConfigFile = CLIENT_CONFIG_FILE;
  -        }
  -
  -        serverConfigFile = System.getProperty("axis.ServerConfigFile");
  -        if (serverConfigFile == null) {
  -            serverConfigFile = SERVER_CONFIG_FILE;
  -        }
  -        
  -    }
  -
  -     /**
  -     * Get a default client engine configuration.
  -     *
  -     * @return a client EngineConfiguration
  -     */
  -    public EngineConfiguration getClientEngineConfig() {
  -        if (userFactory == null) {
  -            return new FileProvider(clientConfigFile);
  -        } else {
  -            return userFactory.getClientEngineConfig();
  -        }
  -    }
  -
  -    /**
  -     * Get a default server engine configuration.
  -     *
  -     * @return a server EngineConfiguration
  -     */
  -    public EngineConfiguration getServerEngineConfig() {
  -        if (userFactory == null) {
  -            return new FileProvider(serverConfigFile);
  -        } else {
  -            return userFactory.getServerEngineConfig();
  -        }
  -    }
  -}
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2002 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/>.
  + */
  +
  +package org.apache.axis.configuration;
  +
  +import org.apache.axis.EngineConfigurationFactory;
  +import org.apache.axis.EngineConfiguration;
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
  +/**
  + * This is a default implementation of EngineConfigurationFactory.
  + * It is user-overrideable by a system property without affecting
  + * the caller. If you decide to override it, use delegation if
  + * you want to inherit the behaviour of this class as using
  + * class extension will result in tight loops. That is, your
  + * class should implement EngineConfigurationFactory and keep
  + * an instance of this class in a member field and delegate
  + * methods to that instance when the default behaviour is
  + * required.
  + *
  + * @author Glyn Normington (glyn@apache.org)
  + */
  +public class DefaultEngineConfigurationFactory implements EngineConfigurationFactory
  +{
  +    protected static Log log =
  +        LogFactory.getLog(DefaultEngineConfigurationFactory.class.getName());
  +
  +    protected static final String CLIENT_CONFIG_FILE = "client-config.wsdd";
  +    protected static final String SERVER_CONFIG_FILE = "server-config.wsdd";
  +
  +    protected EngineConfigurationFactory userFactory = null;
  +
  +    private String clientConfigFile;
  +
  +    private String serverConfigFile;
  +
  +    /**
  +     * Create the default engine configuration and detect whether the user
  +     * has overridden this with their own.
  +     */
  +    public DefaultEngineConfigurationFactory() {
  +        String fClassName =
  +            System.getProperty(EngineConfigurationFactory.SYSTEM_PROPERTY_NAME);
  +
  +        if (fClassName != null) {
  +            try {
  +                userFactory = (EngineConfigurationFactory)Class.
  +                    forName(fClassName).newInstance();
  +            } catch (Exception e) {
  +                // Report diagnostics but use the default factory.
  +                log.error(JavaUtils.getMessage("exception00"), e);
  +            }
  +        }
  +
  +        clientConfigFile = System.getProperty("axis.ClientConfigFile");
  +        if (clientConfigFile == null) {
  +            clientConfigFile = CLIENT_CONFIG_FILE;
  +        }
  +
  +        serverConfigFile = System.getProperty("axis.ServerConfigFile");
  +        if (serverConfigFile == null) {
  +            serverConfigFile = SERVER_CONFIG_FILE;
  +        }
  +        
  +    }
  +
  +     /**
  +     * Get a default client engine configuration.
  +     *
  +     * @return a client EngineConfiguration
  +     */
  +    public EngineConfiguration getClientEngineConfig() {
  +        if (userFactory == null) {
  +            return new FileProvider(clientConfigFile);
  +        } else {
  +            return userFactory.getClientEngineConfig();
  +        }
  +    }
  +
  +    /**
  +     * Get a default server engine configuration.
  +     *
  +     * @return a server EngineConfiguration
  +     */
  +    public EngineConfiguration getServerEngineConfig() {
  +        if (userFactory == null) {
  +            return new FileProvider(serverConfigFile);
  +        } else {
  +            return userFactory.getServerEngineConfig();
  +        }
  +    }
  +}
  
  
  
  1.5       +145 -145  xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java
  
  Index: ServletEngineConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServletEngineConfigurationFactory.java	30 May 2002 03:06:06 -0000	1.4
  +++ ServletEngineConfigurationFactory.java	30 May 2002 23:46:00 -0000	1.5
  @@ -1,145 +1,145 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2002 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/>.
  - */
  -
  -package org.apache.axis.configuration;
  -
  -import org.apache.axis.EngineConfiguration;
  -import org.apache.axis.ConfigurationException;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -
  -import javax.servlet.ServletContext;
  -
  -import java.io.File;
  -import java.io.InputStream;
  -
  -/**
  - * This is a default implementation of ServletEngineConfigurationFactory.
  - * It is user-overrideable by a system property without affecting
  - * the caller. If you decide to override it, use delegation if
  - * you want to inherit the behaviour of this class as using
  - * class extension will result in tight loops. That is, your
  - * class should implement EngineConfigurationFactory and keep
  - * an instance of this class in a member field and delegate
  - * methods to that instance when the default behaviour is
  - * required.
  - *
  - * @author Davanum Srinivas (dims@apache.org)
  - */
  -public class ServletEngineConfigurationFactory extends DefaultEngineConfigurationFactory {
  -    protected static Log log =
  -        LogFactory.getLog(ServletEngineConfigurationFactory.class.getName());
  -
  -    private ServletContext ctx;
  -    
  -    /**
  -     * Create the default engine configuration and detect whether the user
  -     * has overridden this with their own.
  -     */
  -    public ServletEngineConfigurationFactory(ServletContext ctx) {
  -        super();
  -        this.ctx = ctx;
  -    }
  -
  -    /**
  -     * Get a default server engine configuration.
  -     *
  -     * @return a server EngineConfiguration
  -     */
  -    public EngineConfiguration getServerEngineConfig() {
  -        return getServerEngineConfig(ctx);
  -    }
  -
  -    /**
  -     * Get a default server engine configuration in a servlet environment.
  -     *
  -     * @param ctx a ServletContext
  -     * @return a server EngineConfiguration
  -     */
  -    private EngineConfiguration getServerEngineConfig(ServletContext ctx) {
  -        if (userFactory == null) {
  -            /*
  -             * Use the WEB-INF directory (so the config files can't get
  -             * snooped by a browser)
  -             */
  -            String webInfPath = ctx.getRealPath("/WEB-INF");
  - 
  -            FileProvider config = null ;
  -
  -            if (webInfPath == null || !(new File(webInfPath,
  -                                                 SERVER_CONFIG_FILE)).exists()){
  -                InputStream is = ctx.getResourceAsStream("/WEB-INF/"+
  -                                                         SERVER_CONFIG_FILE);
  -                if (is == null) {
  -                    // !!! THROW EXCEPTION
  -                }
  -                config = new FileProvider(is);
  -            }
  -            if ( config == null ) {
  -                try {
  -                    config = new FileProvider(webInfPath,
  -                                              SERVER_CONFIG_FILE);
  -                } catch (ConfigurationException ex) {
  -                    log.error(JavaUtils.getMessage
  -                              ("servletEngineWebInfError00"), ex);
  -                }
  -            }
  -            return config;
  -        } else {
  -            return userFactory.getServerEngineConfig();
  -        }
  -    }
  -}
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2002 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/>.
  + */
  +
  +package org.apache.axis.configuration;
  +
  +import org.apache.axis.EngineConfiguration;
  +import org.apache.axis.ConfigurationException;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
  +import javax.servlet.ServletContext;
  +
  +import java.io.File;
  +import java.io.InputStream;
  +
  +/**
  + * This is a default implementation of ServletEngineConfigurationFactory.
  + * It is user-overrideable by a system property without affecting
  + * the caller. If you decide to override it, use delegation if
  + * you want to inherit the behaviour of this class as using
  + * class extension will result in tight loops. That is, your
  + * class should implement EngineConfigurationFactory and keep
  + * an instance of this class in a member field and delegate
  + * methods to that instance when the default behaviour is
  + * required.
  + *
  + * @author Davanum Srinivas (dims@apache.org)
  + */
  +public class ServletEngineConfigurationFactory extends DefaultEngineConfigurationFactory {
  +    protected static Log log =
  +        LogFactory.getLog(ServletEngineConfigurationFactory.class.getName());
  +
  +    private ServletContext ctx;
  +    
  +    /**
  +     * Create the default engine configuration and detect whether the user
  +     * has overridden this with their own.
  +     */
  +    public ServletEngineConfigurationFactory(ServletContext ctx) {
  +        super();
  +        this.ctx = ctx;
  +    }
  +
  +    /**
  +     * Get a default server engine configuration.
  +     *
  +     * @return a server EngineConfiguration
  +     */
  +    public EngineConfiguration getServerEngineConfig() {
  +        return getServerEngineConfig(ctx);
  +    }
  +
  +    /**
  +     * Get a default server engine configuration in a servlet environment.
  +     *
  +     * @param ctx a ServletContext
  +     * @return a server EngineConfiguration
  +     */
  +    private EngineConfiguration getServerEngineConfig(ServletContext ctx) {
  +        if (userFactory == null) {
  +            /*
  +             * Use the WEB-INF directory (so the config files can't get
  +             * snooped by a browser)
  +             */
  +            String webInfPath = ctx.getRealPath("/WEB-INF");
  + 
  +            FileProvider config = null ;
  +
  +            if (webInfPath == null || !(new File(webInfPath,
  +                                                 SERVER_CONFIG_FILE)).exists()){
  +                InputStream is = ctx.getResourceAsStream("/WEB-INF/"+
  +                                                         SERVER_CONFIG_FILE);
  +                if (is == null) {
  +                    // !!! THROW EXCEPTION
  +                }
  +                config = new FileProvider(is);
  +            }
  +            if ( config == null ) {
  +                try {
  +                    config = new FileProvider(webInfPath,
  +                                              SERVER_CONFIG_FILE);
  +                } catch (ConfigurationException ex) {
  +                    log.error(JavaUtils.getMessage
  +                              ("servletEngineWebInfError00"), ex);
  +                }
  +            }
  +            return config;
  +        } else {
  +            return userFactory.getServerEngineConfig();
  +        }
  +    }
  +}
  
  
  
  1.30      +397 -397  xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java
  
  Index: WSDDDeployableItem.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- WSDDDeployableItem.java	30 May 2002 03:06:07 -0000	1.29
  +++ WSDDDeployableItem.java	30 May 2002 23:46:00 -0000	1.30
  @@ -1,397 +1,397 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.deployment.wsdd;
  -
  -import org.apache.axis.Handler;
  -import org.apache.axis.Constants;
  -import org.apache.axis.EngineConfiguration;
  -import org.apache.axis.ConfigurationException;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.deployment.DeployableItem;
  -import org.apache.axis.deployment.DeploymentRegistry;
  -import org.apache.axis.deployment.DeploymentException;
  -import org.apache.axis.utils.LockableHashtable;
  -import org.apache.axis.utils.XMLUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.w3c.dom.Document;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  -import org.xml.sax.helpers.AttributesImpl;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.util.Hashtable;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.Set;
  -import java.io.IOException;
  -
  -
  -/**
  - * WSDD DeployableItem complexType
  - *
  - */
  -public abstract class WSDDDeployableItem
  -    extends WSDDElement
  -    implements DeployableItem
  -{
  -    public static final int SCOPE_PER_ACCESS = 0;
  -    public static final int SCOPE_PER_REQUEST = 1;
  -    public static final int SCOPE_SINGLETON = 2;
  -    public static String [] scopeStrings = { "per-access",
  -                                             "per-request",
  -                                             "singleton" };
  -    
  -    protected static Log log =
  -        LogFactory.getLog(WSDDDeployableItem.class.getName());
  -
  -    /** Our parameters */
  -    LockableHashtable parameters;
  -
  -    /** Our name */
  -    QName qname;
  -    
  -    /** Our type */
  -    QName type;
  -    
  -    /** Scope for this item (default is singleton) */
  -    int scope = SCOPE_SINGLETON;
  -    
  -    /** Placeholder for hanging on to singleton object */
  -    Handler singletonInstance = null;
  -
  -    /**
  -     * Default constructor
  -     */ 
  -    public WSDDDeployableItem()
  -    {
  -    }
  -    
  -    /**
  -     *
  -     * @param e (Element) XXX
  -     * @param n (String) XXX
  -     * @throws WSDDException XXX
  -     */
  -    public WSDDDeployableItem(Element e)
  -        throws WSDDException
  -    {
  -        super(e);
  -        
  -        String name = e.getAttribute(ATTR_NAME);
  -        if (name != null && !name.equals("")) {
  -//            qname = XMLUtils.getQNameFromString(name, e);
  -            qname = new QName("", name);
  -        }
  -        
  -        String typeStr = e.getAttribute(ATTR_TYPE);
  -        if (typeStr != null && !typeStr.equals("")) {
  -            type = XMLUtils.getQNameFromString(typeStr, e);
  -        }
  -
  -        // Figure out our scope - right now if a non-recognized scope
  -        // attribute appears, we will ignore it and use the default
  -        // scope.  Is this right, or should we throw an error?
  -        String scopeStr = e.getAttribute(ATTR_SCOPE);
  -        if (scopeStr != null) {
  -            for (int i = 0; i < scopeStrings.length; i++) {
  -                if (scopeStr.equals(scopeStrings[i])) {
  -                    scope = i;
  -                    break;
  -                }
  -            }
  -        }
  -
  -        if (parameters == null)
  -            parameters = new LockableHashtable();
  -        
  -        // Load up our params
  -        Element [] paramElements = getChildElements(e, ELEM_WSDD_PARAM);
  -        for (int i = 0; i < paramElements.length; i++) {
  -            Element param = paramElements[i];
  -            String pname = param.getAttribute(ATTR_NAME);
  -            String value = param.getAttribute(ATTR_VALUE);
  -            String locked = param.getAttribute(ATTR_LOCKED);
  -            parameters.put(pname, value, (locked != null &&
  -                                    locked.equalsIgnoreCase("true")));
  -        }
  -    }
  -
  -    /**
  -     *
  -     * @param name XXX
  -     */
  -    public void setName(String name)
  -    {
  -        qname = new QName(null, name);
  -    }
  -    
  -    public void setQName(QName qname)
  -    {
  -        this.qname = qname;
  -    }
  -
  -    /**
  -     *
  -     * @return XXX
  -     */
  -    public QName getQName()
  -    {
  -        return qname;
  -    }
  -
  -    /**
  -     *
  -     * @return XXX
  -     */
  -    public QName getType()
  -    {
  -        return type;
  -    }
  -
  -    /**
  -     *
  -     * @param type XXX
  -     */
  -    public void setType(QName type)
  -    {
  -        this.type = type;
  -    }
  -
  -    /**
  -     * Set a parameter
  -     */ 
  -    public void setParameter(String name, String value)
  -    {
  -        if (parameters == null)
  -            parameters = new LockableHashtable();
  -        parameters.put(name, value);
  -    }
  -    
  -    /**
  -     * Get the value of one of our parameters
  -     */ 
  -    public String getParameter(String name)
  -    {
  -        if (name == null)
  -            return null;
  -        
  -        return (String)parameters.get(name);
  -    }
  -    
  -    /**
  -     * Returns the config parameters as a hashtable (lockable)
  -     * @return XXX
  -     */
  -    public LockableHashtable getParametersTable()
  -    {
  -        return parameters;
  -    }
  -    
  -    /**
  -     * Convenience method for using old deployment XML with WSDD.
  -     * This allows us to set the options directly after the Admin class
  -     * has parsed them out of the old format.
  -     */ 
  -    public void setOptionsHashtable(Hashtable hashtable)
  -    {
  -        if (hashtable == null)
  -            return;
  -        
  -        parameters = new LockableHashtable(hashtable);
  -    }
  -    
  -    public void writeParamsToContext(SerializationContext context)
  -        throws IOException
  -    {
  -        if (parameters == null)
  -            return;
  -
  -        Set entries = parameters.entrySet();
  -        Iterator i = entries.iterator();
  -        while (i.hasNext()) {
  -            Map.Entry entry = (Map.Entry) i.next();
  -            String name = (String) entry.getKey();
  -            AttributesImpl attrs = new AttributesImpl();
  -            
  -            attrs.addAttribute("", ATTR_NAME, ATTR_NAME, "CDATA", name);
  -            attrs.addAttribute("", ATTR_VALUE, ATTR_VALUE, "CDATA", 
  -                                   entry.getValue().toString());
  -            if (parameters.isKeyLocked(name)) {
  -                attrs.addAttribute("", ATTR_LOCKED, ATTR_LOCKED, "CDATA", "true");
  -            }
  -
  -            context.startElement(QNAME_PARAM, attrs);
  -            context.endElement();
  -        }
  -    }
  -
  -    /**
  -     *
  -     * @param name XXX
  -     */
  -    public void removeParameter(String name)
  -    {
  -        parameters.remove(name);
  -    }
  -
  -    /**
  -     *
  -     * @param registry XXX
  -     * @return XXX
  -     * @throws ConfigurationException XXX
  -     */
  -    public final Handler getInstance(EngineConfiguration registry)
  -        throws ConfigurationException
  -    {
  -        if (scope == SCOPE_SINGLETON) {
  -             synchronized (this) {
  -                if (singletonInstance == null)
  -                    singletonInstance = makeNewInstance(registry);
  -            }
  -            return singletonInstance;
  -        }
  -        
  -        return makeNewInstance(registry);
  -    }
  -
  -    /**
  -     * Creates a new instance of this deployable.  if the
  -     * java class is not found, the registry is queried to
  -     * find a suitable item
  -     * @param registry XXX
  -     * @return XXX
  -     * @throws ConfigurationException XXX
  -     */
  -    protected Handler makeNewInstance(EngineConfiguration registry)
  -        throws ConfigurationException
  -    {
  -        Class   c = null;
  -        Handler h = null;
  -
  -        try {
  -            c = getJavaClass();
  -        } catch (ClassNotFoundException e) {
  -            throw new ConfigurationException(e);
  -        }
  -
  -        if (c != null) {
  -
  -            try {
  -                h = (Handler)createInstance(c);
  -            } catch (Exception e) {
  -                throw new ConfigurationException(e);
  -            }
  -
  -            if (h != null) {
  -                if ( qname != null )
  -                  h.setName(qname.getLocalPart()); 
  -                h.setOptions(getParametersTable());
  -                try{
  -                  h.init();
  -                }catch(Exception e){
  -                    String msg=e + NL +stackToString(e);
  -                    log.debug(msg);
  -                    throw new ConfigurationException(e);
  -                }catch(Error e){
  -                    String msg=e + NL +stackToString(e);
  -                    log.debug(msg);
  -                    throw new ConfigurationException(msg);
  -                }
  -            }
  -        } else {
  -            h = registry.getHandler(getType());
  -        }
  -        
  -        return h;
  -    }
  -
  -    /**
  -     *
  -     * @param _class XXX
  -     * @return XXX
  -     * @throws Exception XXX
  -     */
  -    Object createInstance(Class _class)
  -        throws InstantiationException, IllegalAccessException
  -    {
  -        return _class.newInstance();
  -    }
  -
  -    /**
  -     *
  -     * @param type XXX
  -     * @return XXX
  -     * @throws ClassNotFoundException XXX
  -     */
  -    public Class getJavaClass()
  -        throws ClassNotFoundException
  -    {
  -        QName type = getType();
  -        if (type != null &&
  -                NS_URI_WSDD_JAVA.equals(type.getNamespaceURI())) {
  -            return Class.forName(type.getLocalPart());
  -        }
  -        return null;
  -    }
  -
  -    protected static String stackToString(Throwable e){
  -      java.io.StringWriter sw= new java.io.StringWriter(1024); 
  -      java.io.PrintWriter pw= new java.io.PrintWriter(sw); 
  -      e.printStackTrace(pw);
  -      pw.close();
  -      return sw.toString();
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.deployment.wsdd;
  +
  +import org.apache.axis.Handler;
  +import org.apache.axis.Constants;
  +import org.apache.axis.EngineConfiguration;
  +import org.apache.axis.ConfigurationException;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.deployment.DeployableItem;
  +import org.apache.axis.deployment.DeploymentRegistry;
  +import org.apache.axis.deployment.DeploymentException;
  +import org.apache.axis.utils.LockableHashtable;
  +import org.apache.axis.utils.XMLUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Node;
  +import org.xml.sax.helpers.AttributesImpl;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.util.Hashtable;
  +import java.util.Iterator;
  +import java.util.Map;
  +import java.util.Set;
  +import java.io.IOException;
  +
  +
  +/**
  + * WSDD DeployableItem complexType
  + *
  + */
  +public abstract class WSDDDeployableItem
  +    extends WSDDElement
  +    implements DeployableItem
  +{
  +    public static final int SCOPE_PER_ACCESS = 0;
  +    public static final int SCOPE_PER_REQUEST = 1;
  +    public static final int SCOPE_SINGLETON = 2;
  +    public static String [] scopeStrings = { "per-access",
  +                                             "per-request",
  +                                             "singleton" };
  +    
  +    protected static Log log =
  +        LogFactory.getLog(WSDDDeployableItem.class.getName());
  +
  +    /** Our parameters */
  +    LockableHashtable parameters;
  +
  +    /** Our name */
  +    QName qname;
  +    
  +    /** Our type */
  +    QName type;
  +    
  +    /** Scope for this item (default is singleton) */
  +    int scope = SCOPE_SINGLETON;
  +    
  +    /** Placeholder for hanging on to singleton object */
  +    Handler singletonInstance = null;
  +
  +    /**
  +     * Default constructor
  +     */ 
  +    public WSDDDeployableItem()
  +    {
  +    }
  +    
  +    /**
  +     *
  +     * @param e (Element) XXX
  +     * @param n (String) XXX
  +     * @throws WSDDException XXX
  +     */
  +    public WSDDDeployableItem(Element e)
  +        throws WSDDException
  +    {
  +        super(e);
  +        
  +        String name = e.getAttribute(ATTR_NAME);
  +        if (name != null && !name.equals("")) {
  +//            qname = XMLUtils.getQNameFromString(name, e);
  +            qname = new QName("", name);
  +        }
  +        
  +        String typeStr = e.getAttribute(ATTR_TYPE);
  +        if (typeStr != null && !typeStr.equals("")) {
  +            type = XMLUtils.getQNameFromString(typeStr, e);
  +        }
  +
  +        // Figure out our scope - right now if a non-recognized scope
  +        // attribute appears, we will ignore it and use the default
  +        // scope.  Is this right, or should we throw an error?
  +        String scopeStr = e.getAttribute(ATTR_SCOPE);
  +        if (scopeStr != null) {
  +            for (int i = 0; i < scopeStrings.length; i++) {
  +                if (scopeStr.equals(scopeStrings[i])) {
  +                    scope = i;
  +                    break;
  +                }
  +            }
  +        }
  +
  +        if (parameters == null)
  +            parameters = new LockableHashtable();
  +        
  +        // Load up our params
  +        Element [] paramElements = getChildElements(e, ELEM_WSDD_PARAM);
  +        for (int i = 0; i < paramElements.length; i++) {
  +            Element param = paramElements[i];
  +            String pname = param.getAttribute(ATTR_NAME);
  +            String value = param.getAttribute(ATTR_VALUE);
  +            String locked = param.getAttribute(ATTR_LOCKED);
  +            parameters.put(pname, value, (locked != null &&
  +                                    locked.equalsIgnoreCase("true")));
  +        }
  +    }
  +
  +    /**
  +     *
  +     * @param name XXX
  +     */
  +    public void setName(String name)
  +    {
  +        qname = new QName(null, name);
  +    }
  +    
  +    public void setQName(QName qname)
  +    {
  +        this.qname = qname;
  +    }
  +
  +    /**
  +     *
  +     * @return XXX
  +     */
  +    public QName getQName()
  +    {
  +        return qname;
  +    }
  +
  +    /**
  +     *
  +     * @return XXX
  +     */
  +    public QName getType()
  +    {
  +        return type;
  +    }
  +
  +    /**
  +     *
  +     * @param type XXX
  +     */
  +    public void setType(QName type)
  +    {
  +        this.type = type;
  +    }
  +
  +    /**
  +     * Set a parameter
  +     */ 
  +    public void setParameter(String name, String value)
  +    {
  +        if (parameters == null)
  +            parameters = new LockableHashtable();
  +        parameters.put(name, value);
  +    }
  +    
  +    /**
  +     * Get the value of one of our parameters
  +     */ 
  +    public String getParameter(String name)
  +    {
  +        if (name == null)
  +            return null;
  +        
  +        return (String)parameters.get(name);
  +    }
  +    
  +    /**
  +     * Returns the config parameters as a hashtable (lockable)
  +     * @return XXX
  +     */
  +    public LockableHashtable getParametersTable()
  +    {
  +        return parameters;
  +    }
  +    
  +    /**
  +     * Convenience method for using old deployment XML with WSDD.
  +     * This allows us to set the options directly after the Admin class
  +     * has parsed them out of the old format.
  +     */ 
  +    public void setOptionsHashtable(Hashtable hashtable)
  +    {
  +        if (hashtable == null)
  +            return;
  +        
  +        parameters = new LockableHashtable(hashtable);
  +    }
  +    
  +    public void writeParamsToContext(SerializationContext context)
  +        throws IOException
  +    {
  +        if (parameters == null)
  +            return;
  +
  +        Set entries = parameters.entrySet();
  +        Iterator i = entries.iterator();
  +        while (i.hasNext()) {
  +            Map.Entry entry = (Map.Entry) i.next();
  +            String name = (String) entry.getKey();
  +            AttributesImpl attrs = new AttributesImpl();
  +            
  +            attrs.addAttribute("", ATTR_NAME, ATTR_NAME, "CDATA", name);
  +            attrs.addAttribute("", ATTR_VALUE, ATTR_VALUE, "CDATA", 
  +                                   entry.getValue().toString());
  +            if (parameters.isKeyLocked(name)) {
  +                attrs.addAttribute("", ATTR_LOCKED, ATTR_LOCKED, "CDATA", "true");
  +            }
  +
  +            context.startElement(QNAME_PARAM, attrs);
  +            context.endElement();
  +        }
  +    }
  +
  +    /**
  +     *
  +     * @param name XXX
  +     */
  +    public void removeParameter(String name)
  +    {
  +        parameters.remove(name);
  +    }
  +
  +    /**
  +     *
  +     * @param registry XXX
  +     * @return XXX
  +     * @throws ConfigurationException XXX
  +     */
  +    public final Handler getInstance(EngineConfiguration registry)
  +        throws ConfigurationException
  +    {
  +        if (scope == SCOPE_SINGLETON) {
  +             synchronized (this) {
  +                if (singletonInstance == null)
  +                    singletonInstance = makeNewInstance(registry);
  +            }
  +            return singletonInstance;
  +        }
  +        
  +        return makeNewInstance(registry);
  +    }
  +
  +    /**
  +     * Creates a new instance of this deployable.  if the
  +     * java class is not found, the registry is queried to
  +     * find a suitable item
  +     * @param registry XXX
  +     * @return XXX
  +     * @throws ConfigurationException XXX
  +     */
  +    protected Handler makeNewInstance(EngineConfiguration registry)
  +        throws ConfigurationException
  +    {
  +        Class   c = null;
  +        Handler h = null;
  +
  +        try {
  +            c = getJavaClass();
  +        } catch (ClassNotFoundException e) {
  +            throw new ConfigurationException(e);
  +        }
  +
  +        if (c != null) {
  +
  +            try {
  +                h = (Handler)createInstance(c);
  +            } catch (Exception e) {
  +                throw new ConfigurationException(e);
  +            }
  +
  +            if (h != null) {
  +                if ( qname != null )
  +                  h.setName(qname.getLocalPart()); 
  +                h.setOptions(getParametersTable());
  +                try{
  +                  h.init();
  +                }catch(Exception e){
  +                    String msg=e + NL +stackToString(e);
  +                    log.debug(msg);
  +                    throw new ConfigurationException(e);
  +                }catch(Error e){
  +                    String msg=e + NL +stackToString(e);
  +                    log.debug(msg);
  +                    throw new ConfigurationException(msg);
  +                }
  +            }
  +        } else {
  +            h = registry.getHandler(getType());
  +        }
  +        
  +        return h;
  +    }
  +
  +    /**
  +     *
  +     * @param _class XXX
  +     * @return XXX
  +     * @throws Exception XXX
  +     */
  +    Object createInstance(Class _class)
  +        throws InstantiationException, IllegalAccessException
  +    {
  +        return _class.newInstance();
  +    }
  +
  +    /**
  +     *
  +     * @param type XXX
  +     * @return XXX
  +     * @throws ClassNotFoundException XXX
  +     */
  +    public Class getJavaClass()
  +        throws ClassNotFoundException
  +    {
  +        QName type = getType();
  +        if (type != null &&
  +                NS_URI_WSDD_JAVA.equals(type.getNamespaceURI())) {
  +            return Class.forName(type.getLocalPart());
  +        }
  +        return null;
  +    }
  +
  +    protected static String stackToString(Throwable e){
  +      java.io.StringWriter sw= new java.io.StringWriter(1024); 
  +      java.io.PrintWriter pw= new java.io.PrintWriter(sw); 
  +      e.printStackTrace(pw);
  +      pw.close();
  +      return sw.toString();
  +    }
  +}
  
  
  
  1.66      +583 -583  xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- WSDDService.java	30 May 2002 03:06:07 -0000	1.65
  +++ WSDDService.java	30 May 2002 23:46:00 -0000	1.66
  @@ -1,583 +1,583 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.deployment.wsdd;
  -
  -import org.apache.axis.AxisEngine;
  -import org.apache.axis.ConfigurationException;
  -import org.apache.axis.Constants;
  -import org.apache.axis.EngineConfiguration;
  -import org.apache.axis.FaultableHandler;
  -import org.apache.axis.Handler;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.description.ServiceDesc;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.TypeMappingRegistryImpl;
  -import org.apache.axis.encoding.ser.BaseDeserializerFactory;
  -import org.apache.axis.encoding.ser.BaseSerializerFactory;
  -import org.apache.axis.handlers.soap.SOAPService;
  -import org.apache.axis.providers.java.JavaProvider;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.XMLUtils;
  -import org.w3c.dom.Element;
  -import org.xml.sax.helpers.AttributesImpl;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -import java.util.ArrayList;
  -import java.util.StringTokenizer;
  -import java.util.Vector;
  -
  -/**
  - *
  - */
  -public class WSDDService
  -    extends WSDDTargetedChain
  -    implements WSDDTypeMappingContainer
  -{
  -    private TypeMappingRegistry tmr = null;
  -
  -    private Vector faultFlows = new Vector();
  -    private Vector typeMappings = new Vector();
  -    private Vector operations = new Vector();
  -
  -    /** Which namespaces should auto-dispatch to this service? */
  -    private Vector namespaces = new Vector();
  -
  -    private String descriptionURL;
  -
  -    /** Style - document or RPC (the default) */
  -    private int style = ServiceDesc.STYLE_RPC;
  -
  -    private SOAPService cachedService = null;
  -
  -    /**
  -     * Our provider - used to figure out which Handler we use as a service
  -     * pivot (see getInstance() below)
  -     */
  -    private QName providerQName;
  -
  -    ServiceDesc desc = new ServiceDesc();
  -
  -    /**
  -     * Is streaming (i.e. NO high-fidelity recording, deserialize on the fly)
  -     * on for this service?
  -     */
  -    private boolean streaming = false;
  -
  -    /**
  -     * Default constructor
  -     */
  -    public WSDDService()
  -    {
  -    }
  -
  -    /**
  -     *
  -     * @param e (Element) XXX
  -     * @throws WSDDException XXX
  -     */
  -    public WSDDService(Element e)
  -        throws WSDDException
  -    {
  -        super(e);
  -
  -        desc.setName(getQName().getLocalPart());
  -
  -        String styleStr = e.getAttribute(ATTR_STYLE);
  -        if (styleStr != null && !styleStr.equals("")) {
  -            style = MessageContext.getStyleFromString(styleStr);
  -            desc.setStyle(style);
  -            switch (style) {
  -                case ServiceDesc.STYLE_MESSAGE:
  -                    providerQName = WSDDConstants.QNAME_JAVAMSG_PROVIDER;
  -                    break;
  -                default:
  -                    providerQName = WSDDConstants.QNAME_JAVARPC_PROVIDER;
  -                    break;
  -            }
  -        }
  -
  -        String streamStr = e.getAttribute(ATTR_STREAMING);
  -        if (streamStr != null && streamStr.equals("on")) {
  -            streaming = true;
  -        }
  -
  -        Element [] operationElements = getChildElements(e, ELEM_WSDD_OPERATION);
  -        for (int i = 0; i < operationElements.length; i++) {
  -            WSDDOperation operation = new WSDDOperation(operationElements[i],
  -                                                        desc);
  -            addOperation(operation);
  -        }
  -
  -        Element [] typeMappingElements = getChildElements(e, ELEM_WSDD_TYPEMAPPING);
  -        for (int i = 0; i < typeMappingElements.length; i++) {
  -            WSDDTypeMapping mapping =
  -                    new WSDDTypeMapping(typeMappingElements[i]);
  -            typeMappings.add(mapping);
  -        }
  -
  -        Element [] beanMappingElements = getChildElements(e, ELEM_WSDD_BEANMAPPING);
  -        for (int i = 0; i < beanMappingElements.length; i++) {
  -            WSDDBeanMapping mapping =
  -                    new WSDDBeanMapping(beanMappingElements[i]);
  -            typeMappings.add(mapping);
  -        }
  -
  -        Element [] namespaceElements = getChildElements(e, ELEM_WSDD_NAMESPACE);
  -        for (int i = 0; i < namespaceElements.length; i++) {
  -            // Register a namespace for this service
  -            String ns = XMLUtils.getChildCharacterData(namespaceElements[i]);
  -            namespaces.add(ns);
  -        }
  -        if (!namespaces.isEmpty())
  -            desc.setNamespaceMappings(namespaces);
  -
  -        Element wsdlElem = getChildElement(e, ELEM_WSDD_WSDLFILE);
  -        if (wsdlElem != null) {
  -            String fileName = XMLUtils.getChildCharacterData(wsdlElem);
  -            desc.setWSDLFile(fileName);
  -        }
  -
  -        String providerStr = e.getAttribute(ATTR_PROVIDER);
  -        if (providerStr != null && !providerStr.equals(""))
  -            providerQName = XMLUtils.getQNameFromString(providerStr, e);
  -
  -        // call to validate standard descriptors for this service
  -        validateDescriptors();
  -    }
  -    
  -    /**
  -     * This method can be used for dynamic deployment using new WSDDService()
  -     * etc.  It validates some standard parameters for some standard providers
  -     * (if present).  Do this before deployment.deployService().
  -     */
  -    public void validateDescriptors()
  -    {
  -        String className = this.getParameter(JavaProvider.OPTION_CLASSNAME);
  -        if (className != null) {
  -            try {
  -                // Will this always be the right classloader?
  -                ClassLoader cl = Thread.currentThread().getContextClassLoader();
  -                Class cls = cl.loadClass(className);
  -                desc.setImplClass(cls);
  -                initTMR();
  -                String encStyle = (desc.getStyle() == ServiceDesc.STYLE_RPC) ?
  -                    Constants.NS_URI_CURRENT_SOAP_ENC : "";
  -                desc.setTypeMapping(getTypeMapping(encStyle));
  -            } catch (Exception ex) {
  -            }
  -        }
  -
  -        String allowedMethods = getParameter(JavaProvider.OPTION_ALLOWEDMETHODS);
  -        if (allowedMethods != null) {
  -            ArrayList methodList = new ArrayList();
  -            StringTokenizer tokenizer = new StringTokenizer(allowedMethods, " ,");
  -            while (tokenizer.hasMoreTokens()) {
  -                methodList.add(tokenizer.nextToken());
  -            }
  -            //desc.setAllowedMethods(methodList);
  -        }
  -    }
  -
  -    /**
  -     * Add a WSDDTypeMapping to the Service.
  -     * @param mapping
  -     **/
  -    public void addTypeMapping(WSDDTypeMapping mapping) {
  -        typeMappings.add(mapping);
  -    }
  -
  -    /**
  -     * Add a WSDDOperation to the Service.
  -     * @param operation the operation to add
  -     **/
  -    public void addOperation(WSDDOperation operation) {
  -        operations.add(operation);
  -        desc.addOperationDesc(operation.getOperationDesc());
  -    }
  -
  -    protected QName getElementName()
  -    {
  -        return QNAME_SERVICE;
  -    }
  -
  -    /**
  -     * Get any service description URL which might be associated with this
  -     * service.
  -     *
  -     * @return a String containing a URL, or null.
  -     */
  -    public String getServiceDescriptionURL()
  -    {
  -        return descriptionURL;
  -    }
  -
  -    /**
  -     * Set the service description URL for this service.
  -     *
  -     * @param sdUrl a String containing a URL
  -     */
  -    public void setServiceDescriptionURL(String sdUrl)
  -    {
  -        descriptionURL = sdUrl;
  -    }
  -
  -    public QName getProviderQName() {
  -        return providerQName;
  -    }
  -
  -    public void setProviderQName(QName providerQName) {
  -        this.providerQName = providerQName;
  -    }
  -
  -    /**
  -     * Get the service style - document or RPC
  -     */
  -    public int getStyle() {
  -        return style;
  -    }
  -
  -    public ServiceDesc getServiceDesc() {
  -        return desc;
  -    }
  -
  -    /**
  -     * Set the service style - document or RPC
  -     */
  -    public void setStyle(int style) {
  -        this.style = style;
  -    }
  -
  -    /**
  -     *
  -     * @return XXX
  -     */
  -    public WSDDFaultFlow[] getFaultFlows()
  -    {
  -        WSDDFaultFlow[] t = new WSDDFaultFlow[faultFlows.size()];
  -        faultFlows.toArray(t);
  -        return t;
  -    }
  -
  -    /**
  -     * Obtain the list of namespaces registered for this service
  -     * @return a Vector of namespaces (Strings) which should dispatch to
  -     *         this service
  -     */
  -    public Vector getNamespaces()
  -    {
  -        return namespaces;
  -    }
  -
  -    /**
  -     *
  -     * @param name XXX
  -     * @return XXX
  -     */
  -    public WSDDFaultFlow getFaultFlow(QName name)
  -    {
  -        WSDDFaultFlow[] t = getFaultFlows();
  -
  -        for (int n = 0; n < t.length; n++) {
  -            if (t[n].getQName().equals(name)) {
  -                return t[n];
  -            }
  -        }
  -
  -        return null;
  -    }
  -
  -    /**
  -     *
  -     * @param registry XXX
  -     * @return XXX
  -     * @throws ConfigurationException XXX
  -     */
  -    public Handler makeNewInstance(EngineConfiguration registry)
  -        throws ConfigurationException
  -    {
  -        if (cachedService != null) {
  -            return cachedService;
  -        }
  -
  -        Handler reqHandler = null;
  -        WSDDChain request = getRequestFlow();
  -
  -        if (request != null) {
  -            reqHandler = request.getInstance(registry);
  -        }
  -
  -        Handler providerHandler = null;
  -
  -        if (providerQName != null) {
  -            try {
  -                providerHandler = WSDDProvider.getInstance(providerQName,
  -                                                           this,
  -                                                           registry);
  -            } catch (Exception e) {
  -                throw new ConfigurationException(e);
  -            }
  -            if (providerHandler == null)
  -                throw new WSDDException(
  -                          JavaUtils.getMessage("couldntConstructProvider00"));
  -        }
  -
  -        Handler respHandler = null;
  -        WSDDChain response = getResponseFlow();
  -
  -        if (response != null) {
  -            respHandler = response.getInstance(registry);
  -        }
  -
  -        SOAPService service = new SOAPService(reqHandler, providerHandler,
  -                                              respHandler);
  -        service.setStyle(style);
  -        service.setHighFidelityRecording(!streaming);
  -
  -        if ( getQName() != null )
  -            service.setName(getQName().getLocalPart());
  -        service.setOptions(getParametersTable());
  -
  -        if (style != ServiceDesc.STYLE_RPC) {
  -            // No Multirefs/xsi:types
  -            service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
  -            service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
  -        }
  -
  -        initTMR();
  -        service.setTypeMappingRegistry(tmr);
  -        tmr.delegate(registry.getTypeMappingRegistry());
  -
  -        WSDDFaultFlow [] faultFlows = getFaultFlows();
  -        if (faultFlows != null && faultFlows.length > 0) {
  -            FaultableHandler wrapper = new FaultableHandler(service);
  -            for (int i = 0; i < faultFlows.length; i++) {
  -                WSDDFaultFlow flow = faultFlows[i];
  -                Handler faultHandler = flow.getInstance(registry);
  -                wrapper.setOption("fault-" + flow.getQName().getLocalPart(),
  -                                  faultHandler);
  -            }
  -        }
  -
  -        service.setServiceDescription(desc);
  -
  -        cachedService = service;
  -        return service;
  -    }
  -
  -    public void deployTypeMapping(WSDDTypeMapping mapping)
  -        throws WSDDException
  -    {
  -        if (!typeMappings.contains(mapping)) {
  -            typeMappings.add(mapping);
  -        }
  -        if (tmr == null) {
  -            tmr = new TypeMappingRegistryImpl();
  -        }
  -        try {
  -            // Get the encoding style from the mapping, if it isn't set
  -            // use the style of the service to map doc/lit or rpc/enc
  -            String encodingStyle = mapping.getEncodingStyle();
  -            if (encodingStyle == null) {
  -                if (style == ServiceDesc.STYLE_RPC)
  -                    encodingStyle =Constants.NS_URI_CURRENT_SOAP_ENC;
  -                else
  -                    encodingStyle = Constants.NS_URI_LITERAL_ENC;  // literal
  -            }
  -            TypeMapping tm = (TypeMapping) tmr.getTypeMapping(encodingStyle);
  -            TypeMapping df = (TypeMapping) tmr.getDefaultTypeMapping();
  -            if (tm == null || tm == df) {
  -                tm = (TypeMapping) tmr.createTypeMapping();
  -                tm.setSupportedEncodings(new String[] {encodingStyle});
  -                tmr.register(encodingStyle, tm);
  -            }
  -
  -            SerializerFactory   ser   = null;
  -            DeserializerFactory deser = null;
  -
  -            // Try to construct a serializerFactory by introspecting for the
  -            // following:
  -            // public static create(Class javaType, QName xmlType)
  -            // public <constructor>(Class javaType, QName xmlType)
  -            // public <constructor>()
  -            //
  -            // The BaseSerializerFactory createFactory() method is a utility
  -            // that does this for us.
  -            if (mapping.getSerializerName() != null &&
  -                !mapping.getSerializerName().equals("")) {
  -                ser = BaseSerializerFactory.createFactory(mapping.getSerializer(),
  -                                                          mapping.getLanguageSpecificType(),
  -                                                          mapping.getQName());
  -            }
  -
  -            if (mapping.getDeserializerName() != null &&
  -                !mapping.getDeserializerName().equals("")) {
  -                deser = BaseDeserializerFactory.createFactory(mapping.getDeserializer(),
  -                                                          mapping.getLanguageSpecificType(),
  -                                                          mapping.getQName());
  -            }
  -            tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser);
  -        } catch (ClassNotFoundException e) {
  -            throw new WSDDException(e);
  -        } catch (Exception e) {
  -            throw new WSDDException(e);
  -        }
  -    }
  -
  -    /**
  -     * Write this element out to a SerializationContext
  -     */
  -    public void writeToContext(SerializationContext context)
  -            throws IOException {
  -        AttributesImpl attrs = new AttributesImpl();
  -        QName name = getQName();
  -        if (name != null) {
  -            attrs.addAttribute("", ATTR_NAME, ATTR_NAME,
  -                               "CDATA", context.qName2String(name));
  -        }
  -        if (providerQName != null) {
  -            attrs.addAttribute("", ATTR_PROVIDER, ATTR_PROVIDER,
  -                               "CDATA", context.qName2String(providerQName));
  -        }
  -        if (style != ServiceDesc.STYLE_RPC) {
  -            attrs.addAttribute("", ATTR_STYLE, ATTR_STYLE,
  -                               "CDATA", MessageContext.getStyleFromInt(style));
  -        }
  -
  -        context.startElement(WSDDConstants.QNAME_SERVICE, attrs);
  -
  -        if (desc.getWSDLFile() != null) {
  -            context.startElement(QNAME_WSDLFILE, null);
  -            context.writeSafeString(desc.getWSDLFile());
  -            context.endElement();
  -        }
  -
  -        for (int i = 0; i < operations.size(); i++) {
  -            WSDDOperation operation = (WSDDOperation) operations.elementAt(i);
  -            operation.writeToContext(context);
  -        }
  -        writeFlowsToContext(context);
  -        writeParamsToContext(context);
  -
  -
  -        for (int i=0; i < typeMappings.size(); i++) {
  -            ((WSDDTypeMapping) typeMappings.elementAt(i)).writeToContext(context);
  -        }
  -
  -        for (int i=0; i < namespaces.size(); i++ ) {
  -            context.startElement(QNAME_NAMESPACE, null);
  -            context.writeString((String)namespaces.get(i));
  -            context.endElement();
  -        }
  -
  -        context.endElement();
  -    }
  -
  -    public void setCachedService(SOAPService service)
  -    {
  -        cachedService = service;
  -    }
  -
  -    public Vector getTypeMappings() {
  -        return typeMappings;
  -    }
  -
  -    public void setTypeMappings(Vector typeMappings) {
  -        this.typeMappings = typeMappings;
  -    }
  -
  -    public void deployToRegistry(WSDDDeployment registry)
  -    {
  -        registry.addService(this);
  -
  -        // Register the name of the service as a valid namespace, just for
  -        // backwards compatibility
  -        registry.registerNamespaceForService(getQName().getLocalPart(), this);
  -
  -        for (int i = 0; i < namespaces.size(); i++) {
  -            String namespace = (String) namespaces.elementAt(i);
  -            registry.registerNamespaceForService(namespace, this);
  -        }
  -
  -        super.deployToRegistry(registry);
  -    }
  -
  -    public void removeNamespaceMappings(WSDDDeployment registry)
  -    {
  -        for (int i = 0; i < namespaces.size(); i++) {
  -            String namespace = (String) namespaces.elementAt(i);
  -            registry.removeNamespaceMapping(namespace);
  -        }
  -        registry.removeNamespaceMapping(getQName().getLocalPart());
  -    }
  -
  -    public void initTMR() throws WSDDException
  -    {
  -        if (tmr == null) {
  -            tmr = new TypeMappingRegistryImpl();
  -            for (int i = 0; i < typeMappings.size(); i++) {
  -                deployTypeMapping((WSDDTypeMapping)typeMappings.get(i));
  -            }
  -        }
  -    }
  -    
  -    public TypeMapping getTypeMapping(String encodingStyle) {
  -        return (TypeMapping) tmr.getTypeMapping(encodingStyle);
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.deployment.wsdd;
  +
  +import org.apache.axis.AxisEngine;
  +import org.apache.axis.ConfigurationException;
  +import org.apache.axis.Constants;
  +import org.apache.axis.EngineConfiguration;
  +import org.apache.axis.FaultableHandler;
  +import org.apache.axis.Handler;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMappingRegistryImpl;
  +import org.apache.axis.encoding.ser.BaseDeserializerFactory;
  +import org.apache.axis.encoding.ser.BaseSerializerFactory;
  +import org.apache.axis.handlers.soap.SOAPService;
  +import org.apache.axis.providers.java.JavaProvider;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.utils.XMLUtils;
  +import org.w3c.dom.Element;
  +import org.xml.sax.helpers.AttributesImpl;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +import java.util.ArrayList;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
  +
  +/**
  + *
  + */
  +public class WSDDService
  +    extends WSDDTargetedChain
  +    implements WSDDTypeMappingContainer
  +{
  +    private TypeMappingRegistry tmr = null;
  +
  +    private Vector faultFlows = new Vector();
  +    private Vector typeMappings = new Vector();
  +    private Vector operations = new Vector();
  +
  +    /** Which namespaces should auto-dispatch to this service? */
  +    private Vector namespaces = new Vector();
  +
  +    private String descriptionURL;
  +
  +    /** Style - document or RPC (the default) */
  +    private int style = ServiceDesc.STYLE_RPC;
  +
  +    private SOAPService cachedService = null;
  +
  +    /**
  +     * Our provider - used to figure out which Handler we use as a service
  +     * pivot (see getInstance() below)
  +     */
  +    private QName providerQName;
  +
  +    ServiceDesc desc = new ServiceDesc();
  +
  +    /**
  +     * Is streaming (i.e. NO high-fidelity recording, deserialize on the fly)
  +     * on for this service?
  +     */
  +    private boolean streaming = false;
  +
  +    /**
  +     * Default constructor
  +     */
  +    public WSDDService()
  +    {
  +    }
  +
  +    /**
  +     *
  +     * @param e (Element) XXX
  +     * @throws WSDDException XXX
  +     */
  +    public WSDDService(Element e)
  +        throws WSDDException
  +    {
  +        super(e);
  +
  +        desc.setName(getQName().getLocalPart());
  +
  +        String styleStr = e.getAttribute(ATTR_STYLE);
  +        if (styleStr != null && !styleStr.equals("")) {
  +            style = MessageContext.getStyleFromString(styleStr);
  +            desc.setStyle(style);
  +            switch (style) {
  +                case ServiceDesc.STYLE_MESSAGE:
  +                    providerQName = WSDDConstants.QNAME_JAVAMSG_PROVIDER;
  +                    break;
  +                default:
  +                    providerQName = WSDDConstants.QNAME_JAVARPC_PROVIDER;
  +                    break;
  +            }
  +        }
  +
  +        String streamStr = e.getAttribute(ATTR_STREAMING);
  +        if (streamStr != null && streamStr.equals("on")) {
  +            streaming = true;
  +        }
  +
  +        Element [] operationElements = getChildElements(e, ELEM_WSDD_OPERATION);
  +        for (int i = 0; i < operationElements.length; i++) {
  +            WSDDOperation operation = new WSDDOperation(operationElements[i],
  +                                                        desc);
  +            addOperation(operation);
  +        }
  +
  +        Element [] typeMappingElements = getChildElements(e, ELEM_WSDD_TYPEMAPPING);
  +        for (int i = 0; i < typeMappingElements.length; i++) {
  +            WSDDTypeMapping mapping =
  +                    new WSDDTypeMapping(typeMappingElements[i]);
  +            typeMappings.add(mapping);
  +        }
  +
  +        Element [] beanMappingElements = getChildElements(e, ELEM_WSDD_BEANMAPPING);
  +        for (int i = 0; i < beanMappingElements.length; i++) {
  +            WSDDBeanMapping mapping =
  +                    new WSDDBeanMapping(beanMappingElements[i]);
  +            typeMappings.add(mapping);
  +        }
  +
  +        Element [] namespaceElements = getChildElements(e, ELEM_WSDD_NAMESPACE);
  +        for (int i = 0; i < namespaceElements.length; i++) {
  +            // Register a namespace for this service
  +            String ns = XMLUtils.getChildCharacterData(namespaceElements[i]);
  +            namespaces.add(ns);
  +        }
  +        if (!namespaces.isEmpty())
  +            desc.setNamespaceMappings(namespaces);
  +
  +        Element wsdlElem = getChildElement(e, ELEM_WSDD_WSDLFILE);
  +        if (wsdlElem != null) {
  +            String fileName = XMLUtils.getChildCharacterData(wsdlElem);
  +            desc.setWSDLFile(fileName);
  +        }
  +
  +        String providerStr = e.getAttribute(ATTR_PROVIDER);
  +        if (providerStr != null && !providerStr.equals(""))
  +            providerQName = XMLUtils.getQNameFromString(providerStr, e);
  +
  +        // call to validate standard descriptors for this service
  +        validateDescriptors();
  +    }
  +    
  +    /**
  +     * This method can be used for dynamic deployment using new WSDDService()
  +     * etc.  It validates some standard parameters for some standard providers
  +     * (if present).  Do this before deployment.deployService().
  +     */
  +    public void validateDescriptors()
  +    {
  +        String className = this.getParameter(JavaProvider.OPTION_CLASSNAME);
  +        if (className != null) {
  +            try {
  +                // Will this always be the right classloader?
  +                ClassLoader cl = Thread.currentThread().getContextClassLoader();
  +                Class cls = cl.loadClass(className);
  +                desc.setImplClass(cls);
  +                initTMR();
  +                String encStyle = (desc.getStyle() == ServiceDesc.STYLE_RPC) ?
  +                    Constants.NS_URI_CURRENT_SOAP_ENC : "";
  +                desc.setTypeMapping(getTypeMapping(encStyle));
  +            } catch (Exception ex) {
  +            }
  +        }
  +
  +        String allowedMethods = getParameter(JavaProvider.OPTION_ALLOWEDMETHODS);
  +        if (allowedMethods != null) {
  +            ArrayList methodList = new ArrayList();
  +            StringTokenizer tokenizer = new StringTokenizer(allowedMethods, " ,");
  +            while (tokenizer.hasMoreTokens()) {
  +                methodList.add(tokenizer.nextToken());
  +            }
  +            //desc.setAllowedMethods(methodList);
  +        }
  +    }
  +
  +    /**
  +     * Add a WSDDTypeMapping to the Service.
  +     * @param mapping
  +     **/
  +    public void addTypeMapping(WSDDTypeMapping mapping) {
  +        typeMappings.add(mapping);
  +    }
  +
  +    /**
  +     * Add a WSDDOperation to the Service.
  +     * @param operation the operation to add
  +     **/
  +    public void addOperation(WSDDOperation operation) {
  +        operations.add(operation);
  +        desc.addOperationDesc(operation.getOperationDesc());
  +    }
  +
  +    protected QName getElementName()
  +    {
  +        return QNAME_SERVICE;
  +    }
  +
  +    /**
  +     * Get any service description URL which might be associated with this
  +     * service.
  +     *
  +     * @return a String containing a URL, or null.
  +     */
  +    public String getServiceDescriptionURL()
  +    {
  +        return descriptionURL;
  +    }
  +
  +    /**
  +     * Set the service description URL for this service.
  +     *
  +     * @param sdUrl a String containing a URL
  +     */
  +    public void setServiceDescriptionURL(String sdUrl)
  +    {
  +        descriptionURL = sdUrl;
  +    }
  +
  +    public QName getProviderQName() {
  +        return providerQName;
  +    }
  +
  +    public void setProviderQName(QName providerQName) {
  +        this.providerQName = providerQName;
  +    }
  +
  +    /**
  +     * Get the service style - document or RPC
  +     */
  +    public int getStyle() {
  +        return style;
  +    }
  +
  +    public ServiceDesc getServiceDesc() {
  +        return desc;
  +    }
  +
  +    /**
  +     * Set the service style - document or RPC
  +     */
  +    public void setStyle(int style) {
  +        this.style = style;
  +    }
  +
  +    /**
  +     *
  +     * @return XXX
  +     */
  +    public WSDDFaultFlow[] getFaultFlows()
  +    {
  +        WSDDFaultFlow[] t = new WSDDFaultFlow[faultFlows.size()];
  +        faultFlows.toArray(t);
  +        return t;
  +    }
  +
  +    /**
  +     * Obtain the list of namespaces registered for this service
  +     * @return a Vector of namespaces (Strings) which should dispatch to
  +     *         this service
  +     */
  +    public Vector getNamespaces()
  +    {
  +        return namespaces;
  +    }
  +
  +    /**
  +     *
  +     * @param name XXX
  +     * @return XXX
  +     */
  +    public WSDDFaultFlow getFaultFlow(QName name)
  +    {
  +        WSDDFaultFlow[] t = getFaultFlows();
  +
  +        for (int n = 0; n < t.length; n++) {
  +            if (t[n].getQName().equals(name)) {
  +                return t[n];
  +            }
  +        }
  +
  +        return null;
  +    }
  +
  +    /**
  +     *
  +     * @param registry XXX
  +     * @return XXX
  +     * @throws ConfigurationException XXX
  +     */
  +    public Handler makeNewInstance(EngineConfiguration registry)
  +        throws ConfigurationException
  +    {
  +        if (cachedService != null) {
  +            return cachedService;
  +        }
  +
  +        Handler reqHandler = null;
  +        WSDDChain request = getRequestFlow();
  +
  +        if (request != null) {
  +            reqHandler = request.getInstance(registry);
  +        }
  +
  +        Handler providerHandler = null;
  +
  +        if (providerQName != null) {
  +            try {
  +                providerHandler = WSDDProvider.getInstance(providerQName,
  +                                                           this,
  +                                                           registry);
  +            } catch (Exception e) {
  +                throw new ConfigurationException(e);
  +            }
  +            if (providerHandler == null)
  +                throw new WSDDException(
  +                          JavaUtils.getMessage("couldntConstructProvider00"));
  +        }
  +
  +        Handler respHandler = null;
  +        WSDDChain response = getResponseFlow();
  +
  +        if (response != null) {
  +            respHandler = response.getInstance(registry);
  +        }
  +
  +        SOAPService service = new SOAPService(reqHandler, providerHandler,
  +                                              respHandler);
  +        service.setStyle(style);
  +        service.setHighFidelityRecording(!streaming);
  +
  +        if ( getQName() != null )
  +            service.setName(getQName().getLocalPart());
  +        service.setOptions(getParametersTable());
  +
  +        if (style != ServiceDesc.STYLE_RPC) {
  +            // No Multirefs/xsi:types
  +            service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
  +            service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
  +        }
  +
  +        initTMR();
  +        service.setTypeMappingRegistry(tmr);
  +        tmr.delegate(registry.getTypeMappingRegistry());
  +
  +        WSDDFaultFlow [] faultFlows = getFaultFlows();
  +        if (faultFlows != null && faultFlows.length > 0) {
  +            FaultableHandler wrapper = new FaultableHandler(service);
  +            for (int i = 0; i < faultFlows.length; i++) {
  +                WSDDFaultFlow flow = faultFlows[i];
  +                Handler faultHandler = flow.getInstance(registry);
  +                wrapper.setOption("fault-" + flow.getQName().getLocalPart(),
  +                                  faultHandler);
  +            }
  +        }
  +
  +        service.setServiceDescription(desc);
  +
  +        cachedService = service;
  +        return service;
  +    }
  +
  +    public void deployTypeMapping(WSDDTypeMapping mapping)
  +        throws WSDDException
  +    {
  +        if (!typeMappings.contains(mapping)) {
  +            typeMappings.add(mapping);
  +        }
  +        if (tmr == null) {
  +            tmr = new TypeMappingRegistryImpl();
  +        }
  +        try {
  +            // Get the encoding style from the mapping, if it isn't set
  +            // use the style of the service to map doc/lit or rpc/enc
  +            String encodingStyle = mapping.getEncodingStyle();
  +            if (encodingStyle == null) {
  +                if (style == ServiceDesc.STYLE_RPC)
  +                    encodingStyle =Constants.NS_URI_CURRENT_SOAP_ENC;
  +                else
  +                    encodingStyle = Constants.NS_URI_LITERAL_ENC;  // literal
  +            }
  +            TypeMapping tm = (TypeMapping) tmr.getTypeMapping(encodingStyle);
  +            TypeMapping df = (TypeMapping) tmr.getDefaultTypeMapping();
  +            if (tm == null || tm == df) {
  +                tm = (TypeMapping) tmr.createTypeMapping();
  +                tm.setSupportedEncodings(new String[] {encodingStyle});
  +                tmr.register(encodingStyle, tm);
  +            }
  +
  +            SerializerFactory   ser   = null;
  +            DeserializerFactory deser = null;
  +
  +            // Try to construct a serializerFactory by introspecting for the
  +            // following:
  +            // public static create(Class javaType, QName xmlType)
  +            // public <constructor>(Class javaType, QName xmlType)
  +            // public <constructor>()
  +            //
  +            // The BaseSerializerFactory createFactory() method is a utility
  +            // that does this for us.
  +            if (mapping.getSerializerName() != null &&
  +                !mapping.getSerializerName().equals("")) {
  +                ser = BaseSerializerFactory.createFactory(mapping.getSerializer(),
  +                                                          mapping.getLanguageSpecificType(),
  +                                                          mapping.getQName());
  +            }
  +
  +            if (mapping.getDeserializerName() != null &&
  +                !mapping.getDeserializerName().equals("")) {
  +                deser = BaseDeserializerFactory.createFactory(mapping.getDeserializer(),
  +                                                          mapping.getLanguageSpecificType(),
  +                                                          mapping.getQName());
  +            }
  +            tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser);
  +        } catch (ClassNotFoundException e) {
  +            throw new WSDDException(e);
  +        } catch (Exception e) {
  +            throw new WSDDException(e);
  +        }
  +    }
  +
  +    /**
  +     * Write this element out to a SerializationContext
  +     */
  +    public void writeToContext(SerializationContext context)
  +            throws IOException {
  +        AttributesImpl attrs = new AttributesImpl();
  +        QName name = getQName();
  +        if (name != null) {
  +            attrs.addAttribute("", ATTR_NAME, ATTR_NAME,
  +                               "CDATA", context.qName2String(name));
  +        }
  +        if (providerQName != null) {
  +            attrs.addAttribute("", ATTR_PROVIDER, ATTR_PROVIDER,
  +                               "CDATA", context.qName2String(providerQName));
  +        }
  +        if (style != ServiceDesc.STYLE_RPC) {
  +            attrs.addAttribute("", ATTR_STYLE, ATTR_STYLE,
  +                               "CDATA", MessageContext.getStyleFromInt(style));
  +        }
  +
  +        context.startElement(WSDDConstants.QNAME_SERVICE, attrs);
  +
  +        if (desc.getWSDLFile() != null) {
  +            context.startElement(QNAME_WSDLFILE, null);
  +            context.writeSafeString(desc.getWSDLFile());
  +            context.endElement();
  +        }
  +
  +        for (int i = 0; i < operations.size(); i++) {
  +            WSDDOperation operation = (WSDDOperation) operations.elementAt(i);
  +            operation.writeToContext(context);
  +        }
  +        writeFlowsToContext(context);
  +        writeParamsToContext(context);
  +
  +
  +        for (int i=0; i < typeMappings.size(); i++) {
  +            ((WSDDTypeMapping) typeMappings.elementAt(i)).writeToContext(context);
  +        }
  +
  +        for (int i=0; i < namespaces.size(); i++ ) {
  +            context.startElement(QNAME_NAMESPACE, null);
  +            context.writeString((String)namespaces.get(i));
  +            context.endElement();
  +        }
  +
  +        context.endElement();
  +    }
  +
  +    public void setCachedService(SOAPService service)
  +    {
  +        cachedService = service;
  +    }
  +
  +    public Vector getTypeMappings() {
  +        return typeMappings;
  +    }
  +
  +    public void setTypeMappings(Vector typeMappings) {
  +        this.typeMappings = typeMappings;
  +    }
  +
  +    public void deployToRegistry(WSDDDeployment registry)
  +    {
  +        registry.addService(this);
  +
  +        // Register the name of the service as a valid namespace, just for
  +        // backwards compatibility
  +        registry.registerNamespaceForService(getQName().getLocalPart(), this);
  +
  +        for (int i = 0; i < namespaces.size(); i++) {
  +            String namespace = (String) namespaces.elementAt(i);
  +            registry.registerNamespaceForService(namespace, this);
  +        }
  +
  +        super.deployToRegistry(registry);
  +    }
  +
  +    public void removeNamespaceMappings(WSDDDeployment registry)
  +    {
  +        for (int i = 0; i < namespaces.size(); i++) {
  +            String namespace = (String) namespaces.elementAt(i);
  +            registry.removeNamespaceMapping(namespace);
  +        }
  +        registry.removeNamespaceMapping(getQName().getLocalPart());
  +    }
  +
  +    public void initTMR() throws WSDDException
  +    {
  +        if (tmr == null) {
  +            tmr = new TypeMappingRegistryImpl();
  +            for (int i = 0; i < typeMappings.size(); i++) {
  +                deployTypeMapping((WSDDTypeMapping)typeMappings.get(i));
  +            }
  +        }
  +    }
  +    
  +    public TypeMapping getTypeMapping(String encodingStyle) {
  +        return (TypeMapping) tmr.getTypeMapping(encodingStyle);
  +    }
  +}
  
  
  
  1.27      +407 -407  xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
  
  Index: DefaultTypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DefaultTypeMappingImpl.java	30 May 2002 03:06:08 -0000	1.26
  +++ DefaultTypeMappingImpl.java	30 May 2002 23:46:00 -0000	1.27
  @@ -1,407 +1,407 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.ser.*;
  -
  -import javax.xml.rpc.JAXRPCException;
  -import javax.xml.rpc.namespace.QName;
  -import java.util.List;
  -
  -/**
  - * This is the implementation of the axis Default TypeMapping (which extends
  - * the JAX-RPC TypeMapping interface) for SOAP 1.1.
  - *
  - * A TypeMapping contains tuples as follows:
  - * {Java type, SerializerFactory, DeserializerFactory, Type QName)
  - *
  - * In other words, it serves to map Java types to and from XML types using
  - * particular Serializers/Deserializers.  Each TypeMapping is associated with
  - * one or more encodingStyle URIs.
  - *
  - * The wsdl in your web service will use a number of types.  The tuple
  - * information for each of these will be accessed via the TypeMapping.
  - *
  - * This TypeMapping is the "default" one, which includes all the standard
  - * SOAP and schema XSD types.  Individual TypeMappings (associated with
  - * AxisEngines and SOAPServices) will delegate to this one, so if you haven't
  - * overriden a default mapping we'll end up getting it from here.
  - *
  - * @author Rich Scheuerle (scheu@us.ibm.com)
  - */
  -public class DefaultTypeMappingImpl extends TypeMappingImpl {
  -
  -    private static DefaultTypeMappingImpl tm = null;
  -
  -    /**
  -     * Obtain the singleton default typemapping.
  -     */
  -    public static synchronized TypeMapping getSingleton() {
  -        if (tm == null) {
  -            tm = new DefaultTypeMappingImpl();
  -        }
  -        return tm;
  -    }
  -
  -    protected DefaultTypeMappingImpl() {
  -        super(null);
  -        delegate = null;
  -
  -        // Notes:
  -        // 1) The registration statements are order dependent.  The last one
  -        //    wins.  So if two javaTypes of String are registered, the
  -        //    ser factory for the last one registered will be chosen.  Likewise
  -        //    if two javaTypes for XSD_DATE are registered, the deserializer
  -        //    factory for the last one registered will be chosen.
  -        //    Corollary:  Please be very careful with the order.  The
  -        //                runtime, Java2WSDL and WSDL2Java emitters all
  -        //                use this code to get type mapping information.
  -        // 2) Even if the SOAP 1.1 format is used over the wire, an
  -        //    attempt is made to receive SOAP 1.2 format from the wire.
  -        //    This is the reason why the soap encoded primitives are
  -        //    registered without serializers.
  -
  -        // SOAP Encoded strings are treated as primitives.
  -        // Everything else is not.
  -        // Note that only deserializing is supported since we are flowing
  -        // SOAP 1.1 over the wire.
  -        myRegister(Constants.SOAP_STRING,     java.lang.String.class,
  -                   null, null, true);
  -        myRegister(Constants.SOAP_BOOLEAN,    java.lang.Boolean.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_DOUBLE,     java.lang.Double.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_FLOAT,      java.lang.Float.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_INT,        java.lang.Integer.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_INTEGER,    java.math.BigInteger.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_DECIMAL,    java.math.BigDecimal.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_LONG,       java.lang.Long.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_SHORT,      java.lang.Short.class,
  -                   null, null, false);
  -        myRegister(Constants.SOAP_BYTE,       java.lang.Byte.class,
  -                   null, null, false);
  -
  -        // Hex binary data needs to use the hex binary serializer/deserializer
  -        myRegister(Constants.XSD_HEXBIN,     Hex.class,
  -                   new HexSerializerFactory(
  -                        Hex.class, Constants.XSD_HEXBIN),
  -                   new HexDeserializerFactory(
  -                        Hex.class, Constants.XSD_HEXBIN),true);
  -        myRegister(Constants.XSD_HEXBIN,     byte[].class,
  -                   new HexSerializerFactory(
  -                        byte[].class, Constants.XSD_HEXBIN),
  -                   new HexDeserializerFactory(
  -                        byte[].class, Constants.XSD_HEXBIN),true);
  -
  -        // SOAP 1.1
  -        // byte[] -ser-> XSD_BASE64
  -        // XSD_BASE64 -deser-> byte[]
  -        // SOAP_BASE64 -deser->byte[]
  -        myRegister(Constants.SOAP_BASE64,     byte[].class,
  -                   new Base64SerializerFactory(byte[].class,
  -                                               Constants.SOAP_BASE64 ),
  -                   new Base64DeserializerFactory(byte[].class,
  -                                                 Constants.SOAP_BASE64),
  -                   true);
  -        myRegister(Constants.XSD_BASE64,     byte[].class,
  -                   new Base64SerializerFactory(byte[].class,
  -                                               Constants.XSD_BASE64 ),
  -                   new Base64DeserializerFactory(byte[].class,
  -                                           Constants.XSD_BASE64),true);
  -
  -        // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives.
  -        myRegister(Constants.XSD_STRING,     java.lang.String.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_BOOLEAN,    java.lang.Boolean.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_DOUBLE,     java.lang.Double.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_FLOAT,      java.lang.Float.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_INT,        java.lang.Integer.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_INTEGER,    java.math.BigInteger.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_DECIMAL,    java.math.BigDecimal.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_LONG,       java.lang.Long.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_SHORT,      java.lang.Short.class,
  -                   null, null, true);
  -        myRegister(Constants.XSD_BYTE,       java.lang.Byte.class,
  -                   null, null, true);
  -
  -        // The XSD Primitives are mapped to java primitives.
  -        myRegister(Constants.XSD_BOOLEAN,    boolean.class,
  -                   null, null,true);
  -        myRegister(Constants.XSD_DOUBLE,     double.class,
  -                   null, null,true);
  -        myRegister(Constants.XSD_FLOAT,      float.class,
  -                   null, null,true);
  -        myRegister(Constants.XSD_INT,        int.class,
  -                   null, null,true);
  -        myRegister(Constants.XSD_LONG,       long.class,
  -                   null, null,true);
  -        myRegister(Constants.XSD_SHORT,      short.class,
  -                   null, null,true);
  -        myRegister(Constants.XSD_BYTE,       byte.class,
  -                   null, null,true);
  -
  -
  -        // Map QNAME to the jax rpc QName class
  -        myRegister(Constants.XSD_QNAME,
  -              javax.xml.rpc.namespace.QName.class,
  -              new QNameSerializerFactory(javax.xml.rpc.namespace.QName.class,
  -                                        Constants.XSD_QNAME),
  -              new QNameDeserializerFactory(javax.xml.rpc.namespace.QName.class,
  -                                        Constants.XSD_QNAME),
  -                   true);
  -
  -        // The closest match for anytype is Object
  -        myRegister(Constants.XSD_ANYTYPE,    java.lang.Object.class,
  -                   null, null, false);
  -
  -        // The xsd primitive for date has changed through the various
  -        // namespace versions.
  -        // XSD_DATE is the current one, which is why it is
  -        // registered after the other two
  -        myRegister(Constants.XSD_DATE2,      java.util.Calendar.class,
  -                   new CalendarSerializerFactory(java.util.Calendar.class,
  -                                             Constants.XSD_DATE2),
  -                   new CalendarDeserializerFactory(java.util.Calendar.class,
  -                                               Constants.XSD_DATE2),
  -                   true);
  -        myRegister(Constants.XSD_DATE3,      java.util.Calendar.class,
  -                   new CalendarSerializerFactory(java.util.Calendar.class,
  -                                             Constants.XSD_DATE3),
  -                   new CalendarDeserializerFactory(java.util.Calendar.class,
  -                                               Constants.XSD_DATE3),
  -                   true);
  -        myRegister(Constants.XSD_DATE1,       java.util.Date.class,
  -                   new DateSerializerFactory(java.util.Date.class,
  -                                             Constants.XSD_DATE1),
  -                   new DateDeserializerFactory(java.util.Date.class,
  -                                               Constants.XSD_DATE1),
  -                   true);
  -        myRegister(Constants.XSD_DATE,       java.util.Calendar.class,
  -                   new CalendarSerializerFactory(java.util.Calendar.class,
  -                                             Constants.XSD_DATE),
  -                   new CalendarDeserializerFactory(java.util.Calendar.class,
  -                                               Constants.XSD_DATE),
  -                   true);
  -
  -        // Serialize all extensions of Map to SOAP_MAP
  -        // The SOAP_MAP will be deserialized into a HashMap by default.
  -        myRegister(Constants.SOAP_MAP,       java.util.HashMap.class,
  -                   new MapSerializerFactory(java.util.Map.class,
  -                                            Constants.SOAP_MAP),
  -                   new MapDeserializerFactory(java.util.HashMap.class,
  -                                              Constants.SOAP_MAP),
  -                   false);
  -        myRegister(Constants.SOAP_MAP,       java.util.Map.class,
  -                   new MapSerializerFactory(java.util.Map.class,
  -                                            Constants.SOAP_MAP),
  -                   null,  // Make sure not to override the deser mapping
  -                   false);
  -
  -        // Use the Element Serializeration for elements
  -        myRegister(Constants.SOAP_ELEMENT,   org.w3c.dom.Element.class,
  -                   new ElementSerializerFactory(),
  -                   new ElementDeserializerFactory(), false);
  -        myRegister(Constants.SOAP_VECTOR,    java.util.Vector.class,
  -                   new VectorSerializerFactory(java.util.Vector.class,
  -                                               Constants.SOAP_VECTOR),
  -                   new VectorDeserializerFactory(java.util.Vector.class,
  -                                                 Constants.SOAP_VECTOR),
  -                   false);
  -
  -        // All array objects automatically get associated with the SOAP_ARRAY.
  -        // There is no way to do this with a hash table,
  -        // so it is done directly in getTypeQName.
  -        // Internally the runtime uses ArrayList objects to hold arrays...
  -        // which is the reason that ArrayList is associated with SOAP_ARRAY.
  -        // In addition, handle all objects that implement the List interface
  -        // as a SOAP_ARRAY
  -        myRegister(Constants.SOAP_ARRAY,     java.util.Collection.class,
  -                   new ArraySerializerFactory(),
  -                   new ArrayDeserializerFactory(),
  -                   false);
  -//        myRegister(Constants.SOAP_ARRAY,     java.util.ArrayList.class,
  -//                   new ArraySerializerFactory(),
  -//                   new ArrayDeserializerFactory(),
  -//                   false);
  -        myRegister(Constants.SOAP_ARRAY,     Object[].class,
  -                   new ArraySerializerFactory(),
  -                   new ArrayDeserializerFactory(),
  -                   false);
  -    }
  -
  -    /**
  -     * Construct TypeMapping for all the [xmlType, javaType] for all of the
  -     * known xmlType namespaces
  -     * @param xmlType is the QName type
  -     * @param javaType is the java type
  -     * @param sf is the ser factory (if null, the simple factory is used)
  -     * @param df is the deser factory (if null, the simple factory is used)
  -     * @param primitive indicates whether serializers can be shared
  -     */
  -    protected void myRegister(QName xmlType, Class javaType,
  -                              SerializerFactory sf, DeserializerFactory df,
  -                              boolean primitive) {
  -        myRegister(xmlType, javaType, sf, df, primitive, false);
  -    }
  -
  -    /**
  -     * Construct TypeMapping for all the [xmlType, javaType] for all of the
  -     * known xmlType namespaces
  -     * @param xmlType is the QName type
  -     * @param javaType is the java type
  -     * @param sf is the ser factory (if null, the simple factory is used)
  -     * @param df is the deser factory (if null, the simple factory is used)
  -     * @param primitive indicates whether serializers can be shared
  -     * @param onlyDeserFactory indicates if only deserialization is desired.
  -     */
  -    protected void myRegister(QName xmlType, Class javaType,
  -                              SerializerFactory sf, DeserializerFactory df,
  -                              boolean primitive, boolean onlyDeserFactory) {
  -
  -        // If factories are not specified, use the Simple ser/deser factories.
  -        if (sf == null && df == null) {
  -            if (!onlyDeserFactory) {
  -                if (primitive) {
  -                    sf = new SimplePrimitiveSerializerFactory(javaType,
  -                                                              xmlType);
  -                } else {
  -                    sf = new SimpleNonPrimitiveSerializerFactory(javaType,
  -                                                                 xmlType);
  -                }
  -            }
  -            if (javaType != java.lang.Object.class) {
  -                df = new SimpleDeserializerFactory(javaType, xmlType);
  -            }
  -        }
  -        if (onlyDeserFactory) {
  -            sf = null;
  -        }
  -
  -        // Register all known flavors of the namespace.
  -        try {
  -            if (xmlType.getNamespaceURI().equals(
  -                       Constants.NS_URI_CURRENT_SCHEMA_XSD)) {
  -                for (int i=0; i < Constants.NS_URIS_SCHEMA_XSD.length; i++) {
  -                    QName qName = new QName(Constants.NS_URIS_SCHEMA_XSD[i],
  -                                            xmlType.getLocalPart());
  -                    super.register(javaType, qName, sf, df);
  -                }
  -            }
  -            else if (xmlType.getNamespaceURI().equals(
  -                       Constants.NS_URI_CURRENT_SOAP_ENC)) {
  -                for (int i=0; i < Constants.NS_URIS_SOAP_ENC.length; i++) {
  -                    QName qName = new QName(Constants.NS_URIS_SOAP_ENC[i],
  -                                            xmlType.getLocalPart());
  -                    super.register(javaType, qName, sf, df);
  -                }
  -            }
  -            // Register with the specified xmlType.
  -            // This is the prefered mapping and the last registed one wins
  -            super.register(javaType, xmlType, sf, df);
  -        } catch (Exception e) {}
  -    }
  -
  -    /**
  -     * Gets the QName for the type mapped to Class.
  -     * @param javaType class or type
  -     * @return xmlType qname or null
  -     */
  -    public QName getTypeQName(Class javaType) {
  -        QName xmlType = super.getTypeQName(javaType);
  -
  -        // Can only detect arrays via code
  -        if (xmlType == null &&
  -            (javaType.isArray() ||
  -             javaType == List.class ||
  -             List.class.isAssignableFrom(javaType))) {
  -            xmlType = Constants.SOAP_ARRAY;
  -        }
  -        return xmlType;
  -    }
  -
  -    // Don't allow anyone to muck with the default type mapping because
  -    // it is a singleton used for the whole system.
  -    public void register(Class javaType, QName xmlType,
  -                         javax.xml.rpc.encoding.SerializerFactory sf,
  -                         javax.xml.rpc.encoding.DeserializerFactory dsf)
  -        throws JAXRPCException {
  -
  -        throw new JAXRPCException();
  -    }
  -    public void removeSerializer(Class javaType, QName xmlType)
  -        throws JAXRPCException {
  -        throw new JAXRPCException();
  -    }
  -    public void removeDeserializer(Class javaType, QName xmlType)
  -        throws JAXRPCException {
  -        throw new JAXRPCException();
  -    }
  -    public void setSupportedEncodings(String[] namespaceURIs) {
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.encoding.ser.*;
  +
  +import javax.xml.rpc.JAXRPCException;
  +import javax.xml.rpc.namespace.QName;
  +import java.util.List;
  +
  +/**
  + * This is the implementation of the axis Default TypeMapping (which extends
  + * the JAX-RPC TypeMapping interface) for SOAP 1.1.
  + *
  + * A TypeMapping contains tuples as follows:
  + * {Java type, SerializerFactory, DeserializerFactory, Type QName)
  + *
  + * In other words, it serves to map Java types to and from XML types using
  + * particular Serializers/Deserializers.  Each TypeMapping is associated with
  + * one or more encodingStyle URIs.
  + *
  + * The wsdl in your web service will use a number of types.  The tuple
  + * information for each of these will be accessed via the TypeMapping.
  + *
  + * This TypeMapping is the "default" one, which includes all the standard
  + * SOAP and schema XSD types.  Individual TypeMappings (associated with
  + * AxisEngines and SOAPServices) will delegate to this one, so if you haven't
  + * overriden a default mapping we'll end up getting it from here.
  + *
  + * @author Rich Scheuerle (scheu@us.ibm.com)
  + */
  +public class DefaultTypeMappingImpl extends TypeMappingImpl {
  +
  +    private static DefaultTypeMappingImpl tm = null;
  +
  +    /**
  +     * Obtain the singleton default typemapping.
  +     */
  +    public static synchronized TypeMapping getSingleton() {
  +        if (tm == null) {
  +            tm = new DefaultTypeMappingImpl();
  +        }
  +        return tm;
  +    }
  +
  +    protected DefaultTypeMappingImpl() {
  +        super(null);
  +        delegate = null;
  +
  +        // Notes:
  +        // 1) The registration statements are order dependent.  The last one
  +        //    wins.  So if two javaTypes of String are registered, the
  +        //    ser factory for the last one registered will be chosen.  Likewise
  +        //    if two javaTypes for XSD_DATE are registered, the deserializer
  +        //    factory for the last one registered will be chosen.
  +        //    Corollary:  Please be very careful with the order.  The
  +        //                runtime, Java2WSDL and WSDL2Java emitters all
  +        //                use this code to get type mapping information.
  +        // 2) Even if the SOAP 1.1 format is used over the wire, an
  +        //    attempt is made to receive SOAP 1.2 format from the wire.
  +        //    This is the reason why the soap encoded primitives are
  +        //    registered without serializers.
  +
  +        // SOAP Encoded strings are treated as primitives.
  +        // Everything else is not.
  +        // Note that only deserializing is supported since we are flowing
  +        // SOAP 1.1 over the wire.
  +        myRegister(Constants.SOAP_STRING,     java.lang.String.class,
  +                   null, null, true);
  +        myRegister(Constants.SOAP_BOOLEAN,    java.lang.Boolean.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_DOUBLE,     java.lang.Double.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_FLOAT,      java.lang.Float.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_INT,        java.lang.Integer.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_INTEGER,    java.math.BigInteger.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_DECIMAL,    java.math.BigDecimal.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_LONG,       java.lang.Long.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_SHORT,      java.lang.Short.class,
  +                   null, null, false);
  +        myRegister(Constants.SOAP_BYTE,       java.lang.Byte.class,
  +                   null, null, false);
  +
  +        // Hex binary data needs to use the hex binary serializer/deserializer
  +        myRegister(Constants.XSD_HEXBIN,     Hex.class,
  +                   new HexSerializerFactory(
  +                        Hex.class, Constants.XSD_HEXBIN),
  +                   new HexDeserializerFactory(
  +                        Hex.class, Constants.XSD_HEXBIN),true);
  +        myRegister(Constants.XSD_HEXBIN,     byte[].class,
  +                   new HexSerializerFactory(
  +                        byte[].class, Constants.XSD_HEXBIN),
  +                   new HexDeserializerFactory(
  +                        byte[].class, Constants.XSD_HEXBIN),true);
  +
  +        // SOAP 1.1
  +        // byte[] -ser-> XSD_BASE64
  +        // XSD_BASE64 -deser-> byte[]
  +        // SOAP_BASE64 -deser->byte[]
  +        myRegister(Constants.SOAP_BASE64,     byte[].class,
  +                   new Base64SerializerFactory(byte[].class,
  +                                               Constants.SOAP_BASE64 ),
  +                   new Base64DeserializerFactory(byte[].class,
  +                                                 Constants.SOAP_BASE64),
  +                   true);
  +        myRegister(Constants.XSD_BASE64,     byte[].class,
  +                   new Base64SerializerFactory(byte[].class,
  +                                               Constants.XSD_BASE64 ),
  +                   new Base64DeserializerFactory(byte[].class,
  +                                           Constants.XSD_BASE64),true);
  +
  +        // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives.
  +        myRegister(Constants.XSD_STRING,     java.lang.String.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_BOOLEAN,    java.lang.Boolean.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_DOUBLE,     java.lang.Double.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_FLOAT,      java.lang.Float.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_INT,        java.lang.Integer.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_INTEGER,    java.math.BigInteger.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_DECIMAL,    java.math.BigDecimal.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_LONG,       java.lang.Long.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_SHORT,      java.lang.Short.class,
  +                   null, null, true);
  +        myRegister(Constants.XSD_BYTE,       java.lang.Byte.class,
  +                   null, null, true);
  +
  +        // The XSD Primitives are mapped to java primitives.
  +        myRegister(Constants.XSD_BOOLEAN,    boolean.class,
  +                   null, null,true);
  +        myRegister(Constants.XSD_DOUBLE,     double.class,
  +                   null, null,true);
  +        myRegister(Constants.XSD_FLOAT,      float.class,
  +                   null, null,true);
  +        myRegister(Constants.XSD_INT,        int.class,
  +                   null, null,true);
  +        myRegister(Constants.XSD_LONG,       long.class,
  +                   null, null,true);
  +        myRegister(Constants.XSD_SHORT,      short.class,
  +                   null, null,true);
  +        myRegister(Constants.XSD_BYTE,       byte.class,
  +                   null, null,true);
  +
  +
  +        // Map QNAME to the jax rpc QName class
  +        myRegister(Constants.XSD_QNAME,
  +              javax.xml.rpc.namespace.QName.class,
  +              new QNameSerializerFactory(javax.xml.rpc.namespace.QName.class,
  +                                        Constants.XSD_QNAME),
  +              new QNameDeserializerFactory(javax.xml.rpc.namespace.QName.class,
  +                                        Constants.XSD_QNAME),
  +                   true);
  +
  +        // The closest match for anytype is Object
  +        myRegister(Constants.XSD_ANYTYPE,    java.lang.Object.class,
  +                   null, null, false);
  +
  +        // The xsd primitive for date has changed through the various
  +        // namespace versions.
  +        // XSD_DATE is the current one, which is why it is
  +        // registered after the other two
  +        myRegister(Constants.XSD_DATE2,      java.util.Calendar.class,
  +                   new CalendarSerializerFactory(java.util.Calendar.class,
  +                                             Constants.XSD_DATE2),
  +                   new CalendarDeserializerFactory(java.util.Calendar.class,
  +                                               Constants.XSD_DATE2),
  +                   true);
  +        myRegister(Constants.XSD_DATE3,      java.util.Calendar.class,
  +                   new CalendarSerializerFactory(java.util.Calendar.class,
  +                                             Constants.XSD_DATE3),
  +                   new CalendarDeserializerFactory(java.util.Calendar.class,
  +                                               Constants.XSD_DATE3),
  +                   true);
  +        myRegister(Constants.XSD_DATE1,       java.util.Date.class,
  +                   new DateSerializerFactory(java.util.Date.class,
  +                                             Constants.XSD_DATE1),
  +                   new DateDeserializerFactory(java.util.Date.class,
  +                                               Constants.XSD_DATE1),
  +                   true);
  +        myRegister(Constants.XSD_DATE,       java.util.Calendar.class,
  +                   new CalendarSerializerFactory(java.util.Calendar.class,
  +                                             Constants.XSD_DATE),
  +                   new CalendarDeserializerFactory(java.util.Calendar.class,
  +                                               Constants.XSD_DATE),
  +                   true);
  +
  +        // Serialize all extensions of Map to SOAP_MAP
  +        // The SOAP_MAP will be deserialized into a HashMap by default.
  +        myRegister(Constants.SOAP_MAP,       java.util.HashMap.class,
  +                   new MapSerializerFactory(java.util.Map.class,
  +                                            Constants.SOAP_MAP),
  +                   new MapDeserializerFactory(java.util.HashMap.class,
  +                                              Constants.SOAP_MAP),
  +                   false);
  +        myRegister(Constants.SOAP_MAP,       java.util.Map.class,
  +                   new MapSerializerFactory(java.util.Map.class,
  +                                            Constants.SOAP_MAP),
  +                   null,  // Make sure not to override the deser mapping
  +                   false);
  +
  +        // Use the Element Serializeration for elements
  +        myRegister(Constants.SOAP_ELEMENT,   org.w3c.dom.Element.class,
  +                   new ElementSerializerFactory(),
  +                   new ElementDeserializerFactory(), false);
  +        myRegister(Constants.SOAP_VECTOR,    java.util.Vector.class,
  +                   new VectorSerializerFactory(java.util.Vector.class,
  +                                               Constants.SOAP_VECTOR),
  +                   new VectorDeserializerFactory(java.util.Vector.class,
  +                                                 Constants.SOAP_VECTOR),
  +                   false);
  +
  +        // All array objects automatically get associated with the SOAP_ARRAY.
  +        // There is no way to do this with a hash table,
  +        // so it is done directly in getTypeQName.
  +        // Internally the runtime uses ArrayList objects to hold arrays...
  +        // which is the reason that ArrayList is associated with SOAP_ARRAY.
  +        // In addition, handle all objects that implement the List interface
  +        // as a SOAP_ARRAY
  +        myRegister(Constants.SOAP_ARRAY,     java.util.Collection.class,
  +                   new ArraySerializerFactory(),
  +                   new ArrayDeserializerFactory(),
  +                   false);
  +//        myRegister(Constants.SOAP_ARRAY,     java.util.ArrayList.class,
  +//                   new ArraySerializerFactory(),
  +//                   new ArrayDeserializerFactory(),
  +//                   false);
  +        myRegister(Constants.SOAP_ARRAY,     Object[].class,
  +                   new ArraySerializerFactory(),
  +                   new ArrayDeserializerFactory(),
  +                   false);
  +    }
  +
  +    /**
  +     * Construct TypeMapping for all the [xmlType, javaType] for all of the
  +     * known xmlType namespaces
  +     * @param xmlType is the QName type
  +     * @param javaType is the java type
  +     * @param sf is the ser factory (if null, the simple factory is used)
  +     * @param df is the deser factory (if null, the simple factory is used)
  +     * @param primitive indicates whether serializers can be shared
  +     */
  +    protected void myRegister(QName xmlType, Class javaType,
  +                              SerializerFactory sf, DeserializerFactory df,
  +                              boolean primitive) {
  +        myRegister(xmlType, javaType, sf, df, primitive, false);
  +    }
  +
  +    /**
  +     * Construct TypeMapping for all the [xmlType, javaType] for all of the
  +     * known xmlType namespaces
  +     * @param xmlType is the QName type
  +     * @param javaType is the java type
  +     * @param sf is the ser factory (if null, the simple factory is used)
  +     * @param df is the deser factory (if null, the simple factory is used)
  +     * @param primitive indicates whether serializers can be shared
  +     * @param onlyDeserFactory indicates if only deserialization is desired.
  +     */
  +    protected void myRegister(QName xmlType, Class javaType,
  +                              SerializerFactory sf, DeserializerFactory df,
  +                              boolean primitive, boolean onlyDeserFactory) {
  +
  +        // If factories are not specified, use the Simple ser/deser factories.
  +        if (sf == null && df == null) {
  +            if (!onlyDeserFactory) {
  +                if (primitive) {
  +                    sf = new SimplePrimitiveSerializerFactory(javaType,
  +                                                              xmlType);
  +                } else {
  +                    sf = new SimpleNonPrimitiveSerializerFactory(javaType,
  +                                                                 xmlType);
  +                }
  +            }
  +            if (javaType != java.lang.Object.class) {
  +                df = new SimpleDeserializerFactory(javaType, xmlType);
  +            }
  +        }
  +        if (onlyDeserFactory) {
  +            sf = null;
  +        }
  +
  +        // Register all known flavors of the namespace.
  +        try {
  +            if (xmlType.getNamespaceURI().equals(
  +                       Constants.NS_URI_CURRENT_SCHEMA_XSD)) {
  +                for (int i=0; i < Constants.NS_URIS_SCHEMA_XSD.length; i++) {
  +                    QName qName = new QName(Constants.NS_URIS_SCHEMA_XSD[i],
  +                                            xmlType.getLocalPart());
  +                    super.register(javaType, qName, sf, df);
  +                }
  +            }
  +            else if (xmlType.getNamespaceURI().equals(
  +                       Constants.NS_URI_CURRENT_SOAP_ENC)) {
  +                for (int i=0; i < Constants.NS_URIS_SOAP_ENC.length; i++) {
  +                    QName qName = new QName(Constants.NS_URIS_SOAP_ENC[i],
  +                                            xmlType.getLocalPart());
  +                    super.register(javaType, qName, sf, df);
  +                }
  +            }
  +            // Register with the specified xmlType.
  +            // This is the prefered mapping and the last registed one wins
  +            super.register(javaType, xmlType, sf, df);
  +        } catch (Exception e) {}
  +    }
  +
  +    /**
  +     * Gets the QName for the type mapped to Class.
  +     * @param javaType class or type
  +     * @return xmlType qname or null
  +     */
  +    public QName getTypeQName(Class javaType) {
  +        QName xmlType = super.getTypeQName(javaType);
  +
  +        // Can only detect arrays via code
  +        if (xmlType == null &&
  +            (javaType.isArray() ||
  +             javaType == List.class ||
  +             List.class.isAssignableFrom(javaType))) {
  +            xmlType = Constants.SOAP_ARRAY;
  +        }
  +        return xmlType;
  +    }
  +
  +    // Don't allow anyone to muck with the default type mapping because
  +    // it is a singleton used for the whole system.
  +    public void register(Class javaType, QName xmlType,
  +                         javax.xml.rpc.encoding.SerializerFactory sf,
  +                         javax.xml.rpc.encoding.DeserializerFactory dsf)
  +        throws JAXRPCException {
  +
  +        throw new JAXRPCException();
  +    }
  +    public void removeSerializer(Class javaType, QName xmlType)
  +        throws JAXRPCException {
  +        throw new JAXRPCException();
  +    }
  +    public void removeDeserializer(Class javaType, QName xmlType)
  +        throws JAXRPCException {
  +        throw new JAXRPCException();
  +    }
  +    public void setSupportedEncodings(String[] namespaceURIs) {
  +    }
  +}
  
  
  
  1.32      +1 -2      xml-axis/java/src/org/apache/axis/encoding/DeserializationContextImpl.java
  
  Index: DeserializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContextImpl.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- DeserializationContextImpl.java	30 May 2002 03:06:08 -0000	1.31
  +++ DeserializationContextImpl.java	30 May 2002 23:46:01 -0000	1.32
  @@ -1,5 +1,3 @@
  -package org.apache.axis.encoding;
  -
   /*
    * The Apache Software License, Version 1.1
    *
  @@ -54,6 +52,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +package org.apache.axis.encoding;
   
   import org.apache.axis.attachments.Attachments; 
   
  
  
  
  1.13      +558 -558  xml-axis/java/src/org/apache/axis/encoding/DeserializerImpl.java
  
  Index: DeserializerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializerImpl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DeserializerImpl.java	30 May 2002 03:06:08 -0000	1.12
  +++ DeserializerImpl.java	30 May 2002 23:46:01 -0000	1.13
  @@ -1,558 +1,558 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding;
  -
  -import org.apache.axis.Constants;
  -
  -import org.apache.axis.message.EnvelopeHandler;
  -import org.apache.axis.message.MessageElement;
  -import org.apache.axis.message.SAX2EventRecorder;
  -import org.apache.axis.message.SAXOutputter;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.Part;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.helpers.DefaultHandler;
  -
  -import org.apache.axis.encoding.Target;
  -import javax.xml.rpc.namespace.QName;
  -
  -import java.io.StringWriter;
  -import java.util.Enumeration;
  -import java.util.Vector;
  -
  -/** The Deserializer base class.
  - * 
  - * @author Glen Daniels (gdaniels@allaire.com)
  - * Re-architected for JAX-RPC Compliance by
  - * @author Rich Scheuerle (sche@us.ibm.com)
  - */
  -
  -public class DeserializerImpl extends SOAPHandler
  -        implements javax.xml.rpc.encoding.Deserializer, Deserializer
  -{
  -    protected static Log log =
  -            LogFactory.getLog(DeserializerImpl.class.getName());
  -
  -    protected Object value = null;
  -
  -    // isEnded is set when the endElement is called
  -    protected boolean isEnded = false;
  -
  -    protected Vector targets = null;
  -
  -    protected QName defaultType = null;
  -    private boolean componentsReady = true;
  -
  -
  -    /** 
  -     * JAX-RPC compliant method which returns mechanism type.
  -     */
  -    public String getMechanismType() {
  -        return Constants.AXIS_SAX;
  -    }
  -    
  -    /** 
  -     * Get the deserialized value.
  -     * @return Object representing deserialized value or null
  -     */
  -    public Object getValue()
  -    {
  -        return value;
  -    }
  -    /** 
  -     * Set the deserialized value.
  -     * @param value Object representing deserialized value
  -     */
  -    public void setValue(Object value)
  -    {
  -        this.value = value;
  -    }
  -
  -    /** 
  -     * If the deserializer has component values (like ArrayDeserializer)
  -     * this method gets the specific component via the hint.
  -     * The default implementation returns null.
  -     * @return Object representing deserialized value or null
  -     */
  -    public Object getValue(Object hint)
  -    {
  -        return null;  
  -    }
  -
  -    /** 
  -     * If the deserializer has component values (like ArrayDeserializer)
  -     * this method sets the specific component via the hint.
  -     * The default implementation does nothing.
  -     * @param hint Object representing deserialized value or null
  -     */
  -    public void setValue(Object value, Object hint) throws SAXException
  -    {
  -    }
  -
  -    /**
  -     * In some circumstances an element may not have 
  -     * a type attribute, but a default type qname is known from
  -     * information in the container.  For example,
  -     * an element of an array may not have a type= attribute, 
  -     * so the default qname is the component type of the array.
  -     * This method is used to communicate the default type information 
  -     * to the deserializer.
  -     */
  -    public void setDefaultType(QName qName) {
  -        defaultType = qName;
  -    }
  -    public QName getDefaultType() {
  -        return defaultType;
  -    }
  -
  -    /**
  -     * For deserializers of non-primitives, the value may not be
  -     * known until later (due to multi-referencing).  In such
  -     * cases the deserializer registers Target object(s).  When
  -     * the value is known, the set(value) will be invoked for
  -     * each Target registered with the Deserializer.  The Target
  -     * object abstracts the function of setting a target with a
  -     * value.  See the Target interface for more info.
  -     * @param target
  -     */
  -    public void registerValueTarget(Target target)
  -    {
  -        if (targets == null)
  -            targets = new Vector();
  -        
  -        targets.addElement(target);
  -    }
  -    
  -    /**
  -     * Get the Value Targets of the Deserializer.
  -     * @return Vector of Target objects or null
  -     */
  -    public Vector getValueTargets() {
  -        return targets;
  -    }
  -    
  -    /**
  -     * Remove the Value Targets of the Deserializer.
  -     */
  -    public void removeValueTargets() {
  -        if (targets != null) {
  -            targets.clear();
  -            targets = null;
  -        }
  -    }
  -
  -    /**
  -     * Move someone else's targets to our own (see DeserializationContext)
  -     *
  -     * The DeserializationContext only allows one Deserializer to  
  -     * wait for a unknown multi-ref'ed value.  So to ensure
  -     * that all of the targets are updated, this method is invoked
  -     * to copy the Target objects to the waiting Deserializer.
  -     * @param other is the Deserializer to copy targets from.
  -     */
  -    public void moveValueTargets(Deserializer other)
  -    {
  -        if ((other == null) || (other.getValueTargets() == null))
  -            return;
  -        
  -        if (targets == null)
  -            targets = new Vector();
  -        
  -        Enumeration e = other.getValueTargets().elements();
  -        while (e.hasMoreElements()) {
  -            targets.addElement(e.nextElement());
  -        }
  -        other.removeValueTargets();
  -    }
  -    
  -    /**
  -     * Some deserializers (ArrayDeserializer) require
  -     * all of the component values to be known before the
  -     * value is complete.
  -     * (For the ArrayDeserializer this is important because
  -     * the elements are stored in an ArrayList, and all values
  -     * must be known before the ArrayList is converted into the
  -     * expected array.
  -     *
  -     * This routine is used to indicate when the components are ready.
  -     * The default (true) is useful for most Deserializers.
  -     */
  -    public boolean componentsReady() {
  -        return componentsReady;
  -    }
  -
  -    /** 
  -     * The valueComplete() method is invoked when the
  -     * end tag of the element is read.  This results
  -     * in the setting of all registered Targets (see
  -     * registerValueTarget).
  -     * Note that the valueComplete() only processes
  -     * the Targets if componentReady() returns true.
  -     * So if you override componentReady(), then your
  -     * specific Deserializer will need to call valueComplete()
  -     * when your components are ready (See ArrayDeserializer)
  -     */
  -    public void valueComplete() throws SAXException
  -    {
  -        if (componentsReady()) {            
  -            if (targets != null) {
  -                Enumeration e = targets.elements();
  -                while (e.hasMoreElements()) {
  -                    Target target = (Target)e.nextElement();
  -                    target.set(value);
  -                    if (log.isDebugEnabled()) {
  -                        log.debug(JavaUtils.getMessage("setValueInTarget00",
  -                                                            "" + value, "" + target));
  -                    }
  -                }
  -                // Don't need targets any more, so clear them
  -                removeValueTargets();
  -            }
  -        }
  -    }
  -    
  -    private int startIdx = 0;
  -    private int endIdx = -1;
  -    protected boolean isHref = false;
  -    protected boolean isNil  = false;  // xsd:nil attribute is set to true
  -    protected String id = null;  // Set to the id of the element
  -    
  -    /** 
  -     * Subclasses may override these
  -     */
  -
  -    /**
  -     * This method is invoked when an element start tag is encountered.
  -     * DeserializerImpl provides default behavior, which involves the following:
  -     *   - directly handling the deserialization of a nill value
  -     *   - handling the registration of the id value.
  -     *   - handling the registration of a fixup if this element is an href.
  -     *   - calling onStartElement to do the actual deserialization if not nill or href cases.
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param qName is the prefixed qName of the element
  -     * @param attributes are the attributes on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     *
  -     * Normally a specific Deserializer (FooDeserializer) should extend DeserializerImpl.
  -     * Here is the flow that will occur in such cases:
  -     *   1) DeserializerImpl.startElement(...) will be called and do the id/href/nill stuff.
  -     *   2) If real deserialization needs to take place DeserializerImpl.onStartElement will be
  -     *      invoked, which will attempt to install the specific Deserializer (FooDeserializer)
  -     *   3) The FooDeserializer.startElement(...) will be called to do the Foo specific stuff.
  -     *      This results in a call to FooDeserializer.onStartElement(...) if startElement was
  -     *      not overridden.
  -     *   4) The onChildElement(...) method is called for each child element.  Nothing occurs
  -     *      if not overridden.  The FooDeserializer.onStartChild(...) method should return 
  -     *      the deserializer for the child element.
  -     *   5) When the end tag is reached, the endElement(..) method is invoked.  The default 
  -     *      behavior is to handle hrefs/ids, call onEndElement and then call the Deserializer
  -     *      valueComplete method.
  -     * 
  -     * So the methods that you potentially want to override are:
  -     *   onStartElement, onStartChild, componentsReady, setValue(object, hint)
  -     * You probably should not override startElement or endElement.
  -     * If you need specific behaviour at the end of the element consider overriding
  -     * onEndElement.
  -     *
  -     * See the pre-existing Deserializers for more information.
  -     */
  -    public void startElement(String namespace, String localName,
  -                             String qName, Attributes attributes,
  -                             DeserializationContext context)
  -        throws SAXException
  -    {
  -        super.startElement(namespace, localName, qName, attributes, context);
  -
  -        // If the xsi:nil attribute, set the value to null and return since
  -        // there is nothing to deserialize.
  -        String nil = Constants.getValue(attributes,
  -                                        Constants.NS_URIS_SCHEMA_XSI,
  -                                        "nil");
  -        if (nil != null && nil.equals("true")) {
  -          value = null;
  -          isNil = true;
  -          return;
  -        }
  -
  -        // If this element has an id, then associate the value with the id.
  -        // (Prior to this association, the MessageElement of the element is
  -        // associated with the id. Failure to replace the MessageElement at this
  -        // point will cause an infinite loop during deserialization if the 
  -        // current element contains child elements that cause an href back to this id.)
  -        // Also note that that endElement() method is responsible for the final
  -        // association of this id with the completed value.
  -        id = attributes.getValue("id");
  -        if (id != null) {
  -            context.addObjectById(id, value);
  -            if (log.isDebugEnabled()) {
  -                log.debug(JavaUtils.getMessage("deserInitPutValueDebug00", "" + value, id));
  -            }
  -            context.registerFixup("#" + id, this);
  -        }
  -
  -        String href = attributes.getValue("href");
  -        if (href != null) {
  -            isHref = true;
  -
  -            Object ref = context.getObjectByRef(href);            
  -            if (log.isDebugEnabled()) {
  -                log.debug(JavaUtils.getMessage(
  -                        "gotForID00",
  -                        new String[] {"" + ref, href, (ref == null ? "*null*" : ref.getClass().toString())}));
  -            }
  -            
  -            if (ref == null) {
  -                // Nothing yet... register for later interest.
  -                context.registerFixup(href, this);
  -                componentsReady = false;
  -                return;
  -            }
  -            
  -            if (ref instanceof MessageElement) {
  -                context.replaceElementHandler(new EnvelopeHandler(this));
  -
  -                SAX2EventRecorder r = context.getRecorder();
  -                context.setRecorder(null);
  -                ((MessageElement)ref).publishToHandler((DefaultHandler) context);
  -                context.setRecorder(r);
  -            } else {
  -
  -                if( !href.startsWith("#") && defaultType != null && ref instanceof Part ){
  -                    //For attachments this is the end of the road-- invoke deserializer
  -                    Deserializer dser = (Deserializer)context.getDeserializerForType(defaultType );
  -                    if(null != dser){          
  -                      dser.startElement(namespace, localName,
  -                             qName, attributes,
  -                             context);
  -                      ref = dser.getValue();       
  -                             
  -                    }         
  -               }
  -                
  -                // If the ref is not a MessageElement, then it must be an
  -                // element that has already been deserialized.  Use it directly.
  -                value = ref;
  -                valueComplete();
  -            }
  -            
  -        } else {
  -            isHref = false;
  -            onStartElement(namespace, localName, qName, attributes,
  -                           context);
  -        }
  -    }
  -
  -    /**
  -     * This method is invoked after startElement when the element requires
  -     * deserialization (i.e. the element is not an href and the value is not nil.)
  -     * DeserializerImpl provides default behavior, which simply
  -     * involves obtaining a correct Deserializer and plugging its handler.
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param qName is the prefixed qName of the element
  -     * @param attributes are the attributes on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     */
  -    public void onStartElement(String namespace, String localName,
  -                             String qName, Attributes attributes,
  -                             DeserializationContext context)
  -        throws SAXException
  -    {
  -        // If I'm the base class, try replacing myself with an
  -        // appropriate deserializer gleaned from type info.
  -        if (this.getClass().equals(DeserializerImpl.class)) {
  -            QName type = context.getTypeFromAttributes(namespace,
  -                                                       localName,
  -                                                       attributes);
  -            // If no type is specified, use the defaultType if available.
  -            // xsd:string is used if no type is provided.
  -            if (type == null) {
  -                type = defaultType;
  -                if (type == null) {
  -                    type = Constants.XSD_STRING;
  -                }
  -            }
  -            
  -            if (log.isDebugEnabled()) {
  -                log.debug(JavaUtils.getMessage("gotType00", "Deser", "" + type));
  -            }
  -            
  -            // We know we're deserializing, but we don't have
  -            // a specific deserializer.  So create one using the
  -            // attribute type qname.
  -            if (type != null) {
  -                Deserializer dser = (Deserializer)context.getDeserializerForType(type);
  -                if (dser != null) {
  -                    // Move the value targets to the new deserializer
  -                    dser.moveValueTargets(this);
  -                    context.replaceElementHandler((SOAPHandler) dser);
  -                    // And don't forget to give it the start event...
  -                    dser.startElement(namespace, localName, qName,
  -                                      attributes, context);
  -                } else {
  -                    throw new SAXException(
  -                                           JavaUtils.getMessage("noDeser00", "" + type));
  -                }
  -            } else {
  -                startIdx = context.getCurrentRecordPos();
  -            }
  -        }
  -    }
  -    
  -    /**
  -     * onStartChild is called on each child element.
  -     * The default behavior supplied by DeserializationImpl is to do nothing.
  -     * A specific deserializer may perform other tasks.  For example a 
  -     * BeanDeserializer will construct a deserializer for the indicated 
  -     * property and return it.
  -     * @param namespace is the namespace of the child element
  -     * @param localName is the local name of the child element
  -     * @param prefix is the prefix used on the name of the child element
  -     * @param attributes are the attributes of the child element
  -     * @param context is the deserialization context.
  -     * @return is a Deserializer to use to deserialize a child (must be
  -     * a derived class of SOAPHandler) or null if no deserialization should
  -     * be performed.
  -     */
  -    public SOAPHandler onStartChild(String namespace, String localName,
  -                             String prefix, Attributes attributes,
  -                             DeserializationContext context)
  -        throws SAXException
  -    {
  -        return null;
  -    }
  -    
  -    
  -
  -    /** 
  -     * endElement is called when the end element tag is reached.
  -     * It handles href/id information for multi-ref processing
  -     * and invokes the valueComplete() method of the deserializer
  -     * which sets the targets with the deserialized value.
  -     * @param namespace is the namespace of the child element
  -     * @param localName is the local name of the child element
  -     * @param context is the deserialization context
  -     */
  -    public final void endElement(String namespace, String localName,
  -                           DeserializationContext context)
  -        throws SAXException
  -    {
  -
  -        isEnded = true;
  -        if (!isHref) {
  -            onEndElement(namespace, localName, context);
  -        }
  -        
  -        // Time to call valueComplete to copy the value to 
  -        // the targets.  First a call is made to componentsReady
  -        // to ensure that all components are ready.
  -        if (componentsReady()) {
  -            valueComplete();
  -        }
  -
  -        // If this element has an id, then associate the value with the id.
  -        // Subsequent hrefs to the id will obtain the value directly.
  -        // This is necessary for proper multi-reference deserialization.
  -        if (id != null) {
  -            context.addObjectById(id, value);
  -            if (log.isDebugEnabled()) {
  -                log.debug(JavaUtils.getMessage("deserPutValueDebug00", "" + value, id));
  -            }     
  -        }
  -    }
  -
  -   /**
  -     * onEndElement is called by endElement.  It is not called
  -     * if the element has an href.
  -     * @param namespace is the namespace of the child element
  -     * @param localName is the local name of the child element
  -     * @param context is the deserialization context
  -     */
  -    public void onEndElement(String namespace, String localName,
  -                           DeserializationContext context)
  -        throws SAXException
  -    {
  -        // If we only have SAX events, but someone really wanted a
  -        // value, try sending them the contents of this element
  -        // as a String...
  -        // ??? Is this the right thing to do here?
  -        
  -        if (this.getClass().equals(DeserializerImpl.class) &&
  -            targets != null &&
  -            !targets.isEmpty()) {
  -            endIdx = context.getCurrentRecordPos();
  -            
  -            StringWriter writer = new StringWriter();
  -            SerializationContextImpl serContext = 
  -                        new SerializationContextImpl(writer,
  -                                                 context.getMessageContext());
  -            serContext.setSendDecl(false);
  -            
  -            SAXOutputter so = null;
  -            so = new SAXOutputter(serContext);
  -            context.getCurElement().publishContents(so);
  -            if (!isNil) {
  -                value = writer.getBuffer().toString();
  -            }
  -        }
  -    }
  -    
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding;
  +
  +import org.apache.axis.Constants;
  +
  +import org.apache.axis.message.EnvelopeHandler;
  +import org.apache.axis.message.MessageElement;
  +import org.apache.axis.message.SAX2EventRecorder;
  +import org.apache.axis.message.SAXOutputter;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.Part;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.helpers.DefaultHandler;
  +
  +import org.apache.axis.encoding.Target;
  +import javax.xml.rpc.namespace.QName;
  +
  +import java.io.StringWriter;
  +import java.util.Enumeration;
  +import java.util.Vector;
  +
  +/** The Deserializer base class.
  + * 
  + * @author Glen Daniels (gdaniels@allaire.com)
  + * Re-architected for JAX-RPC Compliance by
  + * @author Rich Scheuerle (sche@us.ibm.com)
  + */
  +
  +public class DeserializerImpl extends SOAPHandler
  +        implements javax.xml.rpc.encoding.Deserializer, Deserializer
  +{
  +    protected static Log log =
  +            LogFactory.getLog(DeserializerImpl.class.getName());
  +
  +    protected Object value = null;
  +
  +    // isEnded is set when the endElement is called
  +    protected boolean isEnded = false;
  +
  +    protected Vector targets = null;
  +
  +    protected QName defaultType = null;
  +    private boolean componentsReady = true;
  +
  +
  +    /** 
  +     * JAX-RPC compliant method which returns mechanism type.
  +     */
  +    public String getMechanismType() {
  +        return Constants.AXIS_SAX;
  +    }
  +    
  +    /** 
  +     * Get the deserialized value.
  +     * @return Object representing deserialized value or null
  +     */
  +    public Object getValue()
  +    {
  +        return value;
  +    }
  +    /** 
  +     * Set the deserialized value.
  +     * @param value Object representing deserialized value
  +     */
  +    public void setValue(Object value)
  +    {
  +        this.value = value;
  +    }
  +
  +    /** 
  +     * If the deserializer has component values (like ArrayDeserializer)
  +     * this method gets the specific component via the hint.
  +     * The default implementation returns null.
  +     * @return Object representing deserialized value or null
  +     */
  +    public Object getValue(Object hint)
  +    {
  +        return null;  
  +    }
  +
  +    /** 
  +     * If the deserializer has component values (like ArrayDeserializer)
  +     * this method sets the specific component via the hint.
  +     * The default implementation does nothing.
  +     * @param hint Object representing deserialized value or null
  +     */
  +    public void setValue(Object value, Object hint) throws SAXException
  +    {
  +    }
  +
  +    /**
  +     * In some circumstances an element may not have 
  +     * a type attribute, but a default type qname is known from
  +     * information in the container.  For example,
  +     * an element of an array may not have a type= attribute, 
  +     * so the default qname is the component type of the array.
  +     * This method is used to communicate the default type information 
  +     * to the deserializer.
  +     */
  +    public void setDefaultType(QName qName) {
  +        defaultType = qName;
  +    }
  +    public QName getDefaultType() {
  +        return defaultType;
  +    }
  +
  +    /**
  +     * For deserializers of non-primitives, the value may not be
  +     * known until later (due to multi-referencing).  In such
  +     * cases the deserializer registers Target object(s).  When
  +     * the value is known, the set(value) will be invoked for
  +     * each Target registered with the Deserializer.  The Target
  +     * object abstracts the function of setting a target with a
  +     * value.  See the Target interface for more info.
  +     * @param target
  +     */
  +    public void registerValueTarget(Target target)
  +    {
  +        if (targets == null)
  +            targets = new Vector();
  +        
  +        targets.addElement(target);
  +    }
  +    
  +    /**
  +     * Get the Value Targets of the Deserializer.
  +     * @return Vector of Target objects or null
  +     */
  +    public Vector getValueTargets() {
  +        return targets;
  +    }
  +    
  +    /**
  +     * Remove the Value Targets of the Deserializer.
  +     */
  +    public void removeValueTargets() {
  +        if (targets != null) {
  +            targets.clear();
  +            targets = null;
  +        }
  +    }
  +
  +    /**
  +     * Move someone else's targets to our own (see DeserializationContext)
  +     *
  +     * The DeserializationContext only allows one Deserializer to  
  +     * wait for a unknown multi-ref'ed value.  So to ensure
  +     * that all of the targets are updated, this method is invoked
  +     * to copy the Target objects to the waiting Deserializer.
  +     * @param other is the Deserializer to copy targets from.
  +     */
  +    public void moveValueTargets(Deserializer other)
  +    {
  +        if ((other == null) || (other.getValueTargets() == null))
  +            return;
  +        
  +        if (targets == null)
  +            targets = new Vector();
  +        
  +        Enumeration e = other.getValueTargets().elements();
  +        while (e.hasMoreElements()) {
  +            targets.addElement(e.nextElement());
  +        }
  +        other.removeValueTargets();
  +    }
  +    
  +    /**
  +     * Some deserializers (ArrayDeserializer) require
  +     * all of the component values to be known before the
  +     * value is complete.
  +     * (For the ArrayDeserializer this is important because
  +     * the elements are stored in an ArrayList, and all values
  +     * must be known before the ArrayList is converted into the
  +     * expected array.
  +     *
  +     * This routine is used to indicate when the components are ready.
  +     * The default (true) is useful for most Deserializers.
  +     */
  +    public boolean componentsReady() {
  +        return componentsReady;
  +    }
  +
  +    /** 
  +     * The valueComplete() method is invoked when the
  +     * end tag of the element is read.  This results
  +     * in the setting of all registered Targets (see
  +     * registerValueTarget).
  +     * Note that the valueComplete() only processes
  +     * the Targets if componentReady() returns true.
  +     * So if you override componentReady(), then your
  +     * specific Deserializer will need to call valueComplete()
  +     * when your components are ready (See ArrayDeserializer)
  +     */
  +    public void valueComplete() throws SAXException
  +    {
  +        if (componentsReady()) {            
  +            if (targets != null) {
  +                Enumeration e = targets.elements();
  +                while (e.hasMoreElements()) {
  +                    Target target = (Target)e.nextElement();
  +                    target.set(value);
  +                    if (log.isDebugEnabled()) {
  +                        log.debug(JavaUtils.getMessage("setValueInTarget00",
  +                                                            "" + value, "" + target));
  +                    }
  +                }
  +                // Don't need targets any more, so clear them
  +                removeValueTargets();
  +            }
  +        }
  +    }
  +    
  +    private int startIdx = 0;
  +    private int endIdx = -1;
  +    protected boolean isHref = false;
  +    protected boolean isNil  = false;  // xsd:nil attribute is set to true
  +    protected String id = null;  // Set to the id of the element
  +    
  +    /** 
  +     * Subclasses may override these
  +     */
  +
  +    /**
  +     * This method is invoked when an element start tag is encountered.
  +     * DeserializerImpl provides default behavior, which involves the following:
  +     *   - directly handling the deserialization of a nill value
  +     *   - handling the registration of the id value.
  +     *   - handling the registration of a fixup if this element is an href.
  +     *   - calling onStartElement to do the actual deserialization if not nill or href cases.
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param qName is the prefixed qName of the element
  +     * @param attributes are the attributes on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     *
  +     * Normally a specific Deserializer (FooDeserializer) should extend DeserializerImpl.
  +     * Here is the flow that will occur in such cases:
  +     *   1) DeserializerImpl.startElement(...) will be called and do the id/href/nill stuff.
  +     *   2) If real deserialization needs to take place DeserializerImpl.onStartElement will be
  +     *      invoked, which will attempt to install the specific Deserializer (FooDeserializer)
  +     *   3) The FooDeserializer.startElement(...) will be called to do the Foo specific stuff.
  +     *      This results in a call to FooDeserializer.onStartElement(...) if startElement was
  +     *      not overridden.
  +     *   4) The onChildElement(...) method is called for each child element.  Nothing occurs
  +     *      if not overridden.  The FooDeserializer.onStartChild(...) method should return 
  +     *      the deserializer for the child element.
  +     *   5) When the end tag is reached, the endElement(..) method is invoked.  The default 
  +     *      behavior is to handle hrefs/ids, call onEndElement and then call the Deserializer
  +     *      valueComplete method.
  +     * 
  +     * So the methods that you potentially want to override are:
  +     *   onStartElement, onStartChild, componentsReady, setValue(object, hint)
  +     * You probably should not override startElement or endElement.
  +     * If you need specific behaviour at the end of the element consider overriding
  +     * onEndElement.
  +     *
  +     * See the pre-existing Deserializers for more information.
  +     */
  +    public void startElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        super.startElement(namespace, localName, qName, attributes, context);
  +
  +        // If the xsi:nil attribute, set the value to null and return since
  +        // there is nothing to deserialize.
  +        String nil = Constants.getValue(attributes,
  +                                        Constants.NS_URIS_SCHEMA_XSI,
  +                                        "nil");
  +        if (nil != null && nil.equals("true")) {
  +          value = null;
  +          isNil = true;
  +          return;
  +        }
  +
  +        // If this element has an id, then associate the value with the id.
  +        // (Prior to this association, the MessageElement of the element is
  +        // associated with the id. Failure to replace the MessageElement at this
  +        // point will cause an infinite loop during deserialization if the 
  +        // current element contains child elements that cause an href back to this id.)
  +        // Also note that that endElement() method is responsible for the final
  +        // association of this id with the completed value.
  +        id = attributes.getValue("id");
  +        if (id != null) {
  +            context.addObjectById(id, value);
  +            if (log.isDebugEnabled()) {
  +                log.debug(JavaUtils.getMessage("deserInitPutValueDebug00", "" + value, id));
  +            }
  +            context.registerFixup("#" + id, this);
  +        }
  +
  +        String href = attributes.getValue("href");
  +        if (href != null) {
  +            isHref = true;
  +
  +            Object ref = context.getObjectByRef(href);            
  +            if (log.isDebugEnabled()) {
  +                log.debug(JavaUtils.getMessage(
  +                        "gotForID00",
  +                        new String[] {"" + ref, href, (ref == null ? "*null*" : ref.getClass().toString())}));
  +            }
  +            
  +            if (ref == null) {
  +                // Nothing yet... register for later interest.
  +                context.registerFixup(href, this);
  +                componentsReady = false;
  +                return;
  +            }
  +            
  +            if (ref instanceof MessageElement) {
  +                context.replaceElementHandler(new EnvelopeHandler(this));
  +
  +                SAX2EventRecorder r = context.getRecorder();
  +                context.setRecorder(null);
  +                ((MessageElement)ref).publishToHandler((DefaultHandler) context);
  +                context.setRecorder(r);
  +            } else {
  +
  +                if( !href.startsWith("#") && defaultType != null && ref instanceof Part ){
  +                    //For attachments this is the end of the road-- invoke deserializer
  +                    Deserializer dser = (Deserializer)context.getDeserializerForType(defaultType );
  +                    if(null != dser){          
  +                      dser.startElement(namespace, localName,
  +                             qName, attributes,
  +                             context);
  +                      ref = dser.getValue();       
  +                             
  +                    }         
  +               }
  +                
  +                // If the ref is not a MessageElement, then it must be an
  +                // element that has already been deserialized.  Use it directly.
  +                value = ref;
  +                valueComplete();
  +            }
  +            
  +        } else {
  +            isHref = false;
  +            onStartElement(namespace, localName, qName, attributes,
  +                           context);
  +        }
  +    }
  +
  +    /**
  +     * This method is invoked after startElement when the element requires
  +     * deserialization (i.e. the element is not an href and the value is not nil.)
  +     * DeserializerImpl provides default behavior, which simply
  +     * involves obtaining a correct Deserializer and plugging its handler.
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param qName is the prefixed qName of the element
  +     * @param attributes are the attributes on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     */
  +    public void onStartElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        // If I'm the base class, try replacing myself with an
  +        // appropriate deserializer gleaned from type info.
  +        if (this.getClass().equals(DeserializerImpl.class)) {
  +            QName type = context.getTypeFromAttributes(namespace,
  +                                                       localName,
  +                                                       attributes);
  +            // If no type is specified, use the defaultType if available.
  +            // xsd:string is used if no type is provided.
  +            if (type == null) {
  +                type = defaultType;
  +                if (type == null) {
  +                    type = Constants.XSD_STRING;
  +                }
  +            }
  +            
  +            if (log.isDebugEnabled()) {
  +                log.debug(JavaUtils.getMessage("gotType00", "Deser", "" + type));
  +            }
  +            
  +            // We know we're deserializing, but we don't have
  +            // a specific deserializer.  So create one using the
  +            // attribute type qname.
  +            if (type != null) {
  +                Deserializer dser = (Deserializer)context.getDeserializerForType(type);
  +                if (dser != null) {
  +                    // Move the value targets to the new deserializer
  +                    dser.moveValueTargets(this);
  +                    context.replaceElementHandler((SOAPHandler) dser);
  +                    // And don't forget to give it the start event...
  +                    dser.startElement(namespace, localName, qName,
  +                                      attributes, context);
  +                } else {
  +                    throw new SAXException(
  +                                           JavaUtils.getMessage("noDeser00", "" + type));
  +                }
  +            } else {
  +                startIdx = context.getCurrentRecordPos();
  +            }
  +        }
  +    }
  +    
  +    /**
  +     * onStartChild is called on each child element.
  +     * The default behavior supplied by DeserializationImpl is to do nothing.
  +     * A specific deserializer may perform other tasks.  For example a 
  +     * BeanDeserializer will construct a deserializer for the indicated 
  +     * property and return it.
  +     * @param namespace is the namespace of the child element
  +     * @param localName is the local name of the child element
  +     * @param prefix is the prefix used on the name of the child element
  +     * @param attributes are the attributes of the child element
  +     * @param context is the deserialization context.
  +     * @return is a Deserializer to use to deserialize a child (must be
  +     * a derived class of SOAPHandler) or null if no deserialization should
  +     * be performed.
  +     */
  +    public SOAPHandler onStartChild(String namespace, String localName,
  +                             String prefix, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        return null;
  +    }
  +    
  +    
  +
  +    /** 
  +     * endElement is called when the end element tag is reached.
  +     * It handles href/id information for multi-ref processing
  +     * and invokes the valueComplete() method of the deserializer
  +     * which sets the targets with the deserialized value.
  +     * @param namespace is the namespace of the child element
  +     * @param localName is the local name of the child element
  +     * @param context is the deserialization context
  +     */
  +    public final void endElement(String namespace, String localName,
  +                           DeserializationContext context)
  +        throws SAXException
  +    {
  +
  +        isEnded = true;
  +        if (!isHref) {
  +            onEndElement(namespace, localName, context);
  +        }
  +        
  +        // Time to call valueComplete to copy the value to 
  +        // the targets.  First a call is made to componentsReady
  +        // to ensure that all components are ready.
  +        if (componentsReady()) {
  +            valueComplete();
  +        }
  +
  +        // If this element has an id, then associate the value with the id.
  +        // Subsequent hrefs to the id will obtain the value directly.
  +        // This is necessary for proper multi-reference deserialization.
  +        if (id != null) {
  +            context.addObjectById(id, value);
  +            if (log.isDebugEnabled()) {
  +                log.debug(JavaUtils.getMessage("deserPutValueDebug00", "" + value, id));
  +            }     
  +        }
  +    }
  +
  +   /**
  +     * onEndElement is called by endElement.  It is not called
  +     * if the element has an href.
  +     * @param namespace is the namespace of the child element
  +     * @param localName is the local name of the child element
  +     * @param context is the deserialization context
  +     */
  +    public void onEndElement(String namespace, String localName,
  +                           DeserializationContext context)
  +        throws SAXException
  +    {
  +        // If we only have SAX events, but someone really wanted a
  +        // value, try sending them the contents of this element
  +        // as a String...
  +        // ??? Is this the right thing to do here?
  +        
  +        if (this.getClass().equals(DeserializerImpl.class) &&
  +            targets != null &&
  +            !targets.isEmpty()) {
  +            endIdx = context.getCurrentRecordPos();
  +            
  +            StringWriter writer = new StringWriter();
  +            SerializationContextImpl serContext = 
  +                        new SerializationContextImpl(writer,
  +                                                 context.getMessageContext());
  +            serContext.setSendDecl(false);
  +            
  +            SAXOutputter so = null;
  +            so = new SAXOutputter(serContext);
  +            context.getCurElement().publishContents(so);
  +            if (!isNil) {
  +                value = writer.getBuffer().toString();
  +            }
  +        }
  +    }
  +    
  +}
  
  
  
  1.15      +699 -699  xml-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializer.java
  
  Index: ArrayDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ArrayDeserializer.java	30 May 2002 03:06:08 -0000	1.14
  +++ ArrayDeserializer.java	30 May 2002 23:46:01 -0000	1.15
  @@ -1,699 +1,699 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.encoding.DeserializerTarget;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.util.ArrayList;
  -import java.util.HashMap;
  -import java.util.HashSet;
  -import java.util.StringTokenizer;
  -
  -
  -/**
  - * An ArrayDeserializer handles deserializing SOAP
  - * arrays.
  - * 
  - * Some code borrowed from ApacheSOAP - thanks to Matt Duftler!
  - * 
  - * @author Glen Daniels (gdaniels@macromedia.com)
  - * 
  - * Multi-reference stuff:
  - * @author Rich Scheuerle (scheu@us.ibm.com)
  - */
  -public class ArrayDeserializer extends DeserializerImpl
  -{
  -    protected static Log log =
  -        LogFactory.getLog(ArrayDeserializer.class.getName());
  -
  -    public QName arrayType = null;
  -    public int curIndex = 0;
  -    QName defaultItemType;
  -    int length;
  -    Class arrayClass = null;
  -    ArrayList mDimLength = null;  // If set, array of multi-dim lengths 
  -    ArrayList mDimFactor = null;  // If set, array of factors for multi-dim []
  -    HashSet waiting = new HashSet();  // List of indices waiting for completion
  -
  -
  -    /**
  -     * This method is invoked after startElement when the element requires
  -     * deserialization (i.e. the element is not an href & the value is not nil)
  -     * DeserializerImpl provides default behavior, which simply
  -     * involves obtaining a correct Deserializer and plugging its handler.
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param qName is the prefixed qname of the element
  -     * @param attributes are the attrs on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     */
  -    public void onStartElement(String namespace, String localName,
  -                             String qName, Attributes attributes,
  -                             DeserializationContext context)
  -        throws SAXException
  -    {
  -        // Deserializing the xml array requires processing the
  -        // xsi:type= attribute, the soapenc:arrayType attribute,
  -        // and the xsi:type attributes of the individual elements.
  -        //
  -        // The xsi:type=<qName> attribute is used to determine the java
  -        // type of the array to instantiate.  Axis expects it
  -        // to be set to the generic "soapenc:Array" or to
  -        // a specific qName.  If the generic "soapenc:Array"
  -        // specification is used, Axis determines the array
  -        // type by examining the soapenc:arrayType attribute.
  -        //
  -        // The soapenc:arrayType=<qname><dims> is used to determine
  -        // i) the number of dimensions, 
  -        // ii) the length of each dimension,
  -        // iii) the default xsi:type of each of the elements.
  -        //
  -        // If the arrayType attribute is missing, Axis assumes
  -        // a single dimension array with length equal to the number
  -        // of nested elements.  In such cases, the default xsi:type of 
  -        // the elements is determined using the array xsi:type.
  -        //
  -        // The xsi:type attributes of the individual elements of the
  -        // array are used to determine the java type of the element.
  -        // If the xsi:type attribute is missing for an element, the 
  -        // default xsi:type value is used.
  -
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: ArrayDeserializer::startElement()");
  -        }
  -
  -        // Get the qname for the array type=, set it to null if
  -        // the generic type is used.
  -        QName typeQName = context.getTypeFromAttributes(namespace,
  -                                                        localName,
  -                                                        attributes);
  -        if (typeQName != null && 
  -            Constants.equals(Constants.SOAP_ARRAY, typeQName)) {
  -            typeQName = null;
  -        }
  -
  -        // Now get the arrayType value 
  -        QName arrayTypeValue = context.getQNameFromString(
  -                      Constants.getValue(attributes,
  -                                         Constants.NS_URIS_SOAP_ENC,
  -                                         Constants.ATTR_ARRAY_TYPE));
  -
  -        // The first part of the arrayType expression is 
  -        // the default item type qname.
  -        // The second part is the dimension information
  -        String dimString = null;
  -        QName innerQName = null;
  -        String innerDimString = "";
  -        if (arrayTypeValue != null) {
  -            String arrayTypeValueNamespaceURI = 
  -                arrayTypeValue.getNamespaceURI();
  -            String arrayTypeValueLocalPart = 
  -                arrayTypeValue.getLocalPart();
  -            int leftBracketIndex = 
  -                arrayTypeValueLocalPart.lastIndexOf('[');
  -            int rightBracketIndex = 
  -                arrayTypeValueLocalPart.lastIndexOf(']');
  -            if (leftBracketIndex == -1
  -                || rightBracketIndex == -1
  -                || rightBracketIndex < leftBracketIndex)
  -                {
  -                    throw new IllegalArgumentException(
  -                      JavaUtils.getMessage("badArrayType00", 
  -                                           "" + arrayTypeValue));
  -                }
  -            
  -            dimString = 
  -                arrayTypeValueLocalPart.substring(leftBracketIndex + 1,
  -                                                  rightBracketIndex);
  -            arrayTypeValueLocalPart = 
  -                arrayTypeValueLocalPart.substring(0, leftBracketIndex);
  -            
  -            // If multi-dim array set to soapenc:Array
  -            if (arrayTypeValueLocalPart.endsWith("]")) {
  -                defaultItemType = Constants.SOAP_ARRAY;
  -                innerQName = new QName(
  -                    arrayTypeValueNamespaceURI,
  -                    arrayTypeValueLocalPart.substring(0,
  -                        arrayTypeValueLocalPart.indexOf("["))); 
  -                innerDimString = arrayTypeValueLocalPart.substring(
  -                    arrayTypeValueLocalPart.indexOf("["));
  -            } else {
  -                defaultItemType = new QName(arrayTypeValueNamespaceURI,
  -                                            arrayTypeValueLocalPart);
  -            }
  -        }
  -
  -        // If no type QName and no defaultItemType qname, use xsd:anyType
  -        if (defaultItemType == null && typeQName == null) {
  -            defaultItemType = Constants.XSD_ANYTYPE;
  -        }
  -        
  -        // Determine the class type for the array.
  -        arrayClass = null;
  -        if (typeQName != null) {
  -            arrayClass = context.getTypeMapping().
  -                getClassForQName(typeQName);
  -        } else {
  -            // type= information is not sufficient.
  -            // Get an array of the default item type.
  -            Class arrayItemClass = null;
  -            QName compQName = defaultItemType;
  -            String dims = "[]";
  -            // Nested array, use the innermost qname
  -            if (innerQName != null) {
  -                compQName = innerQName;
  -                dims += innerDimString;                
  -            }
  -            arrayItemClass = context.getTypeMapping().
  -                getClassForQName(compQName);
  -            if (arrayItemClass != null) {
  -                try {
  -                    ClassLoader cl = 
  -                        context.getMessageContext().getClassLoader();
  -                    arrayClass = Class.forName(
  -                      JavaUtils.getLoadableClassName(
  -                        JavaUtils.getTextClassName(arrayItemClass.getName()) +
  -                        dims),
  -                      true, cl);   
  -                } catch (Exception e) {
  -                    throw new SAXException(
  -                       JavaUtils.getMessage("noComponent00",  
  -                                            "" + defaultItemType));
  -                }
  -            }
  -        }
  -
  -        if (arrayClass == null) {
  -            throw new SAXException(
  -               JavaUtils.getMessage("noComponent00",  "" + defaultItemType));
  -        }
  -
  -        if (dimString == null || dimString.length() == 0) {
  -            // Size determined using length of the members
  -            value = new ArrayListExtension(arrayClass);
  -        }
  -        else {
  -            try
  -            {
  -                StringTokenizer tokenizer = new StringTokenizer(dimString,
  -                                                                "[],");
  -
  -                length = Integer.parseInt(tokenizer.nextToken());
  -
  -                if (tokenizer.hasMoreTokens())
  -                    {
  -                        // If the array is passed as a multi-dimensional array
  -                        // (i.e. int[2][3]) then store all of the 
  -                        // mult-dim lengths.
  -                        // The valueReady method uses this array to set the
  -                        // proper mult-dim element.
  -                        mDimLength = new ArrayList();
  -                        mDimLength.add(new Integer(length));
  -                        
  -                        while(tokenizer.hasMoreTokens()) {
  -                            mDimLength.add(
  -                                new Integer(
  -                                    Integer.parseInt(tokenizer.nextToken())));
  -                        }
  -                    }
  -
  -                // Create an ArrayListExtension class to store the ArrayList
  -                // plus converted objects.
  -                ArrayList list = new ArrayListExtension(arrayClass, length);
  -                // ArrayList lacks a setSize(), so...
  -                for (int i = 0; i < length; i++) {
  -                    list.add(null);
  -                }
  -                value = list;
  -
  -            }
  -            catch (NumberFormatException e)
  -            {
  -                throw new IllegalArgumentException(
  -                        JavaUtils.getMessage("badInteger00", dimString));
  -            }
  -        }
  -
  -        // If soapenc:offset specified, set the current index accordingly
  -        String offset = Constants.getValue(attributes,
  -                                         Constants.NS_URIS_SOAP_ENC,
  -                                         Constants.ATTR_OFFSET);
  -        if (offset != null) {
  -            int leftBracketIndex = offset.lastIndexOf('[');
  -            int rightBracketIndex = offset.lastIndexOf(']');
  -
  -            if (leftBracketIndex == -1
  -                || rightBracketIndex == -1
  -                || rightBracketIndex < leftBracketIndex)
  -            {
  -                throw new SAXException(
  -                        JavaUtils.getMessage("badOffset00", offset));
  -            }
  -
  -            curIndex = 
  -                convertToIndex(offset.substring(leftBracketIndex + 1,
  -                                                rightBracketIndex),
  -                               "badOffset00");
  -        }
  -        
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: ArrayDeserializer::startElement()");
  -        }
  -    }
  -    
  -
  -    /**
  -     * onStartChild is called on each child element.
  -     * @param namespace is the namespace of the child element
  -     * @param localName is the local name of the child element
  -     * @param prefix is the prefix used on the name of the child element
  -     * @param attributes are the attributes of the child element
  -     * @param context is the deserialization context.
  -     * @return is a Deserializer to use to deserialize a child (must be
  -     * a derived class of SOAPHandler) or null if no deserialization should
  -     * be performed.
  -     */
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: ArrayDeserializer.onStartChild()");
  -        }
  -
  -        // If the position attribute is set, 
  -        // use it to update the current index
  -        if (attributes != null) {
  -            String pos =
  -                Constants.getValue(attributes,
  -                                   Constants.NS_URIS_SOAP_ENC,
  -                                   Constants.ATTR_POSITION);
  -            if (pos != null) {
  -                int leftBracketIndex = pos.lastIndexOf('[');
  -                int rightBracketIndex = pos.lastIndexOf(']');
  -
  -                if (leftBracketIndex == -1
  -                    || rightBracketIndex == -1
  -                    || rightBracketIndex < leftBracketIndex)
  -                {
  -                    throw new SAXException(
  -                            JavaUtils.getMessage("badPosition00", pos));
  -                }
  -                
  -                curIndex = 
  -                    convertToIndex(pos.substring(leftBracketIndex + 1,
  -                                                 rightBracketIndex),
  -                                   "badPosition00");
  -            }
  -
  -            // If the xsi:nil attribute, set the value to null 
  -            // and return since there is nothing to deserialize.
  -            if (context.isNil(attributes)) {
  -                setValue(null, new Integer(curIndex++));
  -                return null;
  -            }
  -        }
  -
  -        // Use the xsi:type setting on the attribute if it exists.
  -        QName itemType = context.getTypeFromAttributes(namespace,
  -                                                       localName,
  -                                                       attributes);
  -
  -        // Get the deserializer for the type.  If no deserializer is 
  -        // found, the deserializer is set to DeserializerImpl().
  -        // It is possible that the element has an href, thus we
  -        // won't know the type until the definitition is encountered.
  -        Deserializer dSer = null;
  -        if (itemType != null) {
  -            dSer = context.getDeserializerForType(itemType);
  -        }
  -        if (dSer == null) {
  -            dSer = new DeserializerImpl();
  -            // Determine a default type for the deserializer
  -            if (itemType == null) {
  -                QName defaultType = defaultItemType;
  -                // If defaultType is not known, try using the arrayClass info
  -                if (defaultType == null &&
  -                    arrayClass != null &&
  -                    arrayClass.isArray()) {
  -                    defaultType = context.getTypeMapping().
  -                        getTypeQName(arrayClass.getComponentType());
  -                }
  -                dSer.setDefaultType(defaultType);
  -            }
  -        }
  -
  -
  -        // Register the callback value target, and
  -        // keep track of this index so we know when it has been set.
  -        dSer.registerValueTarget(
  -            new DeserializerTarget(this, new Integer(curIndex)));
  -        waiting.add(new Integer(curIndex));
  -
  -        curIndex++;
  -        
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: ArrayDeserializer.onStartChild()");
  -        }
  -        
  -        return (SOAPHandler)dSer;
  -    }
  -
  -    /** 
  -     * Need to wait for all indices to be set.
  -     */
  -    public boolean componentsReady() {
  -        return (waiting.size() == 0);
  -    }
  -
  -    /**
  -     * set is called during deserialization to assign
  -     * the Object value to the array position indicated by hint.
  -     * The hint is always a single Integer.  If the array being
  -     * deserialized is a multi-dimensional array, the hint is 
  -     * converted into a series of indices to set the correct
  -     * nested position.
  -     * The array deserializer always deserializes into
  -     * an ArrayList, which is converted and copied into the
  -     * actual array after completion (by valueComplete).
  -     * It is important to wait until all indices have been 
  -     * processed before invoking valueComplete.
  -     * @param value value of the array element
  -     * @param hint index of the array element (Integer)
  -     **/
  -    public void setValue(Object value, Object hint) throws SAXException
  -    { 
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: ArrayDeserializer::setValue(" + value + ", " + hint + ")");
  -        }
  -        ArrayList list = (ArrayList)this.value;
  -        int offset = ((Integer)hint).intValue();
  -
  -        if (this.mDimLength == null) {
  -            // Normal Case: Set the element in the list
  -            // grow the list if necessary to accomodate the new member
  -            while (list.size() <= offset) {
  -                list.add(null);
  -            }
  -
  -            list.set(offset, value);
  -        } else {
  -            // Multi-Dim Array case:  Need to find the nested ArrayList
  -            // and set the proper element.
  -
  -            // Convert the offset into a series of indices
  -            ArrayList mDimIndex = toMultiIndex(offset);
  -
  -            // Get/Create the nested ArrayList
  -            for(int i=0; i < mDimLength.size(); i++) {
  -                int length = ((Integer)mDimLength.get(i)).intValue();
  -                int index  = ((Integer)mDimIndex.get(i)).intValue();
  -                while (list.size() < length) {
  -                    list.add(null);
  -                }
  -                // If not the last dimension, get the nested ArrayList
  -                // Else set the value
  -                if (i < mDimLength.size()-1) {
  -                    if (list.get(index) == null) {
  -                        list.set(index, new ArrayList());
  -                    }
  -                    list = (ArrayList) list.get(index);                    
  -                } else {
  -                    list.set(index, value);
  -                }
  -            }
  -        }
  -        // If all indices are accounted for, the array is complete.
  -        waiting.remove(hint);
  -        if (isEnded && waiting.size()==0) {
  -            valueComplete();
  -        }
  -    }
  -
  -    /**
  -     * When valueComplete() is invoked on the array, 
  -     * first convert the array value into the expected array.
  -     * Then call super.valueComplete() to inform referents
  -     * that the array value is ready.
  -     **/
  -    public void valueComplete() throws SAXException
  -    { 
  -        if (componentsReady()) {
  -           try {
  -                if (arrayClass != null) {
  -                    value = JavaUtils.convert(value, arrayClass);
  -                } 
  -           } catch (Exception e) {}
  -        }     
  -         super.valueComplete();
  -    }
  -
  -    /**
  -     * Converts the given string to an index.
  -     * Assumes the string consists of a brackets surrounding comma 
  -     * separated digits.  For example "[2]" or [2,3]".
  -     * The routine returns a single index.
  -     * For example "[2]" returns 2.
  -     * For example "[2,3]" depends on the size of the multiple dimensions.
  -     *   if the dimensions are "[3,5]" then 13 is returned (2*5) + 3.
  -     * @param text representing index text
  -     * @param exceptKey exception message key
  -     * @return index 
  -     */
  -    private int convertToIndex(String text, String exceptKey)
  -        throws SAXException {
  -        StringTokenizer tokenizer = new StringTokenizer(text, "[],");
  -        int index = 0;
  -        try {
  -            if (mDimLength == null) {
  -                // Normal Case: Single dimension
  -                index = Integer.parseInt(tokenizer.nextToken());
  -                if (tokenizer.hasMoreTokens()) {
  -                    throw new SAXException(
  -                        JavaUtils.getMessage(exceptKey, text));
  -                }
  -            }
  -            else {
  -                // Multiple Dimensions: 
  -                int dim = -1;
  -                ArrayList work = new ArrayList();
  -                while(tokenizer.hasMoreTokens()) {
  -                    // Problem if the number of dimensions specified exceeds
  -                    // the number of dimensions of arrayType
  -                    dim++;
  -                    if (dim >= mDimLength.size()) {
  -                        throw new SAXException(
  -                            JavaUtils.getMessage(exceptKey, text));
  -                    }
  -                    // Get the next token and convert to integer
  -                    int workIndex = Integer.parseInt(tokenizer.nextToken());
  -
  -                    // Problem if the index is out of range.                     
  -                    if (workIndex < 0 || 
  -                        workIndex >= 
  -                            ((Integer)mDimLength.get(dim)).intValue()) {
  -                        throw new SAXException(
  -                            JavaUtils.getMessage(exceptKey, text));
  -                    }
  -                    work.add(new Integer(workIndex));
  -                }
  -                index = toSingleIndex(work); // Convert to single index
  -            }
  -        } catch (SAXException e) {
  -            throw e;
  -        } catch (Exception e) {
  -            throw new SAXException(JavaUtils.getMessage(exceptKey, text));
  -        }
  -        return index;
  -    } 
  -
  -    /**
  -     * Converts single index to list of multiple indices.
  -     * @param single index
  -     * @return list of multiple indices or null if not multiple indices.
  -     */
  -    private ArrayList toMultiIndex(int single) {
  -        if (mDimLength == null) 
  -            return null;
  -
  -        // Calculate the index factors if not already known
  -        if (mDimFactor == null) {
  -            mDimFactor = new ArrayList();
  -            for (int i=0; i < mDimLength.size(); i++) {
  -                int factor = 1;
  -                for (int j=i+1; j<mDimLength.size(); j++) {
  -                    factor *= ((Integer)mDimLength.get(j)).intValue();
  -                }
  -                mDimFactor.add(new Integer(factor));
  -            }
  -        }
  -
  -        ArrayList rc = new ArrayList();
  -        for (int i=0; i < mDimLength.size(); i++) {
  -            int factor = ((Integer)mDimFactor.get(i)).intValue();
  -            rc.add(new Integer(single / factor));
  -            single = single % factor;
  -        }
  -        return rc;
  -    }
  -
  -    /**
  -     * Converts multiple index to single index.
  -     * @param indexArray list of multiple indices
  -     * @return single index
  -     */
  -    private int toSingleIndex(ArrayList indexArray) {
  -        if (mDimLength == null || indexArray == null) 
  -            return -1;
  -
  -        // Calculate the index factors if not already known
  -        if (mDimFactor == null) {
  -            mDimFactor = new ArrayList();
  -            for (int i=0; i < mDimLength.size(); i++) {
  -                int factor = 1;
  -                for (int j=i+1; j<mDimLength.size(); j++) {
  -                    factor *= ((Integer)mDimLength.get(j)).intValue();
  -                }
  -                mDimFactor.add(new Integer(factor));
  -            }
  -        }
  -
  -        int single = 0;
  -        for (int i=0; i < indexArray.size(); i++) {
  -            single += ((Integer)mDimFactor.get(i)).intValue()*
  -                ((Integer)indexArray.get(i)).intValue();
  -        }
  -        return single;
  -    }
  -
  -    /**
  -     * During processing, the Array Deserializer stores the array in 
  -     * an ArrayListExtension class.  This class contains all of the
  -     * normal function of an ArrayList, plus it keeps a list of the
  -     * converted array values.  This class is essential to support
  -     * arrays that are multi-referenced.
  -     **/
  -    public class ArrayListExtension extends ArrayList 
  -        implements JavaUtils.ConvertCache {
  -        private HashMap table = null;
  -        private Class arrayClass = null;  // The array class.
  -        /**
  -         * Constructors
  -         */
  -        ArrayListExtension(Class arrayClass) {
  -            super();
  -            this.arrayClass = arrayClass;
  -            // Don't use the array class as a hint 
  -            // if it can't be instantiated
  -            if (arrayClass == null ||
  -                arrayClass.isInterface() ||
  -                java.lang.reflect.Modifier.isAbstract(
  -                    arrayClass.getModifiers())) {
  -                arrayClass = null;
  -            }                
  -        }
  -        ArrayListExtension(Class arrayClass, int length) {
  -            super(length);
  -            this.arrayClass = arrayClass;
  -            // Don't use the array class as a hint 
  -            // if it can't be instantiated
  -            if (arrayClass == null ||
  -                arrayClass.isInterface() ||
  -                java.lang.reflect.Modifier.isAbstract(
  -                    arrayClass.getModifiers())) {
  -                arrayClass = null;
  -            } 
  -        }
  -        /**
  -         * Store converted value
  -         **/
  -        public void setConvertedValue(Class cls, Object value) {
  -            if (table == null)
  -                table = new HashMap();
  -            table.put(cls, value);
  -        }
  -        /**
  -         * Get previously converted value
  -         **/
  -        public Object getConvertedValue(Class cls) {
  -            if (table == null)
  -                return null;
  -            return table.get(cls);
  -        }
  -
  -        /**
  -         * Get the destination array class described by the xml
  -         **/         
  -        public Class getDestClass() {
  -            return arrayClass;
  -        }
  -    }
  -   
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.encoding.DeserializerTarget;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.util.ArrayList;
  +import java.util.HashMap;
  +import java.util.HashSet;
  +import java.util.StringTokenizer;
  +
  +
  +/**
  + * An ArrayDeserializer handles deserializing SOAP
  + * arrays.
  + * 
  + * Some code borrowed from ApacheSOAP - thanks to Matt Duftler!
  + * 
  + * @author Glen Daniels (gdaniels@macromedia.com)
  + * 
  + * Multi-reference stuff:
  + * @author Rich Scheuerle (scheu@us.ibm.com)
  + */
  +public class ArrayDeserializer extends DeserializerImpl
  +{
  +    protected static Log log =
  +        LogFactory.getLog(ArrayDeserializer.class.getName());
  +
  +    public QName arrayType = null;
  +    public int curIndex = 0;
  +    QName defaultItemType;
  +    int length;
  +    Class arrayClass = null;
  +    ArrayList mDimLength = null;  // If set, array of multi-dim lengths 
  +    ArrayList mDimFactor = null;  // If set, array of factors for multi-dim []
  +    HashSet waiting = new HashSet();  // List of indices waiting for completion
  +
  +
  +    /**
  +     * This method is invoked after startElement when the element requires
  +     * deserialization (i.e. the element is not an href & the value is not nil)
  +     * DeserializerImpl provides default behavior, which simply
  +     * involves obtaining a correct Deserializer and plugging its handler.
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param qName is the prefixed qname of the element
  +     * @param attributes are the attrs on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     */
  +    public void onStartElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        // Deserializing the xml array requires processing the
  +        // xsi:type= attribute, the soapenc:arrayType attribute,
  +        // and the xsi:type attributes of the individual elements.
  +        //
  +        // The xsi:type=<qName> attribute is used to determine the java
  +        // type of the array to instantiate.  Axis expects it
  +        // to be set to the generic "soapenc:Array" or to
  +        // a specific qName.  If the generic "soapenc:Array"
  +        // specification is used, Axis determines the array
  +        // type by examining the soapenc:arrayType attribute.
  +        //
  +        // The soapenc:arrayType=<qname><dims> is used to determine
  +        // i) the number of dimensions, 
  +        // ii) the length of each dimension,
  +        // iii) the default xsi:type of each of the elements.
  +        //
  +        // If the arrayType attribute is missing, Axis assumes
  +        // a single dimension array with length equal to the number
  +        // of nested elements.  In such cases, the default xsi:type of 
  +        // the elements is determined using the array xsi:type.
  +        //
  +        // The xsi:type attributes of the individual elements of the
  +        // array are used to determine the java type of the element.
  +        // If the xsi:type attribute is missing for an element, the 
  +        // default xsi:type value is used.
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: ArrayDeserializer::startElement()");
  +        }
  +
  +        // Get the qname for the array type=, set it to null if
  +        // the generic type is used.
  +        QName typeQName = context.getTypeFromAttributes(namespace,
  +                                                        localName,
  +                                                        attributes);
  +        if (typeQName != null && 
  +            Constants.equals(Constants.SOAP_ARRAY, typeQName)) {
  +            typeQName = null;
  +        }
  +
  +        // Now get the arrayType value 
  +        QName arrayTypeValue = context.getQNameFromString(
  +                      Constants.getValue(attributes,
  +                                         Constants.NS_URIS_SOAP_ENC,
  +                                         Constants.ATTR_ARRAY_TYPE));
  +
  +        // The first part of the arrayType expression is 
  +        // the default item type qname.
  +        // The second part is the dimension information
  +        String dimString = null;
  +        QName innerQName = null;
  +        String innerDimString = "";
  +        if (arrayTypeValue != null) {
  +            String arrayTypeValueNamespaceURI = 
  +                arrayTypeValue.getNamespaceURI();
  +            String arrayTypeValueLocalPart = 
  +                arrayTypeValue.getLocalPart();
  +            int leftBracketIndex = 
  +                arrayTypeValueLocalPart.lastIndexOf('[');
  +            int rightBracketIndex = 
  +                arrayTypeValueLocalPart.lastIndexOf(']');
  +            if (leftBracketIndex == -1
  +                || rightBracketIndex == -1
  +                || rightBracketIndex < leftBracketIndex)
  +                {
  +                    throw new IllegalArgumentException(
  +                      JavaUtils.getMessage("badArrayType00", 
  +                                           "" + arrayTypeValue));
  +                }
  +            
  +            dimString = 
  +                arrayTypeValueLocalPart.substring(leftBracketIndex + 1,
  +                                                  rightBracketIndex);
  +            arrayTypeValueLocalPart = 
  +                arrayTypeValueLocalPart.substring(0, leftBracketIndex);
  +            
  +            // If multi-dim array set to soapenc:Array
  +            if (arrayTypeValueLocalPart.endsWith("]")) {
  +                defaultItemType = Constants.SOAP_ARRAY;
  +                innerQName = new QName(
  +                    arrayTypeValueNamespaceURI,
  +                    arrayTypeValueLocalPart.substring(0,
  +                        arrayTypeValueLocalPart.indexOf("["))); 
  +                innerDimString = arrayTypeValueLocalPart.substring(
  +                    arrayTypeValueLocalPart.indexOf("["));
  +            } else {
  +                defaultItemType = new QName(arrayTypeValueNamespaceURI,
  +                                            arrayTypeValueLocalPart);
  +            }
  +        }
  +
  +        // If no type QName and no defaultItemType qname, use xsd:anyType
  +        if (defaultItemType == null && typeQName == null) {
  +            defaultItemType = Constants.XSD_ANYTYPE;
  +        }
  +        
  +        // Determine the class type for the array.
  +        arrayClass = null;
  +        if (typeQName != null) {
  +            arrayClass = context.getTypeMapping().
  +                getClassForQName(typeQName);
  +        } else {
  +            // type= information is not sufficient.
  +            // Get an array of the default item type.
  +            Class arrayItemClass = null;
  +            QName compQName = defaultItemType;
  +            String dims = "[]";
  +            // Nested array, use the innermost qname
  +            if (innerQName != null) {
  +                compQName = innerQName;
  +                dims += innerDimString;                
  +            }
  +            arrayItemClass = context.getTypeMapping().
  +                getClassForQName(compQName);
  +            if (arrayItemClass != null) {
  +                try {
  +                    ClassLoader cl = 
  +                        context.getMessageContext().getClassLoader();
  +                    arrayClass = Class.forName(
  +                      JavaUtils.getLoadableClassName(
  +                        JavaUtils.getTextClassName(arrayItemClass.getName()) +
  +                        dims),
  +                      true, cl);   
  +                } catch (Exception e) {
  +                    throw new SAXException(
  +                       JavaUtils.getMessage("noComponent00",  
  +                                            "" + defaultItemType));
  +                }
  +            }
  +        }
  +
  +        if (arrayClass == null) {
  +            throw new SAXException(
  +               JavaUtils.getMessage("noComponent00",  "" + defaultItemType));
  +        }
  +
  +        if (dimString == null || dimString.length() == 0) {
  +            // Size determined using length of the members
  +            value = new ArrayListExtension(arrayClass);
  +        }
  +        else {
  +            try
  +            {
  +                StringTokenizer tokenizer = new StringTokenizer(dimString,
  +                                                                "[],");
  +
  +                length = Integer.parseInt(tokenizer.nextToken());
  +
  +                if (tokenizer.hasMoreTokens())
  +                    {
  +                        // If the array is passed as a multi-dimensional array
  +                        // (i.e. int[2][3]) then store all of the 
  +                        // mult-dim lengths.
  +                        // The valueReady method uses this array to set the
  +                        // proper mult-dim element.
  +                        mDimLength = new ArrayList();
  +                        mDimLength.add(new Integer(length));
  +                        
  +                        while(tokenizer.hasMoreTokens()) {
  +                            mDimLength.add(
  +                                new Integer(
  +                                    Integer.parseInt(tokenizer.nextToken())));
  +                        }
  +                    }
  +
  +                // Create an ArrayListExtension class to store the ArrayList
  +                // plus converted objects.
  +                ArrayList list = new ArrayListExtension(arrayClass, length);
  +                // ArrayList lacks a setSize(), so...
  +                for (int i = 0; i < length; i++) {
  +                    list.add(null);
  +                }
  +                value = list;
  +
  +            }
  +            catch (NumberFormatException e)
  +            {
  +                throw new IllegalArgumentException(
  +                        JavaUtils.getMessage("badInteger00", dimString));
  +            }
  +        }
  +
  +        // If soapenc:offset specified, set the current index accordingly
  +        String offset = Constants.getValue(attributes,
  +                                         Constants.NS_URIS_SOAP_ENC,
  +                                         Constants.ATTR_OFFSET);
  +        if (offset != null) {
  +            int leftBracketIndex = offset.lastIndexOf('[');
  +            int rightBracketIndex = offset.lastIndexOf(']');
  +
  +            if (leftBracketIndex == -1
  +                || rightBracketIndex == -1
  +                || rightBracketIndex < leftBracketIndex)
  +            {
  +                throw new SAXException(
  +                        JavaUtils.getMessage("badOffset00", offset));
  +            }
  +
  +            curIndex = 
  +                convertToIndex(offset.substring(leftBracketIndex + 1,
  +                                                rightBracketIndex),
  +                               "badOffset00");
  +        }
  +        
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: ArrayDeserializer::startElement()");
  +        }
  +    }
  +    
  +
  +    /**
  +     * onStartChild is called on each child element.
  +     * @param namespace is the namespace of the child element
  +     * @param localName is the local name of the child element
  +     * @param prefix is the prefix used on the name of the child element
  +     * @param attributes are the attributes of the child element
  +     * @param context is the deserialization context.
  +     * @return is a Deserializer to use to deserialize a child (must be
  +     * a derived class of SOAPHandler) or null if no deserialization should
  +     * be performed.
  +     */
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException
  +    {
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: ArrayDeserializer.onStartChild()");
  +        }
  +
  +        // If the position attribute is set, 
  +        // use it to update the current index
  +        if (attributes != null) {
  +            String pos =
  +                Constants.getValue(attributes,
  +                                   Constants.NS_URIS_SOAP_ENC,
  +                                   Constants.ATTR_POSITION);
  +            if (pos != null) {
  +                int leftBracketIndex = pos.lastIndexOf('[');
  +                int rightBracketIndex = pos.lastIndexOf(']');
  +
  +                if (leftBracketIndex == -1
  +                    || rightBracketIndex == -1
  +                    || rightBracketIndex < leftBracketIndex)
  +                {
  +                    throw new SAXException(
  +                            JavaUtils.getMessage("badPosition00", pos));
  +                }
  +                
  +                curIndex = 
  +                    convertToIndex(pos.substring(leftBracketIndex + 1,
  +                                                 rightBracketIndex),
  +                                   "badPosition00");
  +            }
  +
  +            // If the xsi:nil attribute, set the value to null 
  +            // and return since there is nothing to deserialize.
  +            if (context.isNil(attributes)) {
  +                setValue(null, new Integer(curIndex++));
  +                return null;
  +            }
  +        }
  +
  +        // Use the xsi:type setting on the attribute if it exists.
  +        QName itemType = context.getTypeFromAttributes(namespace,
  +                                                       localName,
  +                                                       attributes);
  +
  +        // Get the deserializer for the type.  If no deserializer is 
  +        // found, the deserializer is set to DeserializerImpl().
  +        // It is possible that the element has an href, thus we
  +        // won't know the type until the definitition is encountered.
  +        Deserializer dSer = null;
  +        if (itemType != null) {
  +            dSer = context.getDeserializerForType(itemType);
  +        }
  +        if (dSer == null) {
  +            dSer = new DeserializerImpl();
  +            // Determine a default type for the deserializer
  +            if (itemType == null) {
  +                QName defaultType = defaultItemType;
  +                // If defaultType is not known, try using the arrayClass info
  +                if (defaultType == null &&
  +                    arrayClass != null &&
  +                    arrayClass.isArray()) {
  +                    defaultType = context.getTypeMapping().
  +                        getTypeQName(arrayClass.getComponentType());
  +                }
  +                dSer.setDefaultType(defaultType);
  +            }
  +        }
  +
  +
  +        // Register the callback value target, and
  +        // keep track of this index so we know when it has been set.
  +        dSer.registerValueTarget(
  +            new DeserializerTarget(this, new Integer(curIndex)));
  +        waiting.add(new Integer(curIndex));
  +
  +        curIndex++;
  +        
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: ArrayDeserializer.onStartChild()");
  +        }
  +        
  +        return (SOAPHandler)dSer;
  +    }
  +
  +    /** 
  +     * Need to wait for all indices to be set.
  +     */
  +    public boolean componentsReady() {
  +        return (waiting.size() == 0);
  +    }
  +
  +    /**
  +     * set is called during deserialization to assign
  +     * the Object value to the array position indicated by hint.
  +     * The hint is always a single Integer.  If the array being
  +     * deserialized is a multi-dimensional array, the hint is 
  +     * converted into a series of indices to set the correct
  +     * nested position.
  +     * The array deserializer always deserializes into
  +     * an ArrayList, which is converted and copied into the
  +     * actual array after completion (by valueComplete).
  +     * It is important to wait until all indices have been 
  +     * processed before invoking valueComplete.
  +     * @param value value of the array element
  +     * @param hint index of the array element (Integer)
  +     **/
  +    public void setValue(Object value, Object hint) throws SAXException
  +    { 
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: ArrayDeserializer::setValue(" + value + ", " + hint + ")");
  +        }
  +        ArrayList list = (ArrayList)this.value;
  +        int offset = ((Integer)hint).intValue();
  +
  +        if (this.mDimLength == null) {
  +            // Normal Case: Set the element in the list
  +            // grow the list if necessary to accomodate the new member
  +            while (list.size() <= offset) {
  +                list.add(null);
  +            }
  +
  +            list.set(offset, value);
  +        } else {
  +            // Multi-Dim Array case:  Need to find the nested ArrayList
  +            // and set the proper element.
  +
  +            // Convert the offset into a series of indices
  +            ArrayList mDimIndex = toMultiIndex(offset);
  +
  +            // Get/Create the nested ArrayList
  +            for(int i=0; i < mDimLength.size(); i++) {
  +                int length = ((Integer)mDimLength.get(i)).intValue();
  +                int index  = ((Integer)mDimIndex.get(i)).intValue();
  +                while (list.size() < length) {
  +                    list.add(null);
  +                }
  +                // If not the last dimension, get the nested ArrayList
  +                // Else set the value
  +                if (i < mDimLength.size()-1) {
  +                    if (list.get(index) == null) {
  +                        list.set(index, new ArrayList());
  +                    }
  +                    list = (ArrayList) list.get(index);                    
  +                } else {
  +                    list.set(index, value);
  +                }
  +            }
  +        }
  +        // If all indices are accounted for, the array is complete.
  +        waiting.remove(hint);
  +        if (isEnded && waiting.size()==0) {
  +            valueComplete();
  +        }
  +    }
  +
  +    /**
  +     * When valueComplete() is invoked on the array, 
  +     * first convert the array value into the expected array.
  +     * Then call super.valueComplete() to inform referents
  +     * that the array value is ready.
  +     **/
  +    public void valueComplete() throws SAXException
  +    { 
  +        if (componentsReady()) {
  +           try {
  +                if (arrayClass != null) {
  +                    value = JavaUtils.convert(value, arrayClass);
  +                } 
  +           } catch (Exception e) {}
  +        }     
  +         super.valueComplete();
  +    }
  +
  +    /**
  +     * Converts the given string to an index.
  +     * Assumes the string consists of a brackets surrounding comma 
  +     * separated digits.  For example "[2]" or [2,3]".
  +     * The routine returns a single index.
  +     * For example "[2]" returns 2.
  +     * For example "[2,3]" depends on the size of the multiple dimensions.
  +     *   if the dimensions are "[3,5]" then 13 is returned (2*5) + 3.
  +     * @param text representing index text
  +     * @param exceptKey exception message key
  +     * @return index 
  +     */
  +    private int convertToIndex(String text, String exceptKey)
  +        throws SAXException {
  +        StringTokenizer tokenizer = new StringTokenizer(text, "[],");
  +        int index = 0;
  +        try {
  +            if (mDimLength == null) {
  +                // Normal Case: Single dimension
  +                index = Integer.parseInt(tokenizer.nextToken());
  +                if (tokenizer.hasMoreTokens()) {
  +                    throw new SAXException(
  +                        JavaUtils.getMessage(exceptKey, text));
  +                }
  +            }
  +            else {
  +                // Multiple Dimensions: 
  +                int dim = -1;
  +                ArrayList work = new ArrayList();
  +                while(tokenizer.hasMoreTokens()) {
  +                    // Problem if the number of dimensions specified exceeds
  +                    // the number of dimensions of arrayType
  +                    dim++;
  +                    if (dim >= mDimLength.size()) {
  +                        throw new SAXException(
  +                            JavaUtils.getMessage(exceptKey, text));
  +                    }
  +                    // Get the next token and convert to integer
  +                    int workIndex = Integer.parseInt(tokenizer.nextToken());
  +
  +                    // Problem if the index is out of range.                     
  +                    if (workIndex < 0 || 
  +                        workIndex >= 
  +                            ((Integer)mDimLength.get(dim)).intValue()) {
  +                        throw new SAXException(
  +                            JavaUtils.getMessage(exceptKey, text));
  +                    }
  +                    work.add(new Integer(workIndex));
  +                }
  +                index = toSingleIndex(work); // Convert to single index
  +            }
  +        } catch (SAXException e) {
  +            throw e;
  +        } catch (Exception e) {
  +            throw new SAXException(JavaUtils.getMessage(exceptKey, text));
  +        }
  +        return index;
  +    } 
  +
  +    /**
  +     * Converts single index to list of multiple indices.
  +     * @param single index
  +     * @return list of multiple indices or null if not multiple indices.
  +     */
  +    private ArrayList toMultiIndex(int single) {
  +        if (mDimLength == null) 
  +            return null;
  +
  +        // Calculate the index factors if not already known
  +        if (mDimFactor == null) {
  +            mDimFactor = new ArrayList();
  +            for (int i=0; i < mDimLength.size(); i++) {
  +                int factor = 1;
  +                for (int j=i+1; j<mDimLength.size(); j++) {
  +                    factor *= ((Integer)mDimLength.get(j)).intValue();
  +                }
  +                mDimFactor.add(new Integer(factor));
  +            }
  +        }
  +
  +        ArrayList rc = new ArrayList();
  +        for (int i=0; i < mDimLength.size(); i++) {
  +            int factor = ((Integer)mDimFactor.get(i)).intValue();
  +            rc.add(new Integer(single / factor));
  +            single = single % factor;
  +        }
  +        return rc;
  +    }
  +
  +    /**
  +     * Converts multiple index to single index.
  +     * @param indexArray list of multiple indices
  +     * @return single index
  +     */
  +    private int toSingleIndex(ArrayList indexArray) {
  +        if (mDimLength == null || indexArray == null) 
  +            return -1;
  +
  +        // Calculate the index factors if not already known
  +        if (mDimFactor == null) {
  +            mDimFactor = new ArrayList();
  +            for (int i=0; i < mDimLength.size(); i++) {
  +                int factor = 1;
  +                for (int j=i+1; j<mDimLength.size(); j++) {
  +                    factor *= ((Integer)mDimLength.get(j)).intValue();
  +                }
  +                mDimFactor.add(new Integer(factor));
  +            }
  +        }
  +
  +        int single = 0;
  +        for (int i=0; i < indexArray.size(); i++) {
  +            single += ((Integer)mDimFactor.get(i)).intValue()*
  +                ((Integer)indexArray.get(i)).intValue();
  +        }
  +        return single;
  +    }
  +
  +    /**
  +     * During processing, the Array Deserializer stores the array in 
  +     * an ArrayListExtension class.  This class contains all of the
  +     * normal function of an ArrayList, plus it keeps a list of the
  +     * converted array values.  This class is essential to support
  +     * arrays that are multi-referenced.
  +     **/
  +    public class ArrayListExtension extends ArrayList 
  +        implements JavaUtils.ConvertCache {
  +        private HashMap table = null;
  +        private Class arrayClass = null;  // The array class.
  +        /**
  +         * Constructors
  +         */
  +        ArrayListExtension(Class arrayClass) {
  +            super();
  +            this.arrayClass = arrayClass;
  +            // Don't use the array class as a hint 
  +            // if it can't be instantiated
  +            if (arrayClass == null ||
  +                arrayClass.isInterface() ||
  +                java.lang.reflect.Modifier.isAbstract(
  +                    arrayClass.getModifiers())) {
  +                arrayClass = null;
  +            }                
  +        }
  +        ArrayListExtension(Class arrayClass, int length) {
  +            super(length);
  +            this.arrayClass = arrayClass;
  +            // Don't use the array class as a hint 
  +            // if it can't be instantiated
  +            if (arrayClass == null ||
  +                arrayClass.isInterface() ||
  +                java.lang.reflect.Modifier.isAbstract(
  +                    arrayClass.getModifiers())) {
  +                arrayClass = null;
  +            } 
  +        }
  +        /**
  +         * Store converted value
  +         **/
  +        public void setConvertedValue(Class cls, Object value) {
  +            if (table == null)
  +                table = new HashMap();
  +            table.put(cls, value);
  +        }
  +        /**
  +         * Get previously converted value
  +         **/
  +        public Object getConvertedValue(Class cls) {
  +            if (table == null)
  +                return null;
  +            return table.get(cls);
  +        }
  +
  +        /**
  +         * Get the destination array class described by the xml
  +         **/         
  +        public Class getDestClass() {
  +            return arrayClass;
  +        }
  +    }
  +   
  +}
  
  
  
  1.4       +80 -80    xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializerFactory.java
  
  Index: ArraySerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArraySerializerFactory.java	30 May 2002 03:06:08 -0000	1.3
  +++ ArraySerializerFactory.java	30 May 2002 23:46:01 -0000	1.4
  @@ -1,80 +1,80 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -/**
  - * SerializerFactory for arrays
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public class ArraySerializerFactory extends BaseSerializerFactory {
  -    public ArraySerializerFactory() {
  -        super(ArraySerializer.class, false); 
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +/**
  + * SerializerFactory for arrays
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public class ArraySerializerFactory extends BaseSerializerFactory {
  +    public ArraySerializerFactory() {
  +        super(ArraySerializer.class, false); 
  +    }
  +}
  
  
  
  1.7       +129 -129  xml-axis/java/src/org/apache/axis/encoding/ser/Base64Deserializer.java
  
  Index: Base64Deserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/Base64Deserializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Base64Deserializer.java	30 May 2002 03:06:08 -0000	1.6
  +++ Base64Deserializer.java	30 May 2002 23:46:01 -0000	1.7
  @@ -1,129 +1,129 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.encoding.Base64;
  -
  -/**
  - * Deserializer for Base64
  - *
  - * @author Sam Ruby <rubys@us.ibm.com>
  - * Modified by @author Rich scheuerle <scheu@us.ibm.com>
  - * @see <a href="http://www.w3.org/TR/xmlschema-2/#base64Binary">XML Schema 3.2.16</a>
  - */
  -public class Base64Deserializer extends DeserializerImpl  {
  -
  -    public QName xmlType;
  -    public Class javaType;
  -
  -    StringBuffer buf = null;
  -
  -    public Base64Deserializer(Class javaType, QName xmlType) {
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -    }
  -
  -    /**
  -     * Handle any characters found in the data
  -     */
  -    public void characters(char [] chars, int start, int end)
  -        throws SAXException
  -    {
  -        // Characters are collected in a buffer because 
  -        // SAX may chunk the data.
  -        if (buf == null) {
  -            buf = new StringBuffer();
  -        }
  -        buf.append(chars, start, end); 
  -    }
  -    
  -    /**
  -     * Return something even if no characters were found.
  -     */
  -    public void onEndElement(String namespace, String localName,
  -                             DeserializationContext context)
  -        throws SAXException
  -    {
  -        // Decode the collected characters
  -        if (buf != null) {
  -            value = Base64.decode(buf.toString());
  -            if (javaType == Byte[].class) {
  -                Byte[] data = new Byte[ ((byte[])value).length ];
  -                for (int i=0; i<data.length; i++) {
  -                    byte b = ((byte[]) value)[i];
  -                    data[i] = new Byte(b);
  -                }
  -                value = data;
  -            }
  -        }
  -
  -        super.onEndElement(namespace,localName, context);
  -        // If no value was specified, return a zero length byte or Byte array
  -        if (value == null) {
  -            if (javaType == byte[].class) {
  -                value = new byte[0];
  -            } else {
  -                value = new Byte[0];
  -            }
  -        }
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.encoding.Base64;
  +
  +/**
  + * Deserializer for Base64
  + *
  + * @author Sam Ruby <rubys@us.ibm.com>
  + * Modified by @author Rich scheuerle <scheu@us.ibm.com>
  + * @see <a href="http://www.w3.org/TR/xmlschema-2/#base64Binary">XML Schema 3.2.16</a>
  + */
  +public class Base64Deserializer extends DeserializerImpl  {
  +
  +    public QName xmlType;
  +    public Class javaType;
  +
  +    StringBuffer buf = null;
  +
  +    public Base64Deserializer(Class javaType, QName xmlType) {
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +    }
  +
  +    /**
  +     * Handle any characters found in the data
  +     */
  +    public void characters(char [] chars, int start, int end)
  +        throws SAXException
  +    {
  +        // Characters are collected in a buffer because 
  +        // SAX may chunk the data.
  +        if (buf == null) {
  +            buf = new StringBuffer();
  +        }
  +        buf.append(chars, start, end); 
  +    }
  +    
  +    /**
  +     * Return something even if no characters were found.
  +     */
  +    public void onEndElement(String namespace, String localName,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        // Decode the collected characters
  +        if (buf != null) {
  +            value = Base64.decode(buf.toString());
  +            if (javaType == Byte[].class) {
  +                Byte[] data = new Byte[ ((byte[])value).length ];
  +                for (int i=0; i<data.length; i++) {
  +                    byte b = ((byte[]) value)[i];
  +                    data[i] = new Byte(b);
  +                }
  +                value = data;
  +            }
  +        }
  +
  +        super.onEndElement(namespace,localName, context);
  +        // If no value was specified, return a zero length byte or Byte array
  +        if (value == null) {
  +            if (javaType == byte[].class) {
  +                value = new byte[0];
  +            } else {
  +                value = new Byte[0];
  +            }
  +        }
  +    }
  +}
  
  
  
  1.6       +131 -131  xml-axis/java/src/org/apache/axis/encoding/ser/Base64Serializer.java
  
  Index: Base64Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/Base64Serializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Base64Serializer.java	30 May 2002 03:06:08 -0000	1.5
  +++ Base64Serializer.java	30 May 2002 23:46:01 -0000	1.6
  @@ -1,131 +1,131 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.wsdl.fromJava.Types;
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.Base64;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Document;
  -
  -/**
  - * Serializer for Base64
  - *
  - * @author Sam Ruby <rubys@us.ibm.com>
  - * Modified by @author Rich Scheuerle <scheu@us.ibm.com>
  - * @see <a href="http://www.w3.org/TR/xmlschema-2/#base64Binary">XML Schema 3.2.16</a>
  - */
  -public class Base64Serializer implements Serializer {
  -
  -    public QName xmlType;
  -    public Class javaType;
  -    public Base64Serializer(Class javaType, QName xmlType) {
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -    }
  -
  -    /**
  -     * Serialize a base64 quantity.
  -     */
  -    public void serialize(QName name, Attributes attributes,
  -                          Object value, SerializationContext context)
  -        throws IOException
  -    {
  -        byte[] data = null;
  -        if (javaType == byte[].class) {
  -            data = (byte[]) value;
  -        } else {
  -            data = new byte[ ((Byte[]) value).length ];
  -            for (int i=0; i<data.length; i++) {
  -                Byte b = ((Byte[]) value)[i];
  -                if (b != null)
  -                    data[i] = b.byteValue();
  -            }
  -        }
  -
  -        context.startElement(name, attributes);
  -        context.writeString(Base64.encode(data, 0, data.length));
  -        context.endElement();
  -    }
  -
  -    public String getMechanismType() { return Constants.AXIS_SAX; }
  -
  -    /**
  -     * Return XML schema for the specified type, suitable for insertion into
  -     * the <types> element of a WSDL document.
  -     *
  -     * @param types the Java2WSDL Types object which holds the context
  -     *              for the WSDL being generated.
  -     * @return true if we wrote a schema, false if we didn't.
  -     * @see org.apache.axis.wsdl.fromJava.Types
  -     */
  -    public boolean writeSchema(Types types) throws Exception {
  -        return false;
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.Base64;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
  +
  +/**
  + * Serializer for Base64
  + *
  + * @author Sam Ruby <rubys@us.ibm.com>
  + * Modified by @author Rich Scheuerle <scheu@us.ibm.com>
  + * @see <a href="http://www.w3.org/TR/xmlschema-2/#base64Binary">XML Schema 3.2.16</a>
  + */
  +public class Base64Serializer implements Serializer {
  +
  +    public QName xmlType;
  +    public Class javaType;
  +    public Base64Serializer(Class javaType, QName xmlType) {
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +    }
  +
  +    /**
  +     * Serialize a base64 quantity.
  +     */
  +    public void serialize(QName name, Attributes attributes,
  +                          Object value, SerializationContext context)
  +        throws IOException
  +    {
  +        byte[] data = null;
  +        if (javaType == byte[].class) {
  +            data = (byte[]) value;
  +        } else {
  +            data = new byte[ ((Byte[]) value).length ];
  +            for (int i=0; i<data.length; i++) {
  +                Byte b = ((Byte[]) value)[i];
  +                if (b != null)
  +                    data[i] = b.byteValue();
  +            }
  +        }
  +
  +        context.startElement(name, attributes);
  +        context.writeString(Base64.encode(data, 0, data.length));
  +        context.endElement();
  +    }
  +
  +    public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
  +}
  
  
  
  1.5       +80 -80    xml-axis/java/src/org/apache/axis/encoding/ser/Base64SerializerFactory.java
  
  Index: Base64SerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/Base64SerializerFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Base64SerializerFactory.java	30 May 2002 03:06:08 -0000	1.4
  +++ Base64SerializerFactory.java	30 May 2002 23:46:01 -0000	1.5
  @@ -1,80 +1,80 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -/**
  - * SerializerFactory for hexBinary.
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public class Base64SerializerFactory extends BaseSerializerFactory {
  -    public   Base64SerializerFactory(Class javaType, QName xmlType) {
  -        super(Base64Serializer.class, true, xmlType, javaType);  // Share Base64Serializer instance
  -    } 
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +/**
  + * SerializerFactory for hexBinary.
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public class Base64SerializerFactory extends BaseSerializerFactory {
  +    public   Base64SerializerFactory(Class javaType, QName xmlType) {
  +        super(Base64Serializer.class, true, xmlType, javaType);  // Share Base64Serializer instance
  +    } 
  +}
  
  
  
  1.8       +287 -287  xml-axis/java/src/org/apache/axis/encoding/ser/BaseSerializerFactory.java
  
  Index: BaseSerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BaseSerializerFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BaseSerializerFactory.java	30 May 2002 03:06:08 -0000	1.7
  +++ BaseSerializerFactory.java	30 May 2002 23:46:01 -0000	1.8
  @@ -1,287 +1,287 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import javax.xml.rpc.JAXRPCException;
  -
  -import java.io.IOException;
  -import java.util.Vector;
  -import java.util.Iterator;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -
  -import java.lang.reflect.Constructor;
  -import java.lang.reflect.Method;
  -import java.lang.reflect.InvocationTargetException;
  -
  -/**
  - * Base class for Axis Serialization Factory classes for code reuse
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public abstract class BaseSerializerFactory 
  -    implements SerializerFactory {
  -
  -    static Vector mechanisms = null;
  -    
  -    protected Class serClass = null;
  -    protected boolean share = false;
  -    protected Serializer ser = null;
  -    protected QName xmlType = null;
  -    protected Class javaType = null;
  -    protected Constructor serClassConstructor = null;
  -    protected Method getSerializer = null;
  -    protected boolean firstCall = true;
  -
  -    /**
  -     * Constructor
  -     * @param serClass is the class of the Serializer
  -     * @param share indicates if serializers can be shared. getSerializerAs 
  -     * will always return the same serializer object if share is true.  
  -     * Sharing is only valid for xml primitives.
  -     */
  -    public BaseSerializerFactory(Class serClass, boolean share) {
  -        this.serClass = serClass;
  -        this.share = share;
  -    }
  -    public BaseSerializerFactory(Class serClass, boolean share, 
  -                                 QName xmlType, Class javaType) {
  -        this.serClass = serClass;
  -        this.share = share;
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -    }
  -
  -    public javax.xml.rpc.encoding.Serializer 
  -        getSerializerAs(String mechanismType)
  -        throws JAXRPCException {
  -        // Need to add code to check against mechanisms vector.
  -        if (share && ser != null) {
  -            return ser;
  -        }
  -        ser = null;
  -
  -        try {
  -            // Try getting a specialized Serializer
  -            ser = getSpecialized(mechanismType);
  -            
  -            // Try getting a general purpose Serializer via constructor
  -            // invocation
  -            if (ser == null) {
  -                ser = getGeneralPurpose(mechanismType);
  -            }
  -            
  -            // If not successfull, try newInstance
  -            if (ser == null) {
  -                ser = (Serializer) serClass.newInstance();
  -            }
  -        } catch (Exception e) {
  -            throw new JAXRPCException(
  -                JavaUtils.getMessage("CantGetSerializer", 
  -                                     serClass.getName()),
  -                e);
  -        }
  -        firstCall = false;
  -        return ser;
  -    }
  -    
  -    /**
  -     * Obtains a serializer by invoking <constructor>(javaType, xmlType) 
  -     * on the serClass.
  -     */
  -    protected Serializer getGeneralPurpose(String mechanismType) {
  -        if (javaType != null && xmlType != null) {
  -            if (serClassConstructor == null && firstCall) {
  -                try {
  -                    serClassConstructor = 
  -                        serClass.getConstructor(
  -                            new Class[] {Class.class, QName.class});
  -                } catch (NoSuchMethodException e) {}
  -            }
  -            if (serClassConstructor != null) {
  -                try {
  -                    return (Serializer) 
  -                        serClassConstructor.newInstance(
  -                            new Object[] {javaType, xmlType});
  -                } catch (InstantiationException e) {
  -                } catch (IllegalAccessException e) {
  -                } catch (InvocationTargetException e) {}
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Obtains a serializer by invoking getSerializer method in the 
  -     * javaType class or its Helper class.
  -     */
  -    protected Serializer getSpecialized(String mechanismType) {
  -        if (javaType != null && xmlType != null) {
  -            if (getSerializer == null && firstCall) {
  -                try {
  -                    getSerializer = 
  -                        javaType.getMethod("getSerializer",
  -                                           new Class[] {String.class, 
  -                                                        Class.class, 
  -                                                        QName.class});
  -                } catch (NoSuchMethodException e) {}
  -                if (getSerializer == null) {
  -                    try {
  -                        ClassLoader cl = 
  -                            Thread.currentThread().getContextClassLoader();
  -                        Class helper = Class.forName(
  -                            javaType.getName() + "_Helper", true, cl);
  -                        getSerializer =
  -                            helper.getMethod("getSerializer", 
  -                                             new Class[] {String.class, 
  -                                                          Class.class, 
  -                                                          QName.class});
  -                    } catch (NoSuchMethodException e) {
  -                    } catch (ClassNotFoundException e) {}
  -                }
  -            }
  -            if (getSerializer != null) {
  -                try {
  -                    return (Serializer) 
  -                        getSerializer.invoke(
  -                                             null,
  -                                             new Object[] {mechanismType, 
  -                                                           javaType, 
  -                                                           xmlType});
  -                } catch (IllegalAccessException e) {
  -                } catch (InvocationTargetException e) {}
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Returns a list of all XML processing mechanism types supported
  -     * by this SerializerFactory.
  -     *
  -     * @return List of unique identifiers for the supported XML 
  -     * processing mechanism types
  -     */
  -    public Iterator getSupportedMechanismTypes() {
  -        if (mechanisms == null) {
  -            mechanisms = new Vector();
  -            mechanisms.add(Constants.AXIS_SAX);
  -        }
  -        return mechanisms.iterator();
  -    }
  -    
  -    /**
  -     * Utility method that intospects on a factory class to decide how to 
  -     * create the factory.  Tries in the following order:
  -     * public static create(Class javaType, QName xmlType)
  -     * public <constructor>(Class javaType, QName xmlType)
  -     * public <constructor>()
  -     * @param factory class
  -     * @param QName xmlType
  -     * @param Class javaType
  -     */
  -    public static SerializerFactory createFactory(Class factory, 
  -                                                  Class javaType, 
  -                                                  QName xmlType) {
  -
  -        SerializerFactory sf = null;
  -        try {
  -            Method method = 
  -                factory.getMethod(
  -                    "create",
  -                    new Class[] {Class.class, QName.class});
  -            sf = (SerializerFactory) 
  -                method.invoke(null, 
  -                              new Object[] {javaType, xmlType});
  -        } catch (NoSuchMethodException e) {
  -        } catch (IllegalAccessException e) {
  -        } catch (InvocationTargetException e) {}
  -
  -        if (sf == null) {
  -            try {
  -                Constructor constructor =  
  -                    factory.getConstructor(
  -                        new Class[] {Class.class, QName.class});
  -                sf = (SerializerFactory) 
  -                    constructor.newInstance(
  -                        new Object[] {javaType, xmlType});
  -            } catch (NoSuchMethodException e) {
  -            } catch (InstantiationException e) {
  -            } catch (IllegalAccessException e) {
  -            } catch (InvocationTargetException e) {}
  -        }
  -        
  -        if (sf == null) {
  -            try {
  -                sf = (SerializerFactory) factory.newInstance();
  -            } catch (InstantiationException e) {
  -            } catch (IllegalAccessException e) {}
  -        }
  -        return sf;
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import javax.xml.rpc.JAXRPCException;
  +
  +import java.io.IOException;
  +import java.util.Vector;
  +import java.util.Iterator;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +
  +import java.lang.reflect.Constructor;
  +import java.lang.reflect.Method;
  +import java.lang.reflect.InvocationTargetException;
  +
  +/**
  + * Base class for Axis Serialization Factory classes for code reuse
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public abstract class BaseSerializerFactory 
  +    implements SerializerFactory {
  +
  +    static Vector mechanisms = null;
  +    
  +    protected Class serClass = null;
  +    protected boolean share = false;
  +    protected Serializer ser = null;
  +    protected QName xmlType = null;
  +    protected Class javaType = null;
  +    protected Constructor serClassConstructor = null;
  +    protected Method getSerializer = null;
  +    protected boolean firstCall = true;
  +
  +    /**
  +     * Constructor
  +     * @param serClass is the class of the Serializer
  +     * @param share indicates if serializers can be shared. getSerializerAs 
  +     * will always return the same serializer object if share is true.  
  +     * Sharing is only valid for xml primitives.
  +     */
  +    public BaseSerializerFactory(Class serClass, boolean share) {
  +        this.serClass = serClass;
  +        this.share = share;
  +    }
  +    public BaseSerializerFactory(Class serClass, boolean share, 
  +                                 QName xmlType, Class javaType) {
  +        this.serClass = serClass;
  +        this.share = share;
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +    }
  +
  +    public javax.xml.rpc.encoding.Serializer 
  +        getSerializerAs(String mechanismType)
  +        throws JAXRPCException {
  +        // Need to add code to check against mechanisms vector.
  +        if (share && ser != null) {
  +            return ser;
  +        }
  +        ser = null;
  +
  +        try {
  +            // Try getting a specialized Serializer
  +            ser = getSpecialized(mechanismType);
  +            
  +            // Try getting a general purpose Serializer via constructor
  +            // invocation
  +            if (ser == null) {
  +                ser = getGeneralPurpose(mechanismType);
  +            }
  +            
  +            // If not successfull, try newInstance
  +            if (ser == null) {
  +                ser = (Serializer) serClass.newInstance();
  +            }
  +        } catch (Exception e) {
  +            throw new JAXRPCException(
  +                JavaUtils.getMessage("CantGetSerializer", 
  +                                     serClass.getName()),
  +                e);
  +        }
  +        firstCall = false;
  +        return ser;
  +    }
  +    
  +    /**
  +     * Obtains a serializer by invoking <constructor>(javaType, xmlType) 
  +     * on the serClass.
  +     */
  +    protected Serializer getGeneralPurpose(String mechanismType) {
  +        if (javaType != null && xmlType != null) {
  +            if (serClassConstructor == null && firstCall) {
  +                try {
  +                    serClassConstructor = 
  +                        serClass.getConstructor(
  +                            new Class[] {Class.class, QName.class});
  +                } catch (NoSuchMethodException e) {}
  +            }
  +            if (serClassConstructor != null) {
  +                try {
  +                    return (Serializer) 
  +                        serClassConstructor.newInstance(
  +                            new Object[] {javaType, xmlType});
  +                } catch (InstantiationException e) {
  +                } catch (IllegalAccessException e) {
  +                } catch (InvocationTargetException e) {}
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Obtains a serializer by invoking getSerializer method in the 
  +     * javaType class or its Helper class.
  +     */
  +    protected Serializer getSpecialized(String mechanismType) {
  +        if (javaType != null && xmlType != null) {
  +            if (getSerializer == null && firstCall) {
  +                try {
  +                    getSerializer = 
  +                        javaType.getMethod("getSerializer",
  +                                           new Class[] {String.class, 
  +                                                        Class.class, 
  +                                                        QName.class});
  +                } catch (NoSuchMethodException e) {}
  +                if (getSerializer == null) {
  +                    try {
  +                        ClassLoader cl = 
  +                            Thread.currentThread().getContextClassLoader();
  +                        Class helper = Class.forName(
  +                            javaType.getName() + "_Helper", true, cl);
  +                        getSerializer =
  +                            helper.getMethod("getSerializer", 
  +                                             new Class[] {String.class, 
  +                                                          Class.class, 
  +                                                          QName.class});
  +                    } catch (NoSuchMethodException e) {
  +                    } catch (ClassNotFoundException e) {}
  +                }
  +            }
  +            if (getSerializer != null) {
  +                try {
  +                    return (Serializer) 
  +                        getSerializer.invoke(
  +                                             null,
  +                                             new Object[] {mechanismType, 
  +                                                           javaType, 
  +                                                           xmlType});
  +                } catch (IllegalAccessException e) {
  +                } catch (InvocationTargetException e) {}
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Returns a list of all XML processing mechanism types supported
  +     * by this SerializerFactory.
  +     *
  +     * @return List of unique identifiers for the supported XML 
  +     * processing mechanism types
  +     */
  +    public Iterator getSupportedMechanismTypes() {
  +        if (mechanisms == null) {
  +            mechanisms = new Vector();
  +            mechanisms.add(Constants.AXIS_SAX);
  +        }
  +        return mechanisms.iterator();
  +    }
  +    
  +    /**
  +     * Utility method that intospects on a factory class to decide how to 
  +     * create the factory.  Tries in the following order:
  +     * public static create(Class javaType, QName xmlType)
  +     * public <constructor>(Class javaType, QName xmlType)
  +     * public <constructor>()
  +     * @param factory class
  +     * @param QName xmlType
  +     * @param Class javaType
  +     */
  +    public static SerializerFactory createFactory(Class factory, 
  +                                                  Class javaType, 
  +                                                  QName xmlType) {
  +
  +        SerializerFactory sf = null;
  +        try {
  +            Method method = 
  +                factory.getMethod(
  +                    "create",
  +                    new Class[] {Class.class, QName.class});
  +            sf = (SerializerFactory) 
  +                method.invoke(null, 
  +                              new Object[] {javaType, xmlType});
  +        } catch (NoSuchMethodException e) {
  +        } catch (IllegalAccessException e) {
  +        } catch (InvocationTargetException e) {}
  +
  +        if (sf == null) {
  +            try {
  +                Constructor constructor =  
  +                    factory.getConstructor(
  +                        new Class[] {Class.class, QName.class});
  +                sf = (SerializerFactory) 
  +                    constructor.newInstance(
  +                        new Object[] {javaType, xmlType});
  +            } catch (NoSuchMethodException e) {
  +            } catch (InstantiationException e) {
  +            } catch (IllegalAccessException e) {
  +            } catch (InvocationTargetException e) {}
  +        }
  +        
  +        if (sf == null) {
  +            try {
  +                sf = (SerializerFactory) factory.newInstance();
  +            } catch (InstantiationException e) {
  +            } catch (IllegalAccessException e) {}
  +        }
  +        return sf;
  +    }
  +}
  
  
  
  1.9       +244 -244  xml-axis/java/src/org/apache/axis/encoding/ser/MapDeserializer.java
  
  Index: MapDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/MapDeserializer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MapDeserializer.java	30 May 2002 03:06:08 -0000	1.8
  +++ MapDeserializer.java	30 May 2002 23:46:01 -0000	1.9
  @@ -1,244 +1,244 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.encoding.DeserializerTarget;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.util.HashMap;
  -import java.util.Map;
  -
  -/*
  - * A <code>MapSerializer</code> is be used to deserialize
  - * deserialize Maps using the <code>SOAP-ENC</code>
  - * encoding style.<p>
  - * 
  - * @author Glen Daniels (gdaniels@macromedia.com)
  - * Modified by @author Rich scheuerle <scheu@us.ibm.com>
  - */
  -public class MapDeserializer extends DeserializerImpl {
  -
  -    protected static Log log =
  -        LogFactory.getLog(MapDeserializer.class.getName());
  -
  -    // Fixed objects to act as hints to the set() callback
  -    public static final Object KEYHINT = new Object();
  -    public static final Object VALHINT = new Object();
  -    public static final Object NILHINT = new Object();        
  -
  -
  -    /**
  -     * This method is invoked after startElement when the element requires
  -     * deserialization (i.e. the element is not an href and the value is not nil.)
  -     * 
  -     * Simply creates map.
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param qName is the prefixed qname of the element
  -     * @param attributes are the attributes on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     */
  -    public void onStartElement(String namespace, String localName,
  -                               String qName, Attributes attributes,
  -                               DeserializationContext context)
  -        throws SAXException {
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter MapDeserializer::startElement()");
  -        }
  -        
  -        if (attributes.getValue(Constants.NS_URI_CURRENT_SCHEMA_XSI,  "nil") != null) {
  -            return;
  -        }
  -        
  -        // Create a hashmap to hold the deserialized values.
  -        setValue(new HashMap());
  -        
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: MapDeserializer::startElement()");
  -        }
  -    }
  -    
  -    /**
  -     * onStartChild is called on each child element.
  -     *
  -     * @param namespace is the namespace of the child element
  -     * @param localName is the local name of the child element
  -     * @param prefix is the prefix used on the name of the child element
  -     * @param attributes are the attributes of the child element
  -     * @param context is the deserialization context.
  -     * @return is a Deserializer to use to deserialize a child (must be
  -     * a derived class of SOAPHandler) or null if no deserialization should
  -     * be performed.
  -     */
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException {
  -
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: MapDeserializer::onStartChild()");
  -        }
  -
  -        if (!localName.equals("item"))
  -            throw new SAXException(
  -                    JavaUtils.getMessage("itemInMap00"));
  -                    
  -        SOAPHandler sh = new ItemHandler(this);
  -        
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: MapDeserializer::onStartChild()");
  -        }
  -
  -        return sh;
  -    }
  -    
  -    /**
  -     * The registerValueTarget code above causes this set function to be invoked when
  -     * each value is known.
  -     * @param value is the value of an element
  -     * @param hint is the key
  -     */
  -    public void setValue(Object value, Object hint) throws SAXException
  -    {
  -        if (log.isDebugEnabled()) {
  -            log.debug(JavaUtils.getMessage("gotValue00", "MapDeserializer", "" + value));
  -        }
  -        ((Map)this.value).put(hint, value);
  -    }
  -    
  -    /**
  -     * A deserializer for an <item>.  Handles getting the key and
  -     * value objects from their own deserializers, and then putting
  -     * the values into the HashMap we're building.
  -     * 
  -     */
  -    class ItemHandler extends DeserializerImpl {
  -        Object key;
  -        Object myValue;
  -        int numSet = 0;
  -        MapDeserializer md = null;
  -
  -        ItemHandler(MapDeserializer md) {
  -            this.md = md;
  -        }
  -        /** 
  -         * Callback from our deserializers.  The hint indicates
  -         * whether the passed "val" argument is the key or the value
  -         * for this mapping.
  -         */
  -        public void setValue(Object val, Object hint) throws SAXException 
  -        {
  -            if (hint == KEYHINT) {
  -                key = val;
  -            } else if (hint == VALHINT) {
  -                myValue = val;
  -            } else if (hint != NILHINT) {
  -                return;
  -            }
  -            numSet++;
  -            if (numSet == 2)
  -                md.setValue(myValue, key);
  -        }
  -        
  -        public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -        {
  -            QName typeQName = context.getTypeFromAttributes(namespace,
  -                                                            localName,
  -                                                            attributes);
  -            Deserializer dser = context.getDeserializerForType(typeQName);
  -
  -            // If no deserializer, use the base DeserializerImpl.
  -            if (dser == null)
  -                dser = new DeserializerImpl();
  -
  -            // When the child value is ready, we
  -            // want our set method to be invoked.
  -            // To do this register a DeserializeTarget on the
  -            // new Deserializer.
  -            DeserializerTarget dt = null;
  -            if (context.isNil(attributes)) {
  -                dt = new DeserializerTarget(this, NILHINT);
  -            } else if (localName.equals("key")) {
  -                dt = new DeserializerTarget(this, KEYHINT);
  -            } else if (localName.equals("value")) {
  -                dt = new DeserializerTarget(this, VALHINT);
  -            } else {
  -                // Do nothing
  -            }
  -            if (dt != null) {
  -                dser.registerValueTarget(dt);
  -            }
  -            return (SOAPHandler)dser;
  -        }
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.encoding.DeserializerTarget;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.util.HashMap;
  +import java.util.Map;
  +
  +/*
  + * A <code>MapSerializer</code> is be used to deserialize
  + * deserialize Maps using the <code>SOAP-ENC</code>
  + * encoding style.<p>
  + * 
  + * @author Glen Daniels (gdaniels@macromedia.com)
  + * Modified by @author Rich scheuerle <scheu@us.ibm.com>
  + */
  +public class MapDeserializer extends DeserializerImpl {
  +
  +    protected static Log log =
  +        LogFactory.getLog(MapDeserializer.class.getName());
  +
  +    // Fixed objects to act as hints to the set() callback
  +    public static final Object KEYHINT = new Object();
  +    public static final Object VALHINT = new Object();
  +    public static final Object NILHINT = new Object();        
  +
  +
  +    /**
  +     * This method is invoked after startElement when the element requires
  +     * deserialization (i.e. the element is not an href and the value is not nil.)
  +     * 
  +     * Simply creates map.
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param qName is the prefixed qname of the element
  +     * @param attributes are the attributes on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     */
  +    public void onStartElement(String namespace, String localName,
  +                               String qName, Attributes attributes,
  +                               DeserializationContext context)
  +        throws SAXException {
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter MapDeserializer::startElement()");
  +        }
  +        
  +        if (attributes.getValue(Constants.NS_URI_CURRENT_SCHEMA_XSI,  "nil") != null) {
  +            return;
  +        }
  +        
  +        // Create a hashmap to hold the deserialized values.
  +        setValue(new HashMap());
  +        
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: MapDeserializer::startElement()");
  +        }
  +    }
  +    
  +    /**
  +     * onStartChild is called on each child element.
  +     *
  +     * @param namespace is the namespace of the child element
  +     * @param localName is the local name of the child element
  +     * @param prefix is the prefix used on the name of the child element
  +     * @param attributes are the attributes of the child element
  +     * @param context is the deserialization context.
  +     * @return is a Deserializer to use to deserialize a child (must be
  +     * a derived class of SOAPHandler) or null if no deserialization should
  +     * be performed.
  +     */
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException {
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: MapDeserializer::onStartChild()");
  +        }
  +
  +        if (!localName.equals("item"))
  +            throw new SAXException(
  +                    JavaUtils.getMessage("itemInMap00"));
  +                    
  +        SOAPHandler sh = new ItemHandler(this);
  +        
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: MapDeserializer::onStartChild()");
  +        }
  +
  +        return sh;
  +    }
  +    
  +    /**
  +     * The registerValueTarget code above causes this set function to be invoked when
  +     * each value is known.
  +     * @param value is the value of an element
  +     * @param hint is the key
  +     */
  +    public void setValue(Object value, Object hint) throws SAXException
  +    {
  +        if (log.isDebugEnabled()) {
  +            log.debug(JavaUtils.getMessage("gotValue00", "MapDeserializer", "" + value));
  +        }
  +        ((Map)this.value).put(hint, value);
  +    }
  +    
  +    /**
  +     * A deserializer for an <item>.  Handles getting the key and
  +     * value objects from their own deserializers, and then putting
  +     * the values into the HashMap we're building.
  +     * 
  +     */
  +    class ItemHandler extends DeserializerImpl {
  +        Object key;
  +        Object myValue;
  +        int numSet = 0;
  +        MapDeserializer md = null;
  +
  +        ItemHandler(MapDeserializer md) {
  +            this.md = md;
  +        }
  +        /** 
  +         * Callback from our deserializers.  The hint indicates
  +         * whether the passed "val" argument is the key or the value
  +         * for this mapping.
  +         */
  +        public void setValue(Object val, Object hint) throws SAXException 
  +        {
  +            if (hint == KEYHINT) {
  +                key = val;
  +            } else if (hint == VALHINT) {
  +                myValue = val;
  +            } else if (hint != NILHINT) {
  +                return;
  +            }
  +            numSet++;
  +            if (numSet == 2)
  +                md.setValue(myValue, key);
  +        }
  +        
  +        public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException
  +        {
  +            QName typeQName = context.getTypeFromAttributes(namespace,
  +                                                            localName,
  +                                                            attributes);
  +            Deserializer dser = context.getDeserializerForType(typeQName);
  +
  +            // If no deserializer, use the base DeserializerImpl.
  +            if (dser == null)
  +                dser = new DeserializerImpl();
  +
  +            // When the child value is ready, we
  +            // want our set method to be invoked.
  +            // To do this register a DeserializeTarget on the
  +            // new Deserializer.
  +            DeserializerTarget dt = null;
  +            if (context.isNil(attributes)) {
  +                dt = new DeserializerTarget(this, NILHINT);
  +            } else if (localName.equals("key")) {
  +                dt = new DeserializerTarget(this, KEYHINT);
  +            } else if (localName.equals("value")) {
  +                dt = new DeserializerTarget(this, VALHINT);
  +            } else {
  +                // Do nothing
  +            }
  +            if (dt != null) {
  +                dser.registerValueTarget(dt);
  +            }
  +            return (SOAPHandler)dser;
  +        }
  +    }
  +}
  
  
  
  1.4       +91 -91    xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializerFactory.java
  
  Index: MapSerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MapSerializerFactory.java	30 May 2002 03:06:08 -0000	1.3
  +++ MapSerializerFactory.java	30 May 2002 23:46:01 -0000	1.4
  @@ -1,91 +1,91 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import java.beans.IntrospectionException;
  -import java.io.IOException;
  -import java.lang.reflect.Constructor;
  -import java.lang.reflect.InvocationTargetException;
  -
  -import javax.xml.rpc.JAXRPCException;
  -import javax.xml.rpc.namespace.QName;
  -
  -import org.apache.axis.InternalException;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.utils.JavaUtils;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -
  -/**
  - * A MapSerializer Factory
  - *
  - *  @author Rich Scheuerle (scheu@us.ibm.com)
  - */
  -public class MapSerializerFactory extends BaseSerializerFactory {
  -
  -    public MapSerializerFactory(Class javaType, QName xmlType) {
  -        super(MapSerializer.class, false, xmlType, javaType); 
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import java.beans.IntrospectionException;
  +import java.io.IOException;
  +import java.lang.reflect.Constructor;
  +import java.lang.reflect.InvocationTargetException;
  +
  +import javax.xml.rpc.JAXRPCException;
  +import javax.xml.rpc.namespace.QName;
  +
  +import org.apache.axis.InternalException;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +
  +/**
  + * A MapSerializer Factory
  + *
  + *  @author Rich Scheuerle (scheu@us.ibm.com)
  + */
  +public class MapSerializerFactory extends BaseSerializerFactory {
  +
  +    public MapSerializerFactory(Class javaType, QName xmlType) {
  +        super(MapSerializer.class, false, xmlType, javaType); 
  +    }
  +}
  
  
  
  1.18      +344 -344  xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java
  
  Index: SimpleDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SimpleDeserializer.java	30 May 2002 03:06:08 -0000	1.17
  +++ SimpleDeserializer.java	30 May 2002 23:46:01 -0000	1.18
  @@ -1,344 +1,344 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.apache.axis.description.TypeDesc;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.encoding.SimpleType;
  -import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.utils.BeanPropertyDescriptor;
  -import org.apache.axis.utils.BeanUtils;
  -import org.apache.axis.utils.JavaUtils;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.lang.reflect.Constructor;
  -import java.lang.reflect.InvocationTargetException;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.Set;
  -
  -/**
  - * A deserializer for any simple type with a (String) constructor.  Note:
  - * this class is designed so that subclasses need only override the makeValue 
  - * method in order to construct objects of their own type.
  - *
  - * @author Glen Daniels (gdaniels@macromedia.com)
  - * @author Sam Ruby (rubys@us.ibm.com)
  - * Modified for JAX-RPC @author Rich Scheuerle (scheu@us.ibm.com)
  - */
  -public class SimpleDeserializer extends DeserializerImpl {
  -
  -    StringBuffer val = new StringBuffer();
  -    private Constructor constructor = null;
  -    private BeanPropertyDescriptor[] pd = null;
  -    private HashMap propertyMap = new HashMap();
  -    private HashMap attributeMap = null;
  -
  -    public QName xmlType;
  -    public Class javaType;
  -
  -    private TypeDesc typeDesc = null;
  -
  -    /**
  -     * The Deserializer is constructed with the xmlType and 
  -     * javaType (which could be a java primitive like int.class)
  -     */
  -    public SimpleDeserializer(Class javaType, QName xmlType) {
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -        
  -        // if this type is a SimpleType bean, get bean properties
  -        if (SimpleType.class.isAssignableFrom(javaType)) {
  -            typeDesc = TypeDesc.getTypeDescForClass(javaType);
  -            this.pd = BeanUtils.getPd(javaType,typeDesc);
  -            // loop through properties and grab the names for later
  -            for (int i = 0; i < pd.length; i++) {
  -                BeanPropertyDescriptor descriptor = pd[i];
  -                propertyMap.put(descriptor.getName(), descriptor);
  -            }
  -        }        
  -    }
  -    public SimpleDeserializer(Class javaType, QName xmlType, TypeDesc typeDesc) {
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -        this.typeDesc = typeDesc;
  -        
  -        // if this type is a SimpleType bean, get bean properties
  -        if (SimpleType.class.isAssignableFrom(javaType)) {
  -            this.pd = BeanUtils.getPd(javaType, typeDesc);
  -            // loop through properties and grab the names for later
  -            for (int i = 0; i < pd.length; i++) {
  -                BeanPropertyDescriptor descriptor = pd[i];
  -                propertyMap.put(descriptor.getName(), descriptor);
  -            }
  -        }        
  -    }    
  -      
  -    /** 
  -     * The Factory calls setConstructor.
  -     */
  -    public void setConstructor(Constructor c) 
  -    {
  -        constructor = c;
  -    }
  -
  -    /**
  -     * There should not be nested elements, so thow and exception if this occurs.
  -     */
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        throw new SAXException(
  -                JavaUtils.getMessage("cantHandle00", "SimpleDeser"));
  -    }
  -    
  -    /**
  -     * Append any characters received to the value.  This method is defined 
  -     * by Deserializer.
  -     */
  -    public void characters(char [] chars, int start, int end)
  -        throws SAXException
  -    {
  -        val.append(chars, start, end);
  -    }
  -    
  -    /**
  -     * Append any characters to the value.  This method is defined by 
  -     * Deserializer.
  -     */
  -    public void onEndElement(String namespace, String localName,
  -                           DeserializationContext context)
  -        throws SAXException
  -    {
  -        if (isNil) {
  -            value = null;
  -            return;
  -        }
  -        try {
  -            value = makeValue(val.toString());
  -        } catch (InvocationTargetException ite) {
  -            Throwable realException = ite.getTargetException();
  -            if (realException instanceof Exception)
  -               throw new SAXException((Exception)realException);
  -            else
  -               throw new SAXException(ite.getMessage());
  -        } catch (Exception e) {
  -            throw new SAXException(e);
  -        }
  -        
  -        // If this is a SimpleType, set attributes we have stashed away
  -        setSimpleTypeAttributes();
  -    }
  -    
  -    /**
  -     * Convert the string that has been accumulated into an Object.  Subclasses
  -     * may override this.  Note that if the javaType is a primitive, the returned
  -     * object is a wrapper class.
  -     * @param source the serialized value to be deserialized
  -     * @throws Exception any exception thrown by this method will be wrapped
  -     */
  -    public Object makeValue(String source) throws Exception
  -    {
  -        // If the javaType is a boolean, except a number of different sources
  -        if (javaType == boolean.class || javaType == Boolean.class) {
  -            // This is a pretty lame test, but it is what the previous code did.
  -            switch (source.charAt(0)) {
  -                case '0': case 'f': case 'F':
  -                   return Boolean.FALSE;
  -
  -                case '1': case 't': case 'T': 
  -                   return Boolean.TRUE; 
  -
  -                default:
  -                   throw new NumberFormatException(
  -                           JavaUtils.getMessage("badBool00"));
  -            }
  -            
  -        }
  -
  -        // If expecting a Float or a Double, need to accept some special cases.
  -        if (javaType == float.class ||
  -            javaType == java.lang.Float.class) {
  -            if (source.equals("NaN")) {
  -                return new Float(Float.NaN);
  -            } else if (source.equals("INF")) {
  -                return new Float(Float.POSITIVE_INFINITY);
  -            } else if (source.equals("-INF")) {
  -                return new Float(Float.NEGATIVE_INFINITY);
  -            }
  -        }
  -        if (javaType == double.class ||
  -            javaType == java.lang.Double.class) {
  -            if (source.equals("NaN")) {
  -                return new Double(Double.NaN);
  -            } else if (source.equals("INF")) {
  -                return new Double(Double.POSITIVE_INFINITY);
  -            } else if (source.equals("-INF")) {
  -                return new Double(Double.NEGATIVE_INFINITY);
  -            }
  -        }    
  -        return constructor.newInstance(new Object [] { source });
  -    }
  -
  -    /**
  -     * Set the bean properties that correspond to element attributes.
  -     * 
  -     * This method is invoked after startElement when the element requires
  -     * deserialization (i.e. the element is not an href and the value is not nil.)
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param qName is the prefixed qName of the element
  -     * @param attributes are the attributes on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     */
  -    public void onStartElement(String namespace, String localName,
  -                               String qName, Attributes attributes,
  -                               DeserializationContext context)
  -            throws SAXException 
  -    {
  -
  -        // If we have no metadata, we have no attributes.  Q.E.D.
  -        if (typeDesc == null)
  -            return;
  -        
  -        // loop through the attributes and set bean properties that
  -        // correspond to attributes
  -        for (int i=0; i < attributes.getLength(); i++) {
  -            QName attrQName = new QName(attributes.getURI(i),
  -                                        attributes.getLocalName(i));
  -            String fieldName = typeDesc.getFieldNameForAttribute(attrQName);
  -            if (fieldName == null)
  -                continue;
  -
  -            // look for the attribute property
  -            BeanPropertyDescriptor bpd =
  -                    (BeanPropertyDescriptor) propertyMap.get(fieldName);
  -            if (bpd != null) {
  -                if (!bpd.isWriteable() || bpd.isIndexed() ) continue ;
  -
  -                // determine the QName for this child element
  -                TypeMapping tm = context.getTypeMapping();
  -                Class type = bpd.getType();
  -                QName qn = tm.getTypeQName(type);
  -                if (qn == null)
  -                    throw new SAXException(
  -                            JavaUtils.getMessage("unregistered00", type.toString()));
  -
  -                // get the deserializer
  -                Deserializer dSer = context.getDeserializerForType(qn);
  -                if (dSer == null)
  -                    throw new SAXException(
  -                            JavaUtils.getMessage("noDeser00", type.toString()));
  -                if (! (dSer instanceof SimpleDeserializer))
  -                    throw new SAXException(
  -                            JavaUtils.getMessage("AttrNotSimpleType00",
  -                                                 bpd.getName(),
  -                                                 type.toString()));
  -
  -                // Success!  Create an object from the string and save
  -                // it in our attribute map for later.
  -                if (attributeMap == null) {
  -                    attributeMap = new HashMap();
  -                }
  -                try {
  -                    Object val = ((SimpleDeserializer)dSer).
  -                        makeValue(attributes.getValue(i));
  -                    attributeMap.put(fieldName, val);
  -                } catch (Exception e) {
  -                    throw new SAXException(e);
  -                }
  -            } // if
  -        } // attribute loop
  -    } // onStartElement
  -
  -    /**
  -     * Process any attributes we may have encountered (in onStartElement)
  -     */ 
  -    private void setSimpleTypeAttributes() throws SAXException {
  -        // if this isn't a simpleType bean, wont have attributes
  -        if (! SimpleType.class.isAssignableFrom(javaType) ||
  -            attributeMap == null)
  -            return;
  -        
  -        // loop through map
  -        Set entries = attributeMap.entrySet();
  -        for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
  -            Map.Entry entry = (Map.Entry) iterator.next();
  -            String name = (String) entry.getKey();
  -            Object val = entry.getValue();
  -            
  -            BeanPropertyDescriptor bpd =
  -                    (BeanPropertyDescriptor) propertyMap.get(name);
  -            if (!bpd.isWriteable() || bpd.isIndexed()) continue;
  -            try {
  -                bpd.set(value, val );
  -            } catch (Exception e) {
  -                throw new SAXException(e);
  -            }
  -        }
  -    }
  -
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.apache.axis.description.TypeDesc;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.encoding.SimpleType;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.BeanPropertyDescriptor;
  +import org.apache.axis.utils.BeanUtils;
  +import org.apache.axis.utils.JavaUtils;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.lang.reflect.Constructor;
  +import java.lang.reflect.InvocationTargetException;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.Map;
  +import java.util.Set;
  +
  +/**
  + * A deserializer for any simple type with a (String) constructor.  Note:
  + * this class is designed so that subclasses need only override the makeValue 
  + * method in order to construct objects of their own type.
  + *
  + * @author Glen Daniels (gdaniels@macromedia.com)
  + * @author Sam Ruby (rubys@us.ibm.com)
  + * Modified for JAX-RPC @author Rich Scheuerle (scheu@us.ibm.com)
  + */
  +public class SimpleDeserializer extends DeserializerImpl {
  +
  +    StringBuffer val = new StringBuffer();
  +    private Constructor constructor = null;
  +    private BeanPropertyDescriptor[] pd = null;
  +    private HashMap propertyMap = new HashMap();
  +    private HashMap attributeMap = null;
  +
  +    public QName xmlType;
  +    public Class javaType;
  +
  +    private TypeDesc typeDesc = null;
  +
  +    /**
  +     * The Deserializer is constructed with the xmlType and 
  +     * javaType (which could be a java primitive like int.class)
  +     */
  +    public SimpleDeserializer(Class javaType, QName xmlType) {
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +        
  +        // if this type is a SimpleType bean, get bean properties
  +        if (SimpleType.class.isAssignableFrom(javaType)) {
  +            typeDesc = TypeDesc.getTypeDescForClass(javaType);
  +            this.pd = BeanUtils.getPd(javaType,typeDesc);
  +            // loop through properties and grab the names for later
  +            for (int i = 0; i < pd.length; i++) {
  +                BeanPropertyDescriptor descriptor = pd[i];
  +                propertyMap.put(descriptor.getName(), descriptor);
  +            }
  +        }        
  +    }
  +    public SimpleDeserializer(Class javaType, QName xmlType, TypeDesc typeDesc) {
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +        this.typeDesc = typeDesc;
  +        
  +        // if this type is a SimpleType bean, get bean properties
  +        if (SimpleType.class.isAssignableFrom(javaType)) {
  +            this.pd = BeanUtils.getPd(javaType, typeDesc);
  +            // loop through properties and grab the names for later
  +            for (int i = 0; i < pd.length; i++) {
  +                BeanPropertyDescriptor descriptor = pd[i];
  +                propertyMap.put(descriptor.getName(), descriptor);
  +            }
  +        }        
  +    }    
  +      
  +    /** 
  +     * The Factory calls setConstructor.
  +     */
  +    public void setConstructor(Constructor c) 
  +    {
  +        constructor = c;
  +    }
  +
  +    /**
  +     * There should not be nested elements, so thow and exception if this occurs.
  +     */
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException
  +    {
  +        throw new SAXException(
  +                JavaUtils.getMessage("cantHandle00", "SimpleDeser"));
  +    }
  +    
  +    /**
  +     * Append any characters received to the value.  This method is defined 
  +     * by Deserializer.
  +     */
  +    public void characters(char [] chars, int start, int end)
  +        throws SAXException
  +    {
  +        val.append(chars, start, end);
  +    }
  +    
  +    /**
  +     * Append any characters to the value.  This method is defined by 
  +     * Deserializer.
  +     */
  +    public void onEndElement(String namespace, String localName,
  +                           DeserializationContext context)
  +        throws SAXException
  +    {
  +        if (isNil) {
  +            value = null;
  +            return;
  +        }
  +        try {
  +            value = makeValue(val.toString());
  +        } catch (InvocationTargetException ite) {
  +            Throwable realException = ite.getTargetException();
  +            if (realException instanceof Exception)
  +               throw new SAXException((Exception)realException);
  +            else
  +               throw new SAXException(ite.getMessage());
  +        } catch (Exception e) {
  +            throw new SAXException(e);
  +        }
  +        
  +        // If this is a SimpleType, set attributes we have stashed away
  +        setSimpleTypeAttributes();
  +    }
  +    
  +    /**
  +     * Convert the string that has been accumulated into an Object.  Subclasses
  +     * may override this.  Note that if the javaType is a primitive, the returned
  +     * object is a wrapper class.
  +     * @param source the serialized value to be deserialized
  +     * @throws Exception any exception thrown by this method will be wrapped
  +     */
  +    public Object makeValue(String source) throws Exception
  +    {
  +        // If the javaType is a boolean, except a number of different sources
  +        if (javaType == boolean.class || javaType == Boolean.class) {
  +            // This is a pretty lame test, but it is what the previous code did.
  +            switch (source.charAt(0)) {
  +                case '0': case 'f': case 'F':
  +                   return Boolean.FALSE;
  +
  +                case '1': case 't': case 'T': 
  +                   return Boolean.TRUE; 
  +
  +                default:
  +                   throw new NumberFormatException(
  +                           JavaUtils.getMessage("badBool00"));
  +            }
  +            
  +        }
  +
  +        // If expecting a Float or a Double, need to accept some special cases.
  +        if (javaType == float.class ||
  +            javaType == java.lang.Float.class) {
  +            if (source.equals("NaN")) {
  +                return new Float(Float.NaN);
  +            } else if (source.equals("INF")) {
  +                return new Float(Float.POSITIVE_INFINITY);
  +            } else if (source.equals("-INF")) {
  +                return new Float(Float.NEGATIVE_INFINITY);
  +            }
  +        }
  +        if (javaType == double.class ||
  +            javaType == java.lang.Double.class) {
  +            if (source.equals("NaN")) {
  +                return new Double(Double.NaN);
  +            } else if (source.equals("INF")) {
  +                return new Double(Double.POSITIVE_INFINITY);
  +            } else if (source.equals("-INF")) {
  +                return new Double(Double.NEGATIVE_INFINITY);
  +            }
  +        }    
  +        return constructor.newInstance(new Object [] { source });
  +    }
  +
  +    /**
  +     * Set the bean properties that correspond to element attributes.
  +     * 
  +     * This method is invoked after startElement when the element requires
  +     * deserialization (i.e. the element is not an href and the value is not nil.)
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param qName is the prefixed qName of the element
  +     * @param attributes are the attributes on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     */
  +    public void onStartElement(String namespace, String localName,
  +                               String qName, Attributes attributes,
  +                               DeserializationContext context)
  +            throws SAXException 
  +    {
  +
  +        // If we have no metadata, we have no attributes.  Q.E.D.
  +        if (typeDesc == null)
  +            return;
  +        
  +        // loop through the attributes and set bean properties that
  +        // correspond to attributes
  +        for (int i=0; i < attributes.getLength(); i++) {
  +            QName attrQName = new QName(attributes.getURI(i),
  +                                        attributes.getLocalName(i));
  +            String fieldName = typeDesc.getFieldNameForAttribute(attrQName);
  +            if (fieldName == null)
  +                continue;
  +
  +            // look for the attribute property
  +            BeanPropertyDescriptor bpd =
  +                    (BeanPropertyDescriptor) propertyMap.get(fieldName);
  +            if (bpd != null) {
  +                if (!bpd.isWriteable() || bpd.isIndexed() ) continue ;
  +
  +                // determine the QName for this child element
  +                TypeMapping tm = context.getTypeMapping();
  +                Class type = bpd.getType();
  +                QName qn = tm.getTypeQName(type);
  +                if (qn == null)
  +                    throw new SAXException(
  +                            JavaUtils.getMessage("unregistered00", type.toString()));
  +
  +                // get the deserializer
  +                Deserializer dSer = context.getDeserializerForType(qn);
  +                if (dSer == null)
  +                    throw new SAXException(
  +                            JavaUtils.getMessage("noDeser00", type.toString()));
  +                if (! (dSer instanceof SimpleDeserializer))
  +                    throw new SAXException(
  +                            JavaUtils.getMessage("AttrNotSimpleType00",
  +                                                 bpd.getName(),
  +                                                 type.toString()));
  +
  +                // Success!  Create an object from the string and save
  +                // it in our attribute map for later.
  +                if (attributeMap == null) {
  +                    attributeMap = new HashMap();
  +                }
  +                try {
  +                    Object val = ((SimpleDeserializer)dSer).
  +                        makeValue(attributes.getValue(i));
  +                    attributeMap.put(fieldName, val);
  +                } catch (Exception e) {
  +                    throw new SAXException(e);
  +                }
  +            } // if
  +        } // attribute loop
  +    } // onStartElement
  +
  +    /**
  +     * Process any attributes we may have encountered (in onStartElement)
  +     */ 
  +    private void setSimpleTypeAttributes() throws SAXException {
  +        // if this isn't a simpleType bean, wont have attributes
  +        if (! SimpleType.class.isAssignableFrom(javaType) ||
  +            attributeMap == null)
  +            return;
  +        
  +        // loop through map
  +        Set entries = attributeMap.entrySet();
  +        for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
  +            Map.Entry entry = (Map.Entry) iterator.next();
  +            String name = (String) entry.getKey();
  +            Object val = entry.getValue();
  +            
  +            BeanPropertyDescriptor bpd =
  +                    (BeanPropertyDescriptor) propertyMap.get(name);
  +            if (!bpd.isWriteable() || bpd.isIndexed()) continue;
  +            try {
  +                bpd.set(value, val );
  +            } catch (Exception e) {
  +                throw new SAXException(e);
  +            }
  +        }
  +    }
  +
  +}
  
  
  
  1.4       +84 -84    xml-axis/java/src/org/apache/axis/encoding/ser/SimpleNonPrimitiveSerializerFactory.java
  
  Index: SimpleNonPrimitiveSerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleNonPrimitiveSerializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleNonPrimitiveSerializerFactory.java	30 May 2002 03:06:08 -0000	1.3
  +++ SimpleNonPrimitiveSerializerFactory.java	30 May 2002 23:46:01 -0000	1.4
  @@ -1,84 +1,84 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -/**
  - * SerializerFactory for simple items that could be multi-refed (i.e. java.lang.Integer)
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public class SimpleNonPrimitiveSerializerFactory extends BaseSerializerFactory {
  -    /**
  -     * Note that the factory is constructed with the QName and xmlType.  This is important
  -     * to allow distinction between primitive values and java.lang wrappers.
  -     **/
  -    public SimpleNonPrimitiveSerializerFactory(Class javaType, QName xmlType) {
  -        super(SimpleSerializer.class, false, xmlType, javaType);  
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +/**
  + * SerializerFactory for simple items that could be multi-refed (i.e. java.lang.Integer)
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public class SimpleNonPrimitiveSerializerFactory extends BaseSerializerFactory {
  +    /**
  +     * Note that the factory is constructed with the QName and xmlType.  This is important
  +     * to allow distinction between primitive values and java.lang wrappers.
  +     **/
  +    public SimpleNonPrimitiveSerializerFactory(Class javaType, QName xmlType) {
  +        super(SimpleSerializer.class, false, xmlType, javaType);  
  +    }
  +}
  
  
  
  1.4       +84 -84    xml-axis/java/src/org/apache/axis/encoding/ser/SimplePrimitiveSerializerFactory.java
  
  Index: SimplePrimitiveSerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimplePrimitiveSerializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimplePrimitiveSerializerFactory.java	30 May 2002 03:06:09 -0000	1.3
  +++ SimplePrimitiveSerializerFactory.java	30 May 2002 23:46:01 -0000	1.4
  @@ -1,84 +1,84 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -/**
  - * SerializerFactory for primitives that have Simple Serialization (i.e. int, short etc.)
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public class SimplePrimitiveSerializerFactory extends BaseSerializerFactory {
  -    /**
  -     * Note that the factory is constructed with the QName and xmlType.  This is important
  -     * to allow distinction between primitive values and java.lang wrappers.
  -     **/
  -    public SimplePrimitiveSerializerFactory(Class javaType, QName xmlType) {
  -        super(SimpleSerializer.class, true, xmlType, javaType);  
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +/**
  + * SerializerFactory for primitives that have Simple Serialization (i.e. int, short etc.)
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public class SimplePrimitiveSerializerFactory extends BaseSerializerFactory {
  +    /**
  +     * Note that the factory is constructed with the QName and xmlType.  This is important
  +     * to allow distinction between primitive values and java.lang wrappers.
  +     **/
  +    public SimplePrimitiveSerializerFactory(Class javaType, QName xmlType) {
  +        super(SimpleSerializer.class, true, xmlType, javaType);  
  +    }
  +}
  
  
  
  1.17      +308 -308  xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java
  
  Index: SimpleSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SimpleSerializer.java	30 May 2002 03:06:09 -0000	1.16
  +++ SimpleSerializer.java	30 May 2002 23:46:01 -0000	1.17
  @@ -1,308 +1,308 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.Constants;
  -import org.apache.axis.description.FieldDesc;
  -import org.apache.axis.description.TypeDesc;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SimpleType;
  -import org.apache.axis.utils.BeanPropertyDescriptor;
  -import org.apache.axis.utils.BeanUtils;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.XMLUtils;
  -import org.apache.axis.wsdl.fromJava.Types;
  -import org.w3c.dom.Element;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.helpers.AttributesImpl;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -/**
  - * Serializer for primitives and anything simple whose value is obtained with toString()
  - *
  - * @author Rich Scheuerle <dims@yahoo.com>
  - */
  -public class SimpleSerializer implements Serializer {
  -
  -    public QName xmlType;
  -    public Class javaType;
  -    
  -    private BeanPropertyDescriptor[] propertyDescriptor = null;
  -    private TypeDesc typeDesc = null;
  -
  -    public SimpleSerializer(Class javaType, QName xmlType) {
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -        
  -        if (SimpleType.class.isAssignableFrom(javaType)) {
  -            // get the bean properties and the list of attributes from the bean
  -            typeDesc = TypeDesc.getTypeDescForClass(javaType);
  -            propertyDescriptor = BeanUtils.getPd(javaType, typeDesc);
  -        }
  -    }
  -    public SimpleSerializer(Class javaType, QName xmlType, TypeDesc typeDesc) {
  -        this.xmlType = xmlType;
  -        this.javaType = javaType;
  -        this.typeDesc = typeDesc;
  -        
  -        if (SimpleType.class.isAssignableFrom(javaType)) {
  -            // get the bean properties and the list of attributes from the bean
  -            propertyDescriptor = BeanUtils.getPd(javaType,typeDesc);
  -        }
  -    }
  -    /**
  -     * Serialize a primitive or simple value.
  -     * If the object to serialize is a primitive, the Object value below
  -     * is the associated java.lang class.
  -     * To determine if the original value is a java.lang class or a primitive, consult
  -     * the javaType class.
  -     */
  -    public void serialize(QName name, Attributes attributes,
  -                          Object value, SerializationContext context)
  -        throws IOException
  -    {
  -        if (value != null && value.getClass() == java.lang.Object.class) {
  -            throw new IOException(JavaUtils.getMessage("cantSerialize02"));
  -        }
  -
  -        // get any attributes
  -        if (value instanceof SimpleType)
  -            attributes = getObjectAttributes(value, attributes, context);
  -        
  -        context.startElement(name, attributes);
  -        if (value != null) {
  -            // We could have separate serializers/deserializers to take
  -            // care of Float/Double cases, but it makes more sence to
  -            // put them here with the rest of the java lang primitives.
  -            if (value instanceof Float ||
  -                value instanceof Double) {
  -                double data = 0.0;
  -                if (value instanceof Float) {
  -                    data = ((Float) value).doubleValue();
  -                } else {
  -                    data = ((Double) value).doubleValue();
  -                }
  -                if (Double.isNaN(data)) {
  -                    context.writeString("NaN");
  -                } else if (data == Double.POSITIVE_INFINITY) {
  -                    context.writeString("INF");
  -                } else if (data == Double.NEGATIVE_INFINITY) {
  -                    context.writeString("-INF");
  -                } else {
  -                    context.writeString(value.toString());
  -                }
  -            } else if (value instanceof String) {
  -                context.writeString(
  -                                    XMLUtils.xmlEncodeString(value.toString()));
  -            } else if (value instanceof SimpleType) {
  -                context.writeString(value.toString());
  -            } else {
  -                context.writeString(value.toString());
  -            }
  -        }
  -        context.endElement();
  -    }
  -
  -    private Attributes getObjectAttributes(Object value,
  -                                           Attributes attributes,
  -                                           SerializationContext context) {
  -        if (typeDesc == null || !typeDesc.hasAttributes())
  -            return attributes;
  -
  -        AttributesImpl attrs;
  -        if (attributes != null)
  -            attrs = new AttributesImpl(attributes);
  -        else
  -            attrs = new AttributesImpl();
  -
  -        try {
  -            // Find each property that is an attribute
  -            // and add it to our attribute list
  -            for (int i=0; i<propertyDescriptor.length; i++) {
  -                String propName = propertyDescriptor[i].getName();
  -                if (propName.equals("class"))
  -                    continue;
  -
  -                FieldDesc field = typeDesc.getFieldByName(propName);
  -                // skip it if its not an attribute
  -                if (field == null || field.isElement())
  -                    continue;
  -
  -                QName qname = field.getXmlName();
  -                if (qname == null) {
  -                    qname = new QName("", propName);
  -                }
  -
  -                if (propertyDescriptor[i].isReadable() &&
  -                    !propertyDescriptor[i].isIndexed()) {
  -                    // add to our attributes
  -                    Object propValue = propertyDescriptor[i].get(value);
  -                    // If the property value does not exist, don't serialize
  -                    // the attribute.  In the future, the decision to serializer
  -                    // the attribute may be more sophisticated.  For example, don't 
  -                    // serialize if the attribute matches the default value.
  -                    if (propValue != null) {
  -                        String propString = propValue.toString();
  -                        
  -                        String namespace = qname.getNamespaceURI();
  -                        String localName = qname.getLocalPart();
  -                        
  -                        attrs.addAttribute(namespace,
  -                                           localName,
  -                                           context.qName2String(qname),
  -                                           "CDATA",
  -                                           propString);
  -                    }
  -                }
  -            }
  -        } catch (Exception e) {
  -            // no attributes
  -            return attrs;
  -        }
  -
  -        return attrs;
  -    }
  -    
  -    public String getMechanismType() { return Constants.AXIS_SAX; }
  -
  -    /**
  -     * Return XML schema for the specified type, suitable for insertion into
  -     * the <types> element of a WSDL document.
  -     *
  -     * @param types the Java2WSDL Types object which holds the context
  -     *              for the WSDL being generated.
  -     * @return true if we wrote a schema, false if we didn't.
  -     * @see org.apache.axis.wsdl.fromJava.Types
  -     */
  -    public boolean writeSchema(Types types) throws Exception {
  -        // Let the caller generate WSDL if this is not a SimpleType
  -        if (!SimpleType.class.isAssignableFrom(javaType))
  -            return false;
  -        
  -        // Emit WSDL for simpleContent
  -        javax.wsdl.QName qName = types.getWsdlQName(xmlType);
  -
  -        // ComplexType representation of SimpleType bean class
  -        Element complexType = types.createElement("complexType");
  -        types.writeSchemaElement(qName, complexType);
  -        complexType.setAttribute("name", qName.getLocalPart());
  -
  -        // Produce simpleContent extending base type.
  -        Element simpleContent = types.createElement("simpleContent");
  -        complexType.appendChild(simpleContent);
  -        Element extension = types.createElement("extension");
  -        simpleContent.appendChild(extension);
  -        
  -        // Get the base type from the "value" element of the bean
  -        String base = "string";
  -        for (int i=0; i<propertyDescriptor.length; i++) {
  -            String propName = propertyDescriptor[i].getName();
  -            if (!propName.equals("value")) {
  -                if (typeDesc != null) {
  -                    FieldDesc field = typeDesc.getFieldByName(propName);
  -                    if (field != null) {
  -                        if (field.isElement()) {
  -                            // throw?
  -                        }
  -                        QName qname = field.getXmlName();
  -                        if (qname == null) {
  -                            // Use the default...
  -                            propName = propName;
  -                            qname = new QName("", propName);
  -                        }
  -
  -                        //  write attribute element
  -                        Class fieldType = propertyDescriptor[i].getType();
  -
  -                        // Attribute must be a simple type, enum or SimpleType
  -                        if (!types.isAcceptableAsAttribute(fieldType)) {
  -                            throw new AxisFault(JavaUtils.getMessage("AttrNotSimpleType00",
  -                                    propName,
  -                                    fieldType.getName()));
  -                        }
  -
  -                        // write attribute element
  -                        // TODO the attribute name needs to be preserved from the XML
  -                        String elementType = types.writeType(fieldType);
  -                        Element elem = types.createAttributeElement(propName,
  -                                elementType,
  -                                false,
  -                                extension.getOwnerDocument());
  -                        extension.appendChild(elem);
  -                    }
  -                }
  -                continue;
  -            }
  -
  -            BeanPropertyDescriptor bpd = propertyDescriptor[i];
  -            Class type = bpd.getType();
  -            // Attribute must extend a simple type, enum or SimpleType
  -            if (!types.isAcceptableAsAttribute(type)) {
  -                throw new AxisFault(JavaUtils.getMessage("AttrNotSimpleType01", 
  -                        type.getName()));
  -            }            
  -            base = types.writeType(type);
  -            extension.setAttribute("base", base);
  -        }
  -
  -        // done
  -        return true;
  -        
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.apache.axis.AxisFault;
  +import org.apache.axis.Constants;
  +import org.apache.axis.description.FieldDesc;
  +import org.apache.axis.description.TypeDesc;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SimpleType;
  +import org.apache.axis.utils.BeanPropertyDescriptor;
  +import org.apache.axis.utils.BeanUtils;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.utils.XMLUtils;
  +import org.apache.axis.wsdl.fromJava.Types;
  +import org.w3c.dom.Element;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.helpers.AttributesImpl;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +/**
  + * Serializer for primitives and anything simple whose value is obtained with toString()
  + *
  + * @author Rich Scheuerle <dims@yahoo.com>
  + */
  +public class SimpleSerializer implements Serializer {
  +
  +    public QName xmlType;
  +    public Class javaType;
  +    
  +    private BeanPropertyDescriptor[] propertyDescriptor = null;
  +    private TypeDesc typeDesc = null;
  +
  +    public SimpleSerializer(Class javaType, QName xmlType) {
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +        
  +        if (SimpleType.class.isAssignableFrom(javaType)) {
  +            // get the bean properties and the list of attributes from the bean
  +            typeDesc = TypeDesc.getTypeDescForClass(javaType);
  +            propertyDescriptor = BeanUtils.getPd(javaType, typeDesc);
  +        }
  +    }
  +    public SimpleSerializer(Class javaType, QName xmlType, TypeDesc typeDesc) {
  +        this.xmlType = xmlType;
  +        this.javaType = javaType;
  +        this.typeDesc = typeDesc;
  +        
  +        if (SimpleType.class.isAssignableFrom(javaType)) {
  +            // get the bean properties and the list of attributes from the bean
  +            propertyDescriptor = BeanUtils.getPd(javaType,typeDesc);
  +        }
  +    }
  +    /**
  +     * Serialize a primitive or simple value.
  +     * If the object to serialize is a primitive, the Object value below
  +     * is the associated java.lang class.
  +     * To determine if the original value is a java.lang class or a primitive, consult
  +     * the javaType class.
  +     */
  +    public void serialize(QName name, Attributes attributes,
  +                          Object value, SerializationContext context)
  +        throws IOException
  +    {
  +        if (value != null && value.getClass() == java.lang.Object.class) {
  +            throw new IOException(JavaUtils.getMessage("cantSerialize02"));
  +        }
  +
  +        // get any attributes
  +        if (value instanceof SimpleType)
  +            attributes = getObjectAttributes(value, attributes, context);
  +        
  +        context.startElement(name, attributes);
  +        if (value != null) {
  +            // We could have separate serializers/deserializers to take
  +            // care of Float/Double cases, but it makes more sence to
  +            // put them here with the rest of the java lang primitives.
  +            if (value instanceof Float ||
  +                value instanceof Double) {
  +                double data = 0.0;
  +                if (value instanceof Float) {
  +                    data = ((Float) value).doubleValue();
  +                } else {
  +                    data = ((Double) value).doubleValue();
  +                }
  +                if (Double.isNaN(data)) {
  +                    context.writeString("NaN");
  +                } else if (data == Double.POSITIVE_INFINITY) {
  +                    context.writeString("INF");
  +                } else if (data == Double.NEGATIVE_INFINITY) {
  +                    context.writeString("-INF");
  +                } else {
  +                    context.writeString(value.toString());
  +                }
  +            } else if (value instanceof String) {
  +                context.writeString(
  +                                    XMLUtils.xmlEncodeString(value.toString()));
  +            } else if (value instanceof SimpleType) {
  +                context.writeString(value.toString());
  +            } else {
  +                context.writeString(value.toString());
  +            }
  +        }
  +        context.endElement();
  +    }
  +
  +    private Attributes getObjectAttributes(Object value,
  +                                           Attributes attributes,
  +                                           SerializationContext context) {
  +        if (typeDesc == null || !typeDesc.hasAttributes())
  +            return attributes;
  +
  +        AttributesImpl attrs;
  +        if (attributes != null)
  +            attrs = new AttributesImpl(attributes);
  +        else
  +            attrs = new AttributesImpl();
  +
  +        try {
  +            // Find each property that is an attribute
  +            // and add it to our attribute list
  +            for (int i=0; i<propertyDescriptor.length; i++) {
  +                String propName = propertyDescriptor[i].getName();
  +                if (propName.equals("class"))
  +                    continue;
  +
  +                FieldDesc field = typeDesc.getFieldByName(propName);
  +                // skip it if its not an attribute
  +                if (field == null || field.isElement())
  +                    continue;
  +
  +                QName qname = field.getXmlName();
  +                if (qname == null) {
  +                    qname = new QName("", propName);
  +                }
  +
  +                if (propertyDescriptor[i].isReadable() &&
  +                    !propertyDescriptor[i].isIndexed()) {
  +                    // add to our attributes
  +                    Object propValue = propertyDescriptor[i].get(value);
  +                    // If the property value does not exist, don't serialize
  +                    // the attribute.  In the future, the decision to serializer
  +                    // the attribute may be more sophisticated.  For example, don't 
  +                    // serialize if the attribute matches the default value.
  +                    if (propValue != null) {
  +                        String propString = propValue.toString();
  +                        
  +                        String namespace = qname.getNamespaceURI();
  +                        String localName = qname.getLocalPart();
  +                        
  +                        attrs.addAttribute(namespace,
  +                                           localName,
  +                                           context.qName2String(qname),
  +                                           "CDATA",
  +                                           propString);
  +                    }
  +                }
  +            }
  +        } catch (Exception e) {
  +            // no attributes
  +            return attrs;
  +        }
  +
  +        return attrs;
  +    }
  +    
  +    public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        // Let the caller generate WSDL if this is not a SimpleType
  +        if (!SimpleType.class.isAssignableFrom(javaType))
  +            return false;
  +        
  +        // Emit WSDL for simpleContent
  +        javax.wsdl.QName qName = types.getWsdlQName(xmlType);
  +
  +        // ComplexType representation of SimpleType bean class
  +        Element complexType = types.createElement("complexType");
  +        types.writeSchemaElement(qName, complexType);
  +        complexType.setAttribute("name", qName.getLocalPart());
  +
  +        // Produce simpleContent extending base type.
  +        Element simpleContent = types.createElement("simpleContent");
  +        complexType.appendChild(simpleContent);
  +        Element extension = types.createElement("extension");
  +        simpleContent.appendChild(extension);
  +        
  +        // Get the base type from the "value" element of the bean
  +        String base = "string";
  +        for (int i=0; i<propertyDescriptor.length; i++) {
  +            String propName = propertyDescriptor[i].getName();
  +            if (!propName.equals("value")) {
  +                if (typeDesc != null) {
  +                    FieldDesc field = typeDesc.getFieldByName(propName);
  +                    if (field != null) {
  +                        if (field.isElement()) {
  +                            // throw?
  +                        }
  +                        QName qname = field.getXmlName();
  +                        if (qname == null) {
  +                            // Use the default...
  +                            propName = propName;
  +                            qname = new QName("", propName);
  +                        }
  +
  +                        //  write attribute element
  +                        Class fieldType = propertyDescriptor[i].getType();
  +
  +                        // Attribute must be a simple type, enum or SimpleType
  +                        if (!types.isAcceptableAsAttribute(fieldType)) {
  +                            throw new AxisFault(JavaUtils.getMessage("AttrNotSimpleType00",
  +                                    propName,
  +                                    fieldType.getName()));
  +                        }
  +
  +                        // write attribute element
  +                        // TODO the attribute name needs to be preserved from the XML
  +                        String elementType = types.writeType(fieldType);
  +                        Element elem = types.createAttributeElement(propName,
  +                                elementType,
  +                                false,
  +                                extension.getOwnerDocument());
  +                        extension.appendChild(elem);
  +                    }
  +                }
  +                continue;
  +            }
  +
  +            BeanPropertyDescriptor bpd = propertyDescriptor[i];
  +            Class type = bpd.getType();
  +            // Attribute must extend a simple type, enum or SimpleType
  +            if (!types.isAcceptableAsAttribute(type)) {
  +                throw new AxisFault(JavaUtils.getMessage("AttrNotSimpleType01", 
  +                        type.getName()));
  +            }            
  +            base = types.writeType(type);
  +            extension.setAttribute("base", base);
  +        }
  +
  +        // done
  +        return true;
  +        
  +    }
  +}
  
  
  
  1.9       +194 -194  xml-axis/java/src/org/apache/axis/encoding/ser/VectorDeserializer.java
  
  Index: VectorDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/VectorDeserializer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- VectorDeserializer.java	30 May 2002 03:06:09 -0000	1.8
  +++ VectorDeserializer.java	30 May 2002 23:46:01 -0000	1.9
  @@ -1,194 +1,194 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.encoding.DeserializerTarget;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.util.Vector;
  -
  -/**
  - * Deserializer for SOAP Vectors for compatibility with SOAP 2.2.
  - *
  - * @author Carsten Ziegeler (cziegeler@apache.org)
  - * Modified by @author Rich scheuerle <scheu@us.ibm.com>
  - */
  -public class VectorDeserializer extends DeserializerImpl
  -{
  -    protected static Log log =
  -        LogFactory.getLog(VectorDeserializer.class.getName());
  -
  -    public int curIndex = 0;
  -
  -    /**
  -     * This method is invoked after startElement when the element requires
  -     * deserialization (i.e. the element is not an href and the value is not nil.)
  -     * 
  -     * Simply creates 
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param qName is the prefixed qname of the element
  -     * @param attributes are the attributes on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     */
  -    public void onStartElement(String namespace, String localName,
  -                               String qName, Attributes attributes,
  -                               DeserializationContext context)
  -        throws SAXException {
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: VectorDeserializer::startElement()");
  -        }
  -        
  -        if (attributes.getValue(Constants.NS_URI_CURRENT_SCHEMA_XSI,  "nil") != null) {
  -            return;
  -        }
  -        
  -        // Create a vector to hold the deserialized values.
  -        setValue(new java.util.Vector());
  -        
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: VectorDeserializer::startElement()");
  -        }
  -    }
  -    
  -    /**
  -     * onStartChild is called on each child element.
  -     *
  -     * @param namespace is the namespace of the child element
  -     * @param localName is the local name of the child element
  -     * @param prefix is the prefix used on the name of the child element
  -     * @param attributes are the attributes of the child element
  -     * @param context is the deserialization context.
  -     * @return is a Deserializer to use to deserialize a child (must be
  -     * a derived class of SOAPHandler) or null if no deserialization should
  -     * be performed.
  -     */
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException {
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: VectorDeserializer::onStartChild()");
  -        }
  -        
  -        if (attributes == null)
  -            throw new SAXException(JavaUtils.getMessage("noType01"));
  -
  -        // If the xsi:nil attribute, set the value to null and return since
  -        // there is nothing to deserialize.
  -        if (context.isNil(attributes)) {
  -            setValue(null, new Integer(curIndex++));
  -            return null;
  -        }
  -
  -        // Get the type
  -        QName itemType = context.getTypeFromAttributes(namespace,
  -                                                       localName,
  -                                                       attributes);
  -        // Get the deserializer
  -        Deserializer dSer = null;
  -        if (itemType != null) {
  -           dSer = context.getDeserializerForType(itemType);
  -        }
  -        if (dSer == null) {
  -            dSer = new DeserializerImpl();
  -        }
  -
  -        // When the value is deserialized, inform us.
  -        // Need to pass the index because multi-ref stuff may 
  -        // result in the values being deserialized in a different order.
  -        dSer.registerValueTarget(new DeserializerTarget(this, new Integer(curIndex)));
  -        curIndex++;
  -
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: VectorDeserializer::onStartChild()");
  -        }
  -        return (SOAPHandler)dSer;
  -    }
  -    
  -    /**
  -     * The registerValueTarget code above causes this set function to be invoked when
  -     * each value is known.
  -     * @param value is the value of an element
  -     * @param hint is an Integer containing the index
  -     */
  -    public void setValue(Object value, Object hint) throws SAXException
  -    {
  -        if (log.isDebugEnabled()) {
  -            log.debug(JavaUtils.getMessage("gotValue00", "VectorDeserializer", "" + value));
  -        }
  -        int offset = ((Integer)hint).intValue();
  -        Vector v = (Vector)this.value;
  -        
  -        // If the vector is too small, grow it 
  -        if (offset >= v.size()) {
  -            v.setSize(offset+1);
  -        }
  -        v.setElementAt(value, offset);
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.encoding.DeserializerTarget;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.util.Vector;
  +
  +/**
  + * Deserializer for SOAP Vectors for compatibility with SOAP 2.2.
  + *
  + * @author Carsten Ziegeler (cziegeler@apache.org)
  + * Modified by @author Rich scheuerle <scheu@us.ibm.com>
  + */
  +public class VectorDeserializer extends DeserializerImpl
  +{
  +    protected static Log log =
  +        LogFactory.getLog(VectorDeserializer.class.getName());
  +
  +    public int curIndex = 0;
  +
  +    /**
  +     * This method is invoked after startElement when the element requires
  +     * deserialization (i.e. the element is not an href and the value is not nil.)
  +     * 
  +     * Simply creates 
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param qName is the prefixed qname of the element
  +     * @param attributes are the attributes on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     */
  +    public void onStartElement(String namespace, String localName,
  +                               String qName, Attributes attributes,
  +                               DeserializationContext context)
  +        throws SAXException {
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: VectorDeserializer::startElement()");
  +        }
  +        
  +        if (attributes.getValue(Constants.NS_URI_CURRENT_SCHEMA_XSI,  "nil") != null) {
  +            return;
  +        }
  +        
  +        // Create a vector to hold the deserialized values.
  +        setValue(new java.util.Vector());
  +        
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: VectorDeserializer::startElement()");
  +        }
  +    }
  +    
  +    /**
  +     * onStartChild is called on each child element.
  +     *
  +     * @param namespace is the namespace of the child element
  +     * @param localName is the local name of the child element
  +     * @param prefix is the prefix used on the name of the child element
  +     * @param attributes are the attributes of the child element
  +     * @param context is the deserialization context.
  +     * @return is a Deserializer to use to deserialize a child (must be
  +     * a derived class of SOAPHandler) or null if no deserialization should
  +     * be performed.
  +     */
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException {
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: VectorDeserializer::onStartChild()");
  +        }
  +        
  +        if (attributes == null)
  +            throw new SAXException(JavaUtils.getMessage("noType01"));
  +
  +        // If the xsi:nil attribute, set the value to null and return since
  +        // there is nothing to deserialize.
  +        if (context.isNil(attributes)) {
  +            setValue(null, new Integer(curIndex++));
  +            return null;
  +        }
  +
  +        // Get the type
  +        QName itemType = context.getTypeFromAttributes(namespace,
  +                                                       localName,
  +                                                       attributes);
  +        // Get the deserializer
  +        Deserializer dSer = null;
  +        if (itemType != null) {
  +           dSer = context.getDeserializerForType(itemType);
  +        }
  +        if (dSer == null) {
  +            dSer = new DeserializerImpl();
  +        }
  +
  +        // When the value is deserialized, inform us.
  +        // Need to pass the index because multi-ref stuff may 
  +        // result in the values being deserialized in a different order.
  +        dSer.registerValueTarget(new DeserializerTarget(this, new Integer(curIndex)));
  +        curIndex++;
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: VectorDeserializer::onStartChild()");
  +        }
  +        return (SOAPHandler)dSer;
  +    }
  +    
  +    /**
  +     * The registerValueTarget code above causes this set function to be invoked when
  +     * each value is known.
  +     * @param value is the value of an element
  +     * @param hint is an Integer containing the index
  +     */
  +    public void setValue(Object value, Object hint) throws SAXException
  +    {
  +        if (log.isDebugEnabled()) {
  +            log.debug(JavaUtils.getMessage("gotValue00", "VectorDeserializer", "" + value));
  +        }
  +        int offset = ((Integer)hint).intValue();
  +        Vector v = (Vector)this.value;
  +        
  +        // If the vector is too small, grow it 
  +        if (offset >= v.size()) {
  +            v.setSize(offset+1);
  +        }
  +        v.setElementAt(value, offset);
  +    }
  +}
  
  
  
  1.4       +158 -158  xml-axis/java/src/org/apache/axis/encoding/ser/VectorSerializer.java
  
  Index: VectorSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/VectorSerializer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VectorSerializer.java	30 May 2002 03:06:09 -0000	1.3
  +++ VectorSerializer.java	30 May 2002 23:46:01 -0000	1.4
  @@ -1,158 +1,158 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.wsdl.fromJava.Types;
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.utils.JavaUtils;
  -
  -import java.io.IOException;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.Vector;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Document;
  -
  -/**
  - * A <code>VectorSerializer</code> is be used to serialize and
  - * deserialize Vectors using the <code>SOAP-ENC</code>
  - * encoding style.<p>
  - *
  - *  @author Rich Scheuerle (scheu@us.ibm.com)
  - */
  -
  -public class VectorSerializer implements Serializer
  -{
  -    protected static Log log =
  -        LogFactory.getLog(VectorSerializer.class.getName());
  -
  -    /** Serialize a Vector
  -     *
  -     * Walk the collection of keys, serializing each key/value pair
  -     * inside an <item> element.
  -     *
  -     * @param name the desired QName for the element
  -     * @param attributes the desired attributes for the element
  -     * @param value the Object to serialize
  -     * @param context the SerializationContext in which to do all this
  -     * @exception IOException
  -     */
  -    public void serialize(QName name, Attributes attributes,
  -                          Object value, SerializationContext context)
  -        throws IOException
  -    {
  -        if (!(value instanceof Vector))
  -            throw new IOException(
  -                JavaUtils.getMessage("noVector00", "VectorSerializer", 
  -                                     value.getClass().getName()));
  -
  -        Vector vector = (Vector)value;
  -
  -        context.startElement(name, attributes);
  -        for (Iterator i = vector.iterator(); i.hasNext(); )
  -        {
  -            Object item = i.next();
  -            context.serialize(Constants.QNAME_LITERAL_ITEM,  null, item, (item!=null ? item.getClass(): null) );
  -        }
  -        context.endElement();
  -    }
  -
  -    public String getMechanismType() { return Constants.AXIS_SAX; }
  -
  -    /**
  -     * Return XML schema for the specified type, suitable for insertion into
  -     * the <types> element of a WSDL document.
  -     *
  -     * @param types the Java2WSDL Types object which holds the context
  -     *              for the WSDL being generated.
  -     * @return true if we wrote a schema, false if we didn't.
  -     * @see org.apache.axis.wsdl.fromJava.Types
  -     */
  -    public boolean writeSchema(Types types) throws Exception {
  -        Element complexType = types.createElement("complexType");
  -        complexType.setAttribute("name", "Vector");
  -        types.writeSchemaElement(types.getWsdlQName(Constants.SOAP_VECTOR),
  -                                 complexType);
  -        Element seq = types.createElement("sequence");
  -        complexType.appendChild(seq);
  -
  -        Element element = types.createElement("element");
  -        element.setAttribute("name", "item");
  -        element.setAttribute("minOccurs", "0");
  -        element.setAttribute("maxOccurs", "unbounded");
  -        element.setAttribute("type", "xsd:anyType");
  -        seq.appendChild(element);
  -
  -        return true;
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.utils.JavaUtils;
  +
  +import java.io.IOException;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.Vector;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
  +
  +/**
  + * A <code>VectorSerializer</code> is be used to serialize and
  + * deserialize Vectors using the <code>SOAP-ENC</code>
  + * encoding style.<p>
  + *
  + *  @author Rich Scheuerle (scheu@us.ibm.com)
  + */
  +
  +public class VectorSerializer implements Serializer
  +{
  +    protected static Log log =
  +        LogFactory.getLog(VectorSerializer.class.getName());
  +
  +    /** Serialize a Vector
  +     *
  +     * Walk the collection of keys, serializing each key/value pair
  +     * inside an <item> element.
  +     *
  +     * @param name the desired QName for the element
  +     * @param attributes the desired attributes for the element
  +     * @param value the Object to serialize
  +     * @param context the SerializationContext in which to do all this
  +     * @exception IOException
  +     */
  +    public void serialize(QName name, Attributes attributes,
  +                          Object value, SerializationContext context)
  +        throws IOException
  +    {
  +        if (!(value instanceof Vector))
  +            throw new IOException(
  +                JavaUtils.getMessage("noVector00", "VectorSerializer", 
  +                                     value.getClass().getName()));
  +
  +        Vector vector = (Vector)value;
  +
  +        context.startElement(name, attributes);
  +        for (Iterator i = vector.iterator(); i.hasNext(); )
  +        {
  +            Object item = i.next();
  +            context.serialize(Constants.QNAME_LITERAL_ITEM,  null, item, (item!=null ? item.getClass(): null) );
  +        }
  +        context.endElement();
  +    }
  +
  +    public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        Element complexType = types.createElement("complexType");
  +        complexType.setAttribute("name", "Vector");
  +        types.writeSchemaElement(types.getWsdlQName(Constants.SOAP_VECTOR),
  +                                 complexType);
  +        Element seq = types.createElement("sequence");
  +        complexType.appendChild(seq);
  +
  +        Element element = types.createElement("element");
  +        element.setAttribute("name", "item");
  +        element.setAttribute("minOccurs", "0");
  +        element.setAttribute("maxOccurs", "unbounded");
  +        element.setAttribute("type", "xsd:anyType");
  +        seq.appendChild(element);
  +
  +        return true;
  +    }
  +}
  
  
  
  1.4       +91 -91    xml-axis/java/src/org/apache/axis/encoding/ser/VectorSerializerFactory.java
  
  Index: VectorSerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/VectorSerializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VectorSerializerFactory.java	30 May 2002 03:06:09 -0000	1.3
  +++ VectorSerializerFactory.java	30 May 2002 23:46:01 -0000	1.4
  @@ -1,91 +1,91 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.encoding.ser;
  -
  -import java.beans.IntrospectionException;
  -import java.io.IOException;
  -import java.lang.reflect.Constructor;
  -import java.lang.reflect.InvocationTargetException;
  -
  -import javax.xml.rpc.JAXRPCException;
  -import javax.xml.rpc.namespace.QName;
  -
  -import org.apache.axis.InternalException;
  -import org.apache.axis.message.SOAPHandler;
  -import org.apache.axis.utils.JavaUtils;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -
  -/**
  - * A VectorSerializer Factory
  - *
  - *  @author Rich Scheuerle (scheu@us.ibm.com)
  - */
  -public class VectorSerializerFactory extends BaseSerializerFactory {
  -
  -    public VectorSerializerFactory(Class javaType, QName xmlType) {
  -        super(VectorSerializer.class, false, xmlType, javaType); 
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.encoding.ser;
  +
  +import java.beans.IntrospectionException;
  +import java.io.IOException;
  +import java.lang.reflect.Constructor;
  +import java.lang.reflect.InvocationTargetException;
  +
  +import javax.xml.rpc.JAXRPCException;
  +import javax.xml.rpc.namespace.QName;
  +
  +import org.apache.axis.InternalException;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +
  +/**
  + * A VectorSerializer Factory
  + *
  + *  @author Rich Scheuerle (scheu@us.ibm.com)
  + */
  +public class VectorSerializerFactory extends BaseSerializerFactory {
  +
  +    public VectorSerializerFactory(Class javaType, QName xmlType) {
  +        super(VectorSerializer.class, false, xmlType, javaType); 
  +    }
  +}
  
  
  
  1.63      +405 -405  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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- SOAPService.java	30 May 2002 03:06:10 -0000	1.62
  +++ SOAPService.java	30 May 2002 23:46:01 -0000	1.63
  @@ -1,405 +1,405 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.handlers.soap;
  -
  -import org.apache.axis.AxisEngine;
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.Constants;
  -import org.apache.axis.Handler;
  -import org.apache.axis.Message;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.SimpleTargetedChain;
  -import org.apache.axis.description.ServiceDesc;
  -import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.TypeMappingRegistryImpl;
  -import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
  -import org.apache.axis.providers.java.JavaProvider;
  -import org.apache.axis.handlers.BasicHandler;
  -import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeaderElement;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.LockableHashtable;
  -import org.apache.axis.utils.XMLUtils;
  -import org.apache.axis.utils.cache.ClassCache;
  -import org.apache.axis.utils.cache.JavaClass;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.w3c.dom.Document;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.FileInputStream;
  -import java.util.ArrayList;
  -import java.util.Enumeration;
  -import java.util.Hashtable;
  -import java.util.Vector;
  -
  -/** A <code>SOAPService</code> is a Handler which encapsulates a SOAP
  - * invocation.  It has an request chain, an response chain, and a pivot-point,
  - * and handles the SOAP semantics when invoke()d.
  - *
  - * @author Glen Daniels (gdaniels@macromedia.com)
  - * @author Doug Davis (dug@us.ibm.com)
  - */
  -public class SOAPService extends SimpleTargetedChain
  -{
  -    protected static Log log =
  -        LogFactory.getLog(SOAPService.class.getName());
  -
  -    /** Valid transports for this service
  -     * (server side only!)
  -     *
  -     * !!! For now, if this is null, we assume all
  -     * transports are valid.
  -     */
  -    private Vector validTransports = null;
  -
  -    /** Service-specific type mappings
  -     */
  -    private TypeMappingRegistry tmr;
  -
  -    /**
  -     * Does this service require a high-fidelity SAX recording of messages?
  -     * (default is true)
  -     */
  -    private boolean highFidelityRecording = true;
  -
  -    /**
  -     * Our ServiceDescription.  Holds pretty much all the interesting
  -     * metadata about this service.
  -     */
  -    private ServiceDesc serviceDescription = new ServiceDesc();
  -    private AxisEngine engine;
  -
  -    /**
  -     * SOAPRequestHandler is used to inject SOAP semantics just before
  -     * the pivot handler.
  -     */
  -    private class SOAPRequestHandler extends BasicHandler {
  -        public SOAPRequestHandler() {}
  -
  -        public void invoke(MessageContext msgContext) throws AxisFault {
  -            // Do SOAP semantics here
  -            if (this.log.isDebugEnabled()) {
  -                this.log.debug( JavaUtils.getMessage("semanticCheck00"));
  -            }
  -
  -            // This needs to be set to the merged list of service-specific and
  -            // enigne-wide actors we should be acting as.
  -            ArrayList actors = msgContext.getAxisEngine().getActorURIs();
  -
  -            // 1. Check mustUnderstands
  -            SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
  -            Vector headers = env.getHeadersByActor(actors);
  -            Vector misunderstoodHeaders = null;
  -            Enumeration enum = headers.elements();
  -            while (enum.hasMoreElements()) {
  -                SOAPHeaderElement header = (SOAPHeaderElement)enum.
  -                                               nextElement();
  -                if (header.getMustUnderstand() && !header.isProcessed()) {
  -                    if (misunderstoodHeaders == null)
  -                        misunderstoodHeaders = new Vector();
  -                    misunderstoodHeaders.addElement(header);
  -                }
  -            }
  -
  -            // !!! we should indicate SOAP1.2 compliance via the
  -            // MessageContext, not a boolean here....
  -            boolean doMisunderstoodHeaders = true;
  -
  -            if (misunderstoodHeaders != null) {
  -                // !!! If SOAP 1.2, insert misunderstood fault header here
  -                if (doMisunderstoodHeaders) {
  -                    Message respMsg = msgContext.getResponseMessage();
  -                    if (respMsg == null) {
  -                        respMsg = new Message(new SOAPEnvelope());
  -                        msgContext.setResponseMessage(respMsg);
  -                    }
  -                    env = respMsg.getSOAPEnvelope();
  -                    enum = misunderstoodHeaders.elements();
  -                    while (enum.hasMoreElements()) {
  -                        SOAPHeaderElement badHeader = (SOAPHeaderElement)enum.
  -                                                          nextElement();
  -                        QName badQName = new QName(badHeader.getNamespaceURI(),
  -                                                   badHeader.getName());
  -                        SOAPHeaderElement newHeader = new 
  -                            SOAPHeaderElement(Constants.NS_URI_SOAP12_FAULT_NS,
  -                                              Constants.ELEM_MISUNDERSTOOD);
  -                        newHeader.addAttribute(null,
  -                                               Constants.ATTR_QNAME,
  -                                               badQName);
  -
  -                        env.addHeader(newHeader);
  -                    }
  -                }
  -
  -                throw new AxisFault(Constants.FAULT_MUSTUNDERSTAND,
  -                                    JavaUtils.getMessage("noUnderstand00"),
  -                                    null, null);
  -            }
  -        }
  -    }
  -
  -    /** Standard, no-arg constructor.
  -     */
  -    public SOAPService()
  -    {
  -        initHashtable(true);
  -        initTypeMappingRegistry();
  -    }
  -
  -    /** Constructor with real or null request, pivot, and response
  -     *  handlers. A special request handler is specified to inject
  -     *  SOAP semantics.
  -     */
  -    public SOAPService(Handler reqHandler, Handler pivHandler,
  -                       Handler respHandler) {
  -        this();
  -        init(reqHandler, new SOAPRequestHandler(), pivHandler, null, respHandler);
  -    }
  -
  -    private void initTypeMappingRegistry() {
  -        tmr = new TypeMappingRegistryImpl();
  -    }
  -    
  -    public TypeMappingRegistry getTypeMappingRegistry()
  -    {
  -        return tmr;
  -    }
  -    
  -    public void setTypeMappingRegistry(TypeMappingRegistry map)
  -    {
  -        tmr = map;
  -    }
  -    
  -    /** Convenience constructor for wrapping SOAP semantics around
  -     * "service handlers" which actually do work.
  -     */
  -    public SOAPService(Handler serviceHandler)
  -    {
  -        init(null, new SOAPRequestHandler(), serviceHandler, null, null);
  -        initTypeMappingRegistry();
  -    }
  -    
  -    /** Tell this service which engine it's deployed to.
  -     *
  -     */
  -    public void setEngine(AxisEngine engine)
  -    {
  -        this.engine = engine;
  -        if (engine != null)
  -            tmr.delegate(engine.getTypeMappingRegistry());
  -    }
  -
  -    public boolean availableFromTransport(String transportName)
  -    {
  -        if (validTransports != null) {
  -            for (int i = 0; i < validTransports.size(); i++) {
  -                if (((String)validTransports.elementAt(i)).
  -                                                 equals(transportName))
  -                    return true;
  -            }
  -            return false;
  -        }
  -        
  -        return true;
  -    }
  -
  -    public int getStyle() {
  -        return serviceDescription.getStyle();
  -    }
  -
  -    public void setStyle(int style) {
  -        serviceDescription.setStyle(style);
  -    }
  -
  -    public ServiceDesc getServiceDescription() {
  -        return serviceDescription;
  -    }
  -
  -    public synchronized ServiceDesc getInitializedServiceDesc(MessageContext msgContext) {
  -        if (serviceDescription.getImplClass() == null) {
  -            String clsName = (String)getOption(JavaProvider.OPTION_CLASSNAME);
  -
  -            if (clsName != null) {
  -                ClassLoader cl = null;
  -                if (msgContext == null) {
  -                    cl = Thread.currentThread().getContextClassLoader();
  -                } else {
  -                    cl = msgContext.getClassLoader();
  -                }
  -                if (engine != null) {
  -                    ClassCache cache     = engine.getClassCache();
  -                    JavaClass       jc   = null;
  -                    try {
  -                        jc = cache.lookup(clsName, cl);
  -                        serviceDescription.setImplClass(jc.getJavaClass());
  -                    } catch (ClassNotFoundException e) {
  -                        log.error(JavaUtils.getMessage("exception00"), e);
  -                        return null;
  -                    }
  -                } else {
  -                    try {
  -                        Class cls = cl.loadClass(clsName);
  -                        serviceDescription.setImplClass(cls);
  -                    } catch (ClassNotFoundException e) {
  -                        log.error(JavaUtils.getMessage("exception00"), e);
  -                        return null; // FIXME - throw?
  -                    }
  -                }
  -                TypeMapping tm;
  -                if (msgContext == null) {
  -                    tm = DefaultTypeMappingImpl.getSingleton();
  -                } else {
  -                    tm = msgContext.getTypeMapping();
  -                }
  -                serviceDescription.setTypeMapping(tm);
  -            }
  -        }
  -        return serviceDescription;
  -    }
  -
  -    public void setServiceDescription(ServiceDesc serviceDescription) {
  -        if (serviceDescription == null) {
  -            // FIXME: Throw NPE?
  -            return;
  -        }
  -        this.serviceDescription = serviceDescription;
  -    }
  -
  -    public void setPropertyParent(Hashtable parent)
  -    {
  -        if (options == null) {
  -            options = new LockableHashtable();
  -        }
  -        ((LockableHashtable)options).setParent(parent);
  -    }
  -
  -    /**
  -     * Generate WSDL.  If we have a specific file configured in the
  -     * ServiceDesc, just return that.  Otherwise run through all the Handlers
  -     * (including the provider) and call generateWSDL() on them via our
  -     * parent's implementation.
  -     */
  -    public void generateWSDL(MessageContext msgContext) throws AxisFault {
  -        if (serviceDescription == null ||
  -                serviceDescription.getWSDLFile() == null) {
  -            super.generateWSDL(msgContext);
  -            return;
  -        }
  -
  -        // Got a WSDL file in the service description, so try and read it
  -        try {
  -            Document doc = XMLUtils.newDocument(
  -                    new FileInputStream(serviceDescription.getWSDLFile()));
  -            msgContext.setProperty("WSDL", doc);
  -        } catch (Exception e) {
  -            throw AxisFault.makeFault(e);
  -        }
  -    }
  -    /*********************************************************************
  -     * Administration and management APIs
  -     *
  -     * These can get called by various admin adapters, such as JMX MBeans,
  -     * our own Admin client, web applications, etc...
  -     *
  -     *********************************************************************
  -     */
  -    
  -    /** Placeholder for "enable this service" method
  -     */
  -    public void start()
  -    {
  -    }
  -    
  -    /** Placeholder for "disable this service" method
  -     */
  -    public void stop()
  -    {
  -    }
  -    
  -    /**
  -     * Make this service available on a particular transport
  -     */
  -    public void enableTransport(String transportName)
  -    {
  -        if (log.isDebugEnabled()) {
  -            log.debug(JavaUtils.getMessage(
  -                "enableTransport00", "" + this, transportName));
  -        }
  -
  -        if (validTransports == null)
  -            validTransports = new Vector();
  -        validTransports.addElement(transportName);
  -    }
  -    
  -    /**
  -     * Disable access to this service from a particular transport
  -     */
  -    public void disableTransport(String transportName)
  -    {
  -        if (validTransports != null) {
  -            validTransports.removeElement(transportName);
  -        }
  -    }
  -
  -    public boolean needsHighFidelityRecording() {
  -        return highFidelityRecording;
  -    }
  -
  -    public void setHighFidelityRecording(boolean highFidelityRecording) {
  -        this.highFidelityRecording = highFidelityRecording;
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.handlers.soap;
  +
  +import org.apache.axis.AxisEngine;
  +import org.apache.axis.AxisFault;
  +import org.apache.axis.Constants;
  +import org.apache.axis.Handler;
  +import org.apache.axis.Message;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.SimpleTargetedChain;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMappingRegistryImpl;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.DefaultTypeMappingImpl;
  +import org.apache.axis.providers.java.JavaProvider;
  +import org.apache.axis.handlers.BasicHandler;
  +import org.apache.axis.message.SOAPEnvelope;
  +import org.apache.axis.message.SOAPHeaderElement;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.utils.LockableHashtable;
  +import org.apache.axis.utils.XMLUtils;
  +import org.apache.axis.utils.cache.ClassCache;
  +import org.apache.axis.utils.cache.JavaClass;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.w3c.dom.Document;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.FileInputStream;
  +import java.util.ArrayList;
  +import java.util.Enumeration;
  +import java.util.Hashtable;
  +import java.util.Vector;
  +
  +/** A <code>SOAPService</code> is a Handler which encapsulates a SOAP
  + * invocation.  It has an request chain, an response chain, and a pivot-point,
  + * and handles the SOAP semantics when invoke()d.
  + *
  + * @author Glen Daniels (gdaniels@macromedia.com)
  + * @author Doug Davis (dug@us.ibm.com)
  + */
  +public class SOAPService extends SimpleTargetedChain
  +{
  +    protected static Log log =
  +        LogFactory.getLog(SOAPService.class.getName());
  +
  +    /** Valid transports for this service
  +     * (server side only!)
  +     *
  +     * !!! For now, if this is null, we assume all
  +     * transports are valid.
  +     */
  +    private Vector validTransports = null;
  +
  +    /** Service-specific type mappings
  +     */
  +    private TypeMappingRegistry tmr;
  +
  +    /**
  +     * Does this service require a high-fidelity SAX recording of messages?
  +     * (default is true)
  +     */
  +    private boolean highFidelityRecording = true;
  +
  +    /**
  +     * Our ServiceDescription.  Holds pretty much all the interesting
  +     * metadata about this service.
  +     */
  +    private ServiceDesc serviceDescription = new ServiceDesc();
  +    private AxisEngine engine;
  +
  +    /**
  +     * SOAPRequestHandler is used to inject SOAP semantics just before
  +     * the pivot handler.
  +     */
  +    private class SOAPRequestHandler extends BasicHandler {
  +        public SOAPRequestHandler() {}
  +
  +        public void invoke(MessageContext msgContext) throws AxisFault {
  +            // Do SOAP semantics here
  +            if (this.log.isDebugEnabled()) {
  +                this.log.debug( JavaUtils.getMessage("semanticCheck00"));
  +            }
  +
  +            // This needs to be set to the merged list of service-specific and
  +            // enigne-wide actors we should be acting as.
  +            ArrayList actors = msgContext.getAxisEngine().getActorURIs();
  +
  +            // 1. Check mustUnderstands
  +            SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
  +            Vector headers = env.getHeadersByActor(actors);
  +            Vector misunderstoodHeaders = null;
  +            Enumeration enum = headers.elements();
  +            while (enum.hasMoreElements()) {
  +                SOAPHeaderElement header = (SOAPHeaderElement)enum.
  +                                               nextElement();
  +                if (header.getMustUnderstand() && !header.isProcessed()) {
  +                    if (misunderstoodHeaders == null)
  +                        misunderstoodHeaders = new Vector();
  +                    misunderstoodHeaders.addElement(header);
  +                }
  +            }
  +
  +            // !!! we should indicate SOAP1.2 compliance via the
  +            // MessageContext, not a boolean here....
  +            boolean doMisunderstoodHeaders = true;
  +
  +            if (misunderstoodHeaders != null) {
  +                // !!! If SOAP 1.2, insert misunderstood fault header here
  +                if (doMisunderstoodHeaders) {
  +                    Message respMsg = msgContext.getResponseMessage();
  +                    if (respMsg == null) {
  +                        respMsg = new Message(new SOAPEnvelope());
  +                        msgContext.setResponseMessage(respMsg);
  +                    }
  +                    env = respMsg.getSOAPEnvelope();
  +                    enum = misunderstoodHeaders.elements();
  +                    while (enum.hasMoreElements()) {
  +                        SOAPHeaderElement badHeader = (SOAPHeaderElement)enum.
  +                                                          nextElement();
  +                        QName badQName = new QName(badHeader.getNamespaceURI(),
  +                                                   badHeader.getName());
  +                        SOAPHeaderElement newHeader = new 
  +                            SOAPHeaderElement(Constants.NS_URI_SOAP12_FAULT_NS,
  +                                              Constants.ELEM_MISUNDERSTOOD);
  +                        newHeader.addAttribute(null,
  +                                               Constants.ATTR_QNAME,
  +                                               badQName);
  +
  +                        env.addHeader(newHeader);
  +                    }
  +                }
  +
  +                throw new AxisFault(Constants.FAULT_MUSTUNDERSTAND,
  +                                    JavaUtils.getMessage("noUnderstand00"),
  +                                    null, null);
  +            }
  +        }
  +    }
  +
  +    /** Standard, no-arg constructor.
  +     */
  +    public SOAPService()
  +    {
  +        initHashtable(true);
  +        initTypeMappingRegistry();
  +    }
  +
  +    /** Constructor with real or null request, pivot, and response
  +     *  handlers. A special request handler is specified to inject
  +     *  SOAP semantics.
  +     */
  +    public SOAPService(Handler reqHandler, Handler pivHandler,
  +                       Handler respHandler) {
  +        this();
  +        init(reqHandler, new SOAPRequestHandler(), pivHandler, null, respHandler);
  +    }
  +
  +    private void initTypeMappingRegistry() {
  +        tmr = new TypeMappingRegistryImpl();
  +    }
  +    
  +    public TypeMappingRegistry getTypeMappingRegistry()
  +    {
  +        return tmr;
  +    }
  +    
  +    public void setTypeMappingRegistry(TypeMappingRegistry map)
  +    {
  +        tmr = map;
  +    }
  +    
  +    /** Convenience constructor for wrapping SOAP semantics around
  +     * "service handlers" which actually do work.
  +     */
  +    public SOAPService(Handler serviceHandler)
  +    {
  +        init(null, new SOAPRequestHandler(), serviceHandler, null, null);
  +        initTypeMappingRegistry();
  +    }
  +    
  +    /** Tell this service which engine it's deployed to.
  +     *
  +     */
  +    public void setEngine(AxisEngine engine)
  +    {
  +        this.engine = engine;
  +        if (engine != null)
  +            tmr.delegate(engine.getTypeMappingRegistry());
  +    }
  +
  +    public boolean availableFromTransport(String transportName)
  +    {
  +        if (validTransports != null) {
  +            for (int i = 0; i < validTransports.size(); i++) {
  +                if (((String)validTransports.elementAt(i)).
  +                                                 equals(transportName))
  +                    return true;
  +            }
  +            return false;
  +        }
  +        
  +        return true;
  +    }
  +
  +    public int getStyle() {
  +        return serviceDescription.getStyle();
  +    }
  +
  +    public void setStyle(int style) {
  +        serviceDescription.setStyle(style);
  +    }
  +
  +    public ServiceDesc getServiceDescription() {
  +        return serviceDescription;
  +    }
  +
  +    public synchronized ServiceDesc getInitializedServiceDesc(MessageContext msgContext) {
  +        if (serviceDescription.getImplClass() == null) {
  +            String clsName = (String)getOption(JavaProvider.OPTION_CLASSNAME);
  +
  +            if (clsName != null) {
  +                ClassLoader cl = null;
  +                if (msgContext == null) {
  +                    cl = Thread.currentThread().getContextClassLoader();
  +                } else {
  +                    cl = msgContext.getClassLoader();
  +                }
  +                if (engine != null) {
  +                    ClassCache cache     = engine.getClassCache();
  +                    JavaClass       jc   = null;
  +                    try {
  +                        jc = cache.lookup(clsName, cl);
  +                        serviceDescription.setImplClass(jc.getJavaClass());
  +                    } catch (ClassNotFoundException e) {
  +                        log.error(JavaUtils.getMessage("exception00"), e);
  +                        return null;
  +                    }
  +                } else {
  +                    try {
  +                        Class cls = cl.loadClass(clsName);
  +                        serviceDescription.setImplClass(cls);
  +                    } catch (ClassNotFoundException e) {
  +                        log.error(JavaUtils.getMessage("exception00"), e);
  +                        return null; // FIXME - throw?
  +                    }
  +                }
  +                TypeMapping tm;
  +                if (msgContext == null) {
  +                    tm = DefaultTypeMappingImpl.getSingleton();
  +                } else {
  +                    tm = msgContext.getTypeMapping();
  +                }
  +                serviceDescription.setTypeMapping(tm);
  +            }
  +        }
  +        return serviceDescription;
  +    }
  +
  +    public void setServiceDescription(ServiceDesc serviceDescription) {
  +        if (serviceDescription == null) {
  +            // FIXME: Throw NPE?
  +            return;
  +        }
  +        this.serviceDescription = serviceDescription;
  +    }
  +
  +    public void setPropertyParent(Hashtable parent)
  +    {
  +        if (options == null) {
  +            options = new LockableHashtable();
  +        }
  +        ((LockableHashtable)options).setParent(parent);
  +    }
  +
  +    /**
  +     * Generate WSDL.  If we have a specific file configured in the
  +     * ServiceDesc, just return that.  Otherwise run through all the Handlers
  +     * (including the provider) and call generateWSDL() on them via our
  +     * parent's implementation.
  +     */
  +    public void generateWSDL(MessageContext msgContext) throws AxisFault {
  +        if (serviceDescription == null ||
  +                serviceDescription.getWSDLFile() == null) {
  +            super.generateWSDL(msgContext);
  +            return;
  +        }
  +
  +        // Got a WSDL file in the service description, so try and read it
  +        try {
  +            Document doc = XMLUtils.newDocument(
  +                    new FileInputStream(serviceDescription.getWSDLFile()));
  +            msgContext.setProperty("WSDL", doc);
  +        } catch (Exception e) {
  +            throw AxisFault.makeFault(e);
  +        }
  +    }
  +    /*********************************************************************
  +     * Administration and management APIs
  +     *
  +     * These can get called by various admin adapters, such as JMX MBeans,
  +     * our own Admin client, web applications, etc...
  +     *
  +     *********************************************************************
  +     */
  +    
  +    /** Placeholder for "enable this service" method
  +     */
  +    public void start()
  +    {
  +    }
  +    
  +    /** Placeholder for "disable this service" method
  +     */
  +    public void stop()
  +    {
  +    }
  +    
  +    /**
  +     * Make this service available on a particular transport
  +     */
  +    public void enableTransport(String transportName)
  +    {
  +        if (log.isDebugEnabled()) {
  +            log.debug(JavaUtils.getMessage(
  +                "enableTransport00", "" + this, transportName));
  +        }
  +
  +        if (validTransports == null)
  +            validTransports = new Vector();
  +        validTransports.addElement(transportName);
  +    }
  +    
  +    /**
  +     * Disable access to this service from a particular transport
  +     */
  +    public void disableTransport(String transportName)
  +    {
  +        if (validTransports != null) {
  +            validTransports.removeElement(transportName);
  +        }
  +    }
  +
  +    public boolean needsHighFidelityRecording() {
  +        return highFidelityRecording;
  +    }
  +
  +    public void setHighFidelityRecording(boolean highFidelityRecording) {
  +        this.highFidelityRecording = highFidelityRecording;
  +    }
  +}
  
  
  
  1.21      +183 -183  xml-axis/java/src/org/apache/axis/message/EnvelopeBuilder.java
  
  Index: EnvelopeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/EnvelopeBuilder.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- EnvelopeBuilder.java	30 May 2002 03:06:10 -0000	1.20
  +++ EnvelopeBuilder.java	30 May 2002 23:46:02 -0000	1.21
  @@ -1,183 +1,183 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.message;
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.soap.SOAPConstants;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.utils.JavaUtils;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -
  -/**
  - * The EnvelopeBuilder is responsible for parsing the top-level
  - * SOAP envelope stuff (Envelope, Body, Header), and spawning off
  - * HeaderBuilder and BodyBuilders.
  - *
  - * @author Glen Daniels (gdaniels@allaire.com)
  - */
  -public class EnvelopeBuilder extends SOAPHandler
  -{
  -    private SOAPEnvelope envelope;
  -    private SOAPConstants soapConstants = SOAPConstants.SOAP11_CONSTANTS;
  -
  -    private boolean gotHeader = false;
  -    private boolean gotBody = false;
  -
  -    public EnvelopeBuilder(String messageType, SOAPConstants soapConstants)
  -    {
  -        envelope = new SOAPEnvelope(false, soapConstants);
  -        envelope.setMessageType(messageType);
  -        myElement = envelope;
  -    }
  -    
  -    public EnvelopeBuilder(SOAPEnvelope env, String messageType)
  -    {
  -        envelope = env ;
  -        envelope.setMessageType(messageType);
  -        myElement = envelope;
  -    }
  -    
  -    public SOAPEnvelope getEnvelope()
  -    {
  -        return envelope;
  -    }
  -    
  -    public void startElement(String namespace, String localName,
  -                             String qName, Attributes attributes,
  -                             DeserializationContext context)
  -        throws SAXException
  -    {
  -        if (!localName.equals(Constants.ELEM_ENVELOPE))
  -            throw new SAXException(
  -                    JavaUtils.getMessage("badTag00", localName));
  -
  -        if (namespace.equals(Constants.NS_URI_SOAP_ENV)) {
  -            // SOAP 1.1
  -            soapConstants = SOAPConstants.SOAP11_CONSTANTS;
  -        } else if (namespace.equals(Constants.NS_URI_SOAP12_ENV)) {
  -            // SOAP 1.2
  -            soapConstants = SOAPConstants.SOAP12_CONSTANTS;
  -        } else {
  -            throw new SAXException(
  -                    JavaUtils.getMessage("badNamespace00", namespace));
  -        }
  -
  -        // Indicate what version of SOAP we're using to anyone else involved
  -        // in processing this message.
  -        context.getMessageContext().setSOAPConstants(soapConstants);
  -
  -        String prefix = "";
  -        int idx = qName.indexOf(":");
  -        if (idx > 0)
  -            prefix = qName.substring(0, idx);
  -
  -        envelope.setPrefix(prefix);
  -        envelope.setNamespaceURI(namespace);
  -        envelope.setNSMappings(context.getCurrentNSMappings());
  -        context.pushNewElement(envelope);
  -    }
  -    
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        QName thisQName = new QName(namespace, localName);
  -        if (thisQName.equals(soapConstants.getHeaderQName())) {
  -            if (gotHeader)
  -                throw new SAXException(JavaUtils.getMessage("only1Header00"));
  -            
  -            gotHeader = true;
  -            return new HeaderBuilder(envelope);
  -        }
  -        
  -        if (thisQName.equals(soapConstants.getBodyQName())) {
  -            if (gotBody)
  -                throw new SAXException(JavaUtils.getMessage("only1Body00"));
  -            
  -            gotBody = true;
  -            return new BodyBuilder(envelope);
  -        }
  -        
  -        if (!gotBody)
  -            throw new SAXException(JavaUtils.getMessage("noCustomElems00"));
  -
  -        MessageElement element = new MessageElement(namespace, localName, prefix,
  -                                     attributes, context);
  -        
  -        if (element.getFixupDeserializer() != null)
  -            return (SOAPHandler)element.getFixupDeserializer();
  -
  -        return null;
  -    }
  -    
  -    public void onEndChild(String namespace, String localName,
  -                           DeserializationContext context)
  -    {
  -    }
  -
  -    public void endElement(String namespace, String localName,
  -                           DeserializationContext context)
  -        throws SAXException
  -    {
  -        // Envelope isn't dirty yet by default...
  -        envelope.setDirty(false);
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.message;
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.soap.SOAPConstants;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.utils.JavaUtils;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +
  +/**
  + * The EnvelopeBuilder is responsible for parsing the top-level
  + * SOAP envelope stuff (Envelope, Body, Header), and spawning off
  + * HeaderBuilder and BodyBuilders.
  + *
  + * @author Glen Daniels (gdaniels@allaire.com)
  + */
  +public class EnvelopeBuilder extends SOAPHandler
  +{
  +    private SOAPEnvelope envelope;
  +    private SOAPConstants soapConstants = SOAPConstants.SOAP11_CONSTANTS;
  +
  +    private boolean gotHeader = false;
  +    private boolean gotBody = false;
  +
  +    public EnvelopeBuilder(String messageType, SOAPConstants soapConstants)
  +    {
  +        envelope = new SOAPEnvelope(false, soapConstants);
  +        envelope.setMessageType(messageType);
  +        myElement = envelope;
  +    }
  +    
  +    public EnvelopeBuilder(SOAPEnvelope env, String messageType)
  +    {
  +        envelope = env ;
  +        envelope.setMessageType(messageType);
  +        myElement = envelope;
  +    }
  +    
  +    public SOAPEnvelope getEnvelope()
  +    {
  +        return envelope;
  +    }
  +    
  +    public void startElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        if (!localName.equals(Constants.ELEM_ENVELOPE))
  +            throw new SAXException(
  +                    JavaUtils.getMessage("badTag00", localName));
  +
  +        if (namespace.equals(Constants.NS_URI_SOAP_ENV)) {
  +            // SOAP 1.1
  +            soapConstants = SOAPConstants.SOAP11_CONSTANTS;
  +        } else if (namespace.equals(Constants.NS_URI_SOAP12_ENV)) {
  +            // SOAP 1.2
  +            soapConstants = SOAPConstants.SOAP12_CONSTANTS;
  +        } else {
  +            throw new SAXException(
  +                    JavaUtils.getMessage("badNamespace00", namespace));
  +        }
  +
  +        // Indicate what version of SOAP we're using to anyone else involved
  +        // in processing this message.
  +        context.getMessageContext().setSOAPConstants(soapConstants);
  +
  +        String prefix = "";
  +        int idx = qName.indexOf(":");
  +        if (idx > 0)
  +            prefix = qName.substring(0, idx);
  +
  +        envelope.setPrefix(prefix);
  +        envelope.setNamespaceURI(namespace);
  +        envelope.setNSMappings(context.getCurrentNSMappings());
  +        context.pushNewElement(envelope);
  +    }
  +    
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException
  +    {
  +        QName thisQName = new QName(namespace, localName);
  +        if (thisQName.equals(soapConstants.getHeaderQName())) {
  +            if (gotHeader)
  +                throw new SAXException(JavaUtils.getMessage("only1Header00"));
  +            
  +            gotHeader = true;
  +            return new HeaderBuilder(envelope);
  +        }
  +        
  +        if (thisQName.equals(soapConstants.getBodyQName())) {
  +            if (gotBody)
  +                throw new SAXException(JavaUtils.getMessage("only1Body00"));
  +            
  +            gotBody = true;
  +            return new BodyBuilder(envelope);
  +        }
  +        
  +        if (!gotBody)
  +            throw new SAXException(JavaUtils.getMessage("noCustomElems00"));
  +
  +        MessageElement element = new MessageElement(namespace, localName, prefix,
  +                                     attributes, context);
  +        
  +        if (element.getFixupDeserializer() != null)
  +            return (SOAPHandler)element.getFixupDeserializer();
  +
  +        return null;
  +    }
  +    
  +    public void onEndChild(String namespace, String localName,
  +                           DeserializationContext context)
  +    {
  +    }
  +
  +    public void endElement(String namespace, String localName,
  +                           DeserializationContext context)
  +        throws SAXException
  +    {
  +        // Envelope isn't dirty yet by default...
  +        envelope.setDirty(false);
  +    }
  +}
  
  
  
  1.42      +257 -257  xml-axis/java/src/org/apache/axis/message/RPCHandler.java
  
  Index: RPCHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCHandler.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- RPCHandler.java	30 May 2002 03:06:11 -0000	1.41
  +++ RPCHandler.java	30 May 2002 23:46:02 -0000	1.42
  @@ -1,257 +1,257 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.message;
  -
  -/**
  - * 
  - * @author Glen Daniels (gdaniels@allaire.com)
  - */
  -
  -import org.apache.axis.Constants;
  -import org.apache.axis.description.OperationDesc;
  -import org.apache.axis.description.ParameterDesc;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.FieldTarget;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.util.Vector;
  -
  -/**
  - * This is the SOAPHandler which is called for each RPC parameter as we're
  - * deserializing the XML for a method call or return.  In other words for
  - * this XML:
  - *
  - * <methodName>
  - *   <param1 xsi:type="xsd:string">Hello!</param1>
  - *   <param2>3.14159</param2>
  - * </methodName>
  - *
  - * ...we'll get onStartChild() events for <param1> and <param2>.
  - *
  - * @author Glen Daniels (gdaniels@apache.org)
  - */
  -public class RPCHandler extends SOAPHandler
  -{
  -    protected static Log log =
  -        LogFactory.getLog(RPCHandler.class.getName());
  -    
  -    private RPCElement rpcElem;
  -    private RPCParam currentParam;
  -    private boolean isResponse;
  -    private OperationDesc operation;
  -
  -    public RPCHandler(RPCElement rpcElem, boolean isResponse)
  -        throws SAXException
  -    {
  -        this.rpcElem = rpcElem;
  -        this.isResponse = isResponse;
  -    }
  -
  -    public void setOperation(OperationDesc myOperation) {
  -        this.operation = myOperation;
  -    }
  -
  -    /**
  -     * Register the start of a parameter (child element of the method call
  -     * element).
  -     *
  -     * Our job here is to figure out a) which parameter this is (based on
  -     * the QName of the element or its position), and b) what type it is
  -     * (based on the xsi:type attribute or operation metadata) so we can
  -     * successfully deserialize it.
  -     */
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        if (log.isDebugEnabled()) {
  -            log.debug("Enter: RPCHandler.onStartChild()");
  -        }
  -
  -        if (!context.isDoneParsing()) {
  -            context.pushNewElement(new MessageElement(namespace,
  -            localName, prefix+":"+localName,attributes,context));
  -        }
  -
  -        Vector params = rpcElem.getParams();
  -        
  -        // This is a param.
  -        currentParam = new RPCParam(namespace, localName, null);
  -        rpcElem.addParam(currentParam);
  -        
  -        MessageElement curEl = context.getCurElement();
  -        QName type = null;
  -        QName qname = new QName(namespace, localName);
  -        ParameterDesc paramDesc = null;
  -
  -        // Grab xsi:type attribute if present, on either this element or
  -        // the referent (if it's an href).
  -        if (curEl.getHref() != null) {
  -            MessageElement ref = context.getElementByID(curEl.getHref());
  -            if (ref != null)
  -                type = context.getTypeFromAttributes(ref.getNamespaceURI(),
  -                                                     ref.getName(),
  -                                                     ref.getAttributes());
  -        } else {
  -            // Get the element type if we have it, otherwise check xsi:type
  -            type = curEl.getType();
  -            if (type == null) {
  -                type = context.getTypeFromAttributes(namespace,
  -                                                     localName,
  -                                                     attributes);
  -            }
  -        }
  -
  -        if (log.isDebugEnabled()) {
  -            log.debug(JavaUtils.getMessage("typeFromAttr00", "" + type));
  -        }
  -
  -        // If we have an operation descriptor, try to associate this parameter
  -        // with the appropriate ParameterDesc
  -        if (operation != null) {
  -            // Try by name first
  -            if (isResponse) {
  -                paramDesc = operation.getOutputParamByQName(qname);
  -            } else {
  -                paramDesc = operation.getInputParamByQName(qname);
  -            }
  -
  -            // If that didn't work, try position
  -            // FIXME : Do we need to be in EITHER named OR positional
  -            //         mode?  I.e. will it screw us up to find something
  -            //         by position if we've already looked something up
  -            //         by name?  I think so...
  -            if (paramDesc == null) {
  -                paramDesc = operation.getParameter(params.size() - 1);
  -            }
  -
  -            if (paramDesc != null) {
  -                // Keep the association so we can use it later
  -                // (see RPCProvider.processMessage())
  -                currentParam.setParamDesc(paramDesc);
  -
  -                if (type == null) {
  -                    type = paramDesc.getTypeQName();
  -                } else if (paramDesc.getJavaType() != null) {
  -                    // If we have an xsi:type, make sure it makes sense
  -                    // with the current paramDesc type
  -                    Class xsiClass = 
  -                            context.getTypeMapping().getClassForQName(type);
  -                    if (!JavaUtils.isConvertable(xsiClass,
  -                                                 paramDesc.getJavaType())) {
  -                        throw new SAXException("Bad types (" +
  -                            xsiClass + " -> " + paramDesc.getJavaType() + ")"); // FIXME!
  -                    }
  -                }
  -            }
  -        }
  -
  -
  -        String isNil = attributes.getValue(Constants.NS_URI_2001_SCHEMA_XSI,
  -                                           "nil");
  -
  -        if ( isNil != null && isNil.equals("true") )
  -          return( new DeserializerImpl() );
  -        
  -        Deserializer dser = null;
  -        if ((type == null) && (namespace != null) && (!namespace.equals(""))) {
  -            dser = context.getDeserializerForType(qname);
  -        }
  -        if (dser == null) {
  -          if (type != null) {
  -              dser = context.getDeserializerForType(type);
  -          } else {
  -              dser = new DeserializerImpl();
  -          }
  -        }
  -
  -        if (dser == null) {
  -            throw new SAXException(JavaUtils.getMessage(
  -                    "noDeser01", localName,"" + type));
  -        }
  -
  -        dser.registerValueTarget(
  -             new FieldTarget(currentParam,
  -                 RPCParam.getValueField()));
  -
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: RPCHandler.onStartChild()");
  -        }
  -        return (SOAPHandler)dser;
  -    }
  -
  -    public void endElement(String namespace, String localName,
  -                           DeserializationContext context)
  -        throws SAXException
  -    {
  -        if (log.isDebugEnabled()) {
  -            log.debug(JavaUtils.getMessage("setProp00",
  -                    "MessageContext", "RPCHandler.endElement()."));
  -        }
  -        context.getMessageContext().setProperty("RPC", rpcElem);
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.message;
  +
  +/**
  + * 
  + * @author Glen Daniels (gdaniels@allaire.com)
  + */
  +
  +import org.apache.axis.Constants;
  +import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ParameterDesc;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.FieldTarget;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.util.Vector;
  +
  +/**
  + * This is the SOAPHandler which is called for each RPC parameter as we're
  + * deserializing the XML for a method call or return.  In other words for
  + * this XML:
  + *
  + * <methodName>
  + *   <param1 xsi:type="xsd:string">Hello!</param1>
  + *   <param2>3.14159</param2>
  + * </methodName>
  + *
  + * ...we'll get onStartChild() events for <param1> and <param2>.
  + *
  + * @author Glen Daniels (gdaniels@apache.org)
  + */
  +public class RPCHandler extends SOAPHandler
  +{
  +    protected static Log log =
  +        LogFactory.getLog(RPCHandler.class.getName());
  +    
  +    private RPCElement rpcElem;
  +    private RPCParam currentParam;
  +    private boolean isResponse;
  +    private OperationDesc operation;
  +
  +    public RPCHandler(RPCElement rpcElem, boolean isResponse)
  +        throws SAXException
  +    {
  +        this.rpcElem = rpcElem;
  +        this.isResponse = isResponse;
  +    }
  +
  +    public void setOperation(OperationDesc myOperation) {
  +        this.operation = myOperation;
  +    }
  +
  +    /**
  +     * Register the start of a parameter (child element of the method call
  +     * element).
  +     *
  +     * Our job here is to figure out a) which parameter this is (based on
  +     * the QName of the element or its position), and b) what type it is
  +     * (based on the xsi:type attribute or operation metadata) so we can
  +     * successfully deserialize it.
  +     */
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException
  +    {
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: RPCHandler.onStartChild()");
  +        }
  +
  +        if (!context.isDoneParsing()) {
  +            context.pushNewElement(new MessageElement(namespace,
  +            localName, prefix+":"+localName,attributes,context));
  +        }
  +
  +        Vector params = rpcElem.getParams();
  +        
  +        // This is a param.
  +        currentParam = new RPCParam(namespace, localName, null);
  +        rpcElem.addParam(currentParam);
  +        
  +        MessageElement curEl = context.getCurElement();
  +        QName type = null;
  +        QName qname = new QName(namespace, localName);
  +        ParameterDesc paramDesc = null;
  +
  +        // Grab xsi:type attribute if present, on either this element or
  +        // the referent (if it's an href).
  +        if (curEl.getHref() != null) {
  +            MessageElement ref = context.getElementByID(curEl.getHref());
  +            if (ref != null)
  +                type = context.getTypeFromAttributes(ref.getNamespaceURI(),
  +                                                     ref.getName(),
  +                                                     ref.getAttributes());
  +        } else {
  +            // Get the element type if we have it, otherwise check xsi:type
  +            type = curEl.getType();
  +            if (type == null) {
  +                type = context.getTypeFromAttributes(namespace,
  +                                                     localName,
  +                                                     attributes);
  +            }
  +        }
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug(JavaUtils.getMessage("typeFromAttr00", "" + type));
  +        }
  +
  +        // If we have an operation descriptor, try to associate this parameter
  +        // with the appropriate ParameterDesc
  +        if (operation != null) {
  +            // Try by name first
  +            if (isResponse) {
  +                paramDesc = operation.getOutputParamByQName(qname);
  +            } else {
  +                paramDesc = operation.getInputParamByQName(qname);
  +            }
  +
  +            // If that didn't work, try position
  +            // FIXME : Do we need to be in EITHER named OR positional
  +            //         mode?  I.e. will it screw us up to find something
  +            //         by position if we've already looked something up
  +            //         by name?  I think so...
  +            if (paramDesc == null) {
  +                paramDesc = operation.getParameter(params.size() - 1);
  +            }
  +
  +            if (paramDesc != null) {
  +                // Keep the association so we can use it later
  +                // (see RPCProvider.processMessage())
  +                currentParam.setParamDesc(paramDesc);
  +
  +                if (type == null) {
  +                    type = paramDesc.getTypeQName();
  +                } else if (paramDesc.getJavaType() != null) {
  +                    // If we have an xsi:type, make sure it makes sense
  +                    // with the current paramDesc type
  +                    Class xsiClass = 
  +                            context.getTypeMapping().getClassForQName(type);
  +                    if (!JavaUtils.isConvertable(xsiClass,
  +                                                 paramDesc.getJavaType())) {
  +                        throw new SAXException("Bad types (" +
  +                            xsiClass + " -> " + paramDesc.getJavaType() + ")"); // FIXME!
  +                    }
  +                }
  +            }
  +        }
  +
  +
  +        String isNil = attributes.getValue(Constants.NS_URI_2001_SCHEMA_XSI,
  +                                           "nil");
  +
  +        if ( isNil != null && isNil.equals("true") )
  +          return( new DeserializerImpl() );
  +        
  +        Deserializer dser = null;
  +        if ((type == null) && (namespace != null) && (!namespace.equals(""))) {
  +            dser = context.getDeserializerForType(qname);
  +        }
  +        if (dser == null) {
  +          if (type != null) {
  +              dser = context.getDeserializerForType(type);
  +          } else {
  +              dser = new DeserializerImpl();
  +          }
  +        }
  +
  +        if (dser == null) {
  +            throw new SAXException(JavaUtils.getMessage(
  +                    "noDeser01", localName,"" + type));
  +        }
  +
  +        dser.registerValueTarget(
  +             new FieldTarget(currentParam,
  +                 RPCParam.getValueField()));
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: RPCHandler.onStartChild()");
  +        }
  +        return (SOAPHandler)dser;
  +    }
  +
  +    public void endElement(String namespace, String localName,
  +                           DeserializationContext context)
  +        throws SAXException
  +    {
  +        if (log.isDebugEnabled()) {
  +            log.debug(JavaUtils.getMessage("setProp00",
  +                    "MessageContext", "RPCHandler.endElement()."));
  +        }
  +        context.getMessageContext().setProperty("RPC", rpcElem);
  +    }
  +}
  
  
  
  1.19      +238 -238  xml-axis/java/src/org/apache/axis/message/SOAPBody.java
  
  Index: SOAPBody.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPBody.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SOAPBody.java	30 May 2002 03:06:11 -0000	1.18
  +++ SOAPBody.java	30 May 2002 23:46:02 -0000	1.19
  @@ -1,238 +1,238 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2002 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/>.
  - */
  -
  -package org.apache.axis.message;
  -
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.soap.SOAPConstants;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.Attributes;
  -
  -import javax.xml.rpc.namespace.QName;
  -import javax.xml.soap.Name;
  -import javax.xml.soap.SOAPElement;
  -import javax.xml.soap.SOAPException;
  -import java.util.Enumeration;
  -import java.util.Vector;
  -
  -/**
  - * Holder for body elements.
  - *
  - * @author Glyn Normington (glyn@apache.org)
  - */
  -public class SOAPBody extends MessageElement
  -    implements javax.xml.soap.SOAPBody {
  -
  -    private static Log log = LogFactory.getLog(SOAPBody.class.getName());
  -
  -    private Vector bodyElements = new Vector();
  -
  -    private SOAPConstants soapConstants;
  -
  -    SOAPBody(SOAPEnvelope env, SOAPConstants soapConsts) {
  -        soapConstants = soapConsts;
  -        try {
  -            setParentElement(env);
  -        } catch (SOAPException ex) {
  -            // class cast should never fail when parent is a SOAPEnvelope
  -            log.fatal(JavaUtils.getMessage("exception00"), ex);
  -        }
  -    }
  -
  -    public SOAPBody(String namespace, String localPart, String qName,
  -                    Attributes attributes, DeserializationContext context,
  -                    SOAPConstants soapConsts) {
  -        super(namespace, localPart, qName, attributes, context);
  -        soapConstants = soapConsts;
  -    }
  -
  -    public void setParentElement(SOAPElement parent) throws SOAPException {
  -        try {
  -            // cast to force exception if wrong type
  -            super.setParentElement((SOAPEnvelope)parent);
  -        } catch (Throwable t) {
  -            throw new SOAPException(t);
  -        }
  -    }
  -
  -    public void detachNode() {
  -        ((SOAPEnvelope)parent).removeBody();
  -        super.detachNode();
  -    }
  -
  -    protected void outputImpl(SerializationContext context) throws Exception {
  -        boolean oldPretty = context.getPretty();
  -        context.setPretty(true);
  -
  -        if (bodyElements.isEmpty()) {
  -            // This is a problem.
  -            // throw new Exception("No body elements!");
  -            // If there are no body elements just return - it's ok that
  -            // the body is empty
  -        }
  -
  -        // Output <SOAP-ENV:Body>
  -        context.startElement(new QName(soapConstants.getEnvelopeURI(),
  -                                       Constants.ELEM_BODY), null);
  -        Enumeration enum = bodyElements.elements();
  -        while (enum.hasMoreElements()) {
  -            SOAPBodyElement body = (SOAPBodyElement)enum.nextElement();
  -            body.output(context);
  -            // Output this body element.
  -        }
  -        
  -        // Output multi-refs
  -        context.outputMultiRefs();
  -        
  -        // Output </SOAP-ENV:Body>
  -        context.endElement();
  -
  -        context.setPretty(oldPretty);
  -    }
  -
  -    Vector getBodyElements() throws AxisFault
  -    {
  -        return bodyElements;
  -    }
  -
  -    SOAPBodyElement getFirstBody() throws AxisFault
  -    {
  -        if (bodyElements.isEmpty())
  -            return null;
  -        
  -        return (SOAPBodyElement)bodyElements.elementAt(0);
  -    }
  -
  -    void addBodyElement(SOAPBodyElement element)
  -    {
  -        if (log.isDebugEnabled())
  -            log.debug(JavaUtils.getMessage("addBody00"));
  -        bodyElements.addElement(element);
  -        try {
  -            element.setParentElement(this);
  -        } catch (SOAPException ex) {
  -            // class cast should never fail when parent is a SOAPBody
  -            log.fatal(JavaUtils.getMessage("exception00"), ex);
  -        }
  -    }
  -
  -    void removeBodyElement(SOAPBodyElement element)
  -    {
  -        if (log.isDebugEnabled())
  -            log.debug(JavaUtils.getMessage("removeBody00"));
  -        bodyElements.removeElement(element);
  -    }
  -
  -    void clearBody()
  -    {
  -        if (!bodyElements.isEmpty())
  -            bodyElements.removeAllElements();
  -    }
  -
  -    SOAPBodyElement getBodyByName(String namespace, String localPart)
  -        throws AxisFault
  -    {
  -        return (SOAPBodyElement)findElement(bodyElements,
  -                                            namespace,
  -                                            localPart);
  -    }
  -
  -    protected MessageElement findElement(Vector vec, String namespace,
  -                                         String localPart)
  -    {
  -        if (vec.isEmpty())
  -            return null;
  -        
  -        Enumeration e = vec.elements();
  -        MessageElement element;
  -        while (e.hasMoreElements()) {
  -            element = (MessageElement)e.nextElement();
  -            if (element.getNamespaceURI().equals(namespace) &&
  -                element.getName().equals(localPart))
  -                return element;
  -        }
  -        
  -        return null;
  -    }
  -
  -    // JAXM methods
  -
  -    public javax.xml.soap.SOAPBodyElement addBodyElement(Name name)
  -        throws SOAPException {
  -        SOAPBodyElement bodyElement = new SOAPBodyElement(name);
  -        addBodyElement(bodyElement);
  -        return bodyElement;
  -    }
  -
  -    public javax.xml.soap.SOAPFault addFault() throws SOAPException {
  -        // not yet implemented
  -        return null;
  -    }
  -
  -    public javax.xml.soap.SOAPFault getFault() {
  -        // not yet implemented
  -        return null;
  -    }
  -
  -    public boolean hasFault() {
  -        // not yet implemented
  -        return false;
  -    }
  -}
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2002 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/>.
  + */
  +
  +package org.apache.axis.message;
  +
  +import org.apache.axis.AxisFault;
  +import org.apache.axis.Constants;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.soap.SOAPConstants;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.Attributes;
  +
  +import javax.xml.rpc.namespace.QName;
  +import javax.xml.soap.Name;
  +import javax.xml.soap.SOAPElement;
  +import javax.xml.soap.SOAPException;
  +import java.util.Enumeration;
  +import java.util.Vector;
  +
  +/**
  + * Holder for body elements.
  + *
  + * @author Glyn Normington (glyn@apache.org)
  + */
  +public class SOAPBody extends MessageElement
  +    implements javax.xml.soap.SOAPBody {
  +
  +    private static Log log = LogFactory.getLog(SOAPBody.class.getName());
  +
  +    private Vector bodyElements = new Vector();
  +
  +    private SOAPConstants soapConstants;
  +
  +    SOAPBody(SOAPEnvelope env, SOAPConstants soapConsts) {
  +        soapConstants = soapConsts;
  +        try {
  +            setParentElement(env);
  +        } catch (SOAPException ex) {
  +            // class cast should never fail when parent is a SOAPEnvelope
  +            log.fatal(JavaUtils.getMessage("exception00"), ex);
  +        }
  +    }
  +
  +    public SOAPBody(String namespace, String localPart, String qName,
  +                    Attributes attributes, DeserializationContext context,
  +                    SOAPConstants soapConsts) {
  +        super(namespace, localPart, qName, attributes, context);
  +        soapConstants = soapConsts;
  +    }
  +
  +    public void setParentElement(SOAPElement parent) throws SOAPException {
  +        try {
  +            // cast to force exception if wrong type
  +            super.setParentElement((SOAPEnvelope)parent);
  +        } catch (Throwable t) {
  +            throw new SOAPException(t);
  +        }
  +    }
  +
  +    public void detachNode() {
  +        ((SOAPEnvelope)parent).removeBody();
  +        super.detachNode();
  +    }
  +
  +    protected void outputImpl(SerializationContext context) throws Exception {
  +        boolean oldPretty = context.getPretty();
  +        context.setPretty(true);
  +
  +        if (bodyElements.isEmpty()) {
  +            // This is a problem.
  +            // throw new Exception("No body elements!");
  +            // If there are no body elements just return - it's ok that
  +            // the body is empty
  +        }
  +
  +        // Output <SOAP-ENV:Body>
  +        context.startElement(new QName(soapConstants.getEnvelopeURI(),
  +                                       Constants.ELEM_BODY), null);
  +        Enumeration enum = bodyElements.elements();
  +        while (enum.hasMoreElements()) {
  +            SOAPBodyElement body = (SOAPBodyElement)enum.nextElement();
  +            body.output(context);
  +            // Output this body element.
  +        }
  +        
  +        // Output multi-refs
  +        context.outputMultiRefs();
  +        
  +        // Output </SOAP-ENV:Body>
  +        context.endElement();
  +
  +        context.setPretty(oldPretty);
  +    }
  +
  +    Vector getBodyElements() throws AxisFault
  +    {
  +        return bodyElements;
  +    }
  +
  +    SOAPBodyElement getFirstBody() throws AxisFault
  +    {
  +        if (bodyElements.isEmpty())
  +            return null;
  +        
  +        return (SOAPBodyElement)bodyElements.elementAt(0);
  +    }
  +
  +    void addBodyElement(SOAPBodyElement element)
  +    {
  +        if (log.isDebugEnabled())
  +            log.debug(JavaUtils.getMessage("addBody00"));
  +        bodyElements.addElement(element);
  +        try {
  +            element.setParentElement(this);
  +        } catch (SOAPException ex) {
  +            // class cast should never fail when parent is a SOAPBody
  +            log.fatal(JavaUtils.getMessage("exception00"), ex);
  +        }
  +    }
  +
  +    void removeBodyElement(SOAPBodyElement element)
  +    {
  +        if (log.isDebugEnabled())
  +            log.debug(JavaUtils.getMessage("removeBody00"));
  +        bodyElements.removeElement(element);
  +    }
  +
  +    void clearBody()
  +    {
  +        if (!bodyElements.isEmpty())
  +            bodyElements.removeAllElements();
  +    }
  +
  +    SOAPBodyElement getBodyByName(String namespace, String localPart)
  +        throws AxisFault
  +    {
  +        return (SOAPBodyElement)findElement(bodyElements,
  +                                            namespace,
  +                                            localPart);
  +    }
  +
  +    protected MessageElement findElement(Vector vec, String namespace,
  +                                         String localPart)
  +    {
  +        if (vec.isEmpty())
  +            return null;
  +        
  +        Enumeration e = vec.elements();
  +        MessageElement element;
  +        while (e.hasMoreElements()) {
  +            element = (MessageElement)e.nextElement();
  +            if (element.getNamespaceURI().equals(namespace) &&
  +                element.getName().equals(localPart))
  +                return element;
  +        }
  +        
  +        return null;
  +    }
  +
  +    // JAXM methods
  +
  +    public javax.xml.soap.SOAPBodyElement addBodyElement(Name name)
  +        throws SOAPException {
  +        SOAPBodyElement bodyElement = new SOAPBodyElement(name);
  +        addBodyElement(bodyElement);
  +        return bodyElement;
  +    }
  +
  +    public javax.xml.soap.SOAPFault addFault() throws SOAPException {
  +        // not yet implemented
  +        return null;
  +    }
  +
  +    public javax.xml.soap.SOAPFault getFault() {
  +        // not yet implemented
  +        return null;
  +    }
  +
  +    public boolean hasFault() {
  +        // not yet implemented
  +        return false;
  +    }
  +}
  
  
  
  1.69      +450 -450  xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
  
  Index: SOAPEnvelope.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- SOAPEnvelope.java	30 May 2002 03:06:11 -0000	1.68
  +++ SOAPEnvelope.java	30 May 2002 23:46:02 -0000	1.69
  @@ -1,450 +1,450 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.message;
  -
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.Constants;
  -import org.apache.axis.Message;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.soap.SOAPConstants;
  -import org.apache.axis.configuration.NullProvider;
  -import org.apache.axis.client.AxisClient;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.DeserializationContextImpl;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.Mapping;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -
  -import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.soap.SOAPException;
  -import javax.xml.rpc.namespace.QName;
  -
  -import java.io.InputStream;
  -import java.util.ArrayList;
  -import java.util.Enumeration;
  -import java.util.Iterator;
  -import java.util.Vector;
  -
  -public class SOAPEnvelope extends MessageElement
  -    implements javax.xml.soap.SOAPEnvelope
  -{
  -    protected static Log log =
  -        LogFactory.getLog(SOAPEnvelope.class.getName());
  -
  -    private SOAPHeader header;
  -    private SOAPBody body;
  -    
  -    public Vector trailers = new Vector();
  -    private SOAPConstants soapConstants;
  -
  -    // This is a hint to any service description to tell it what
  -    // "type" of message we are.  This might be "request", "response",
  -    // or anything else your particular service descripton requires.
  -    //
  -    // This gets passed back into the service description during
  -    // deserialization 
  -    public String messageType;
  -    
  -    public SOAPEnvelope()
  -    {
  -        this(true, SOAPConstants.SOAP11_CONSTANTS);
  -    }
  -
  -    public SOAPEnvelope(SOAPConstants soapConstants)
  -    {
  -        this(true, soapConstants);
  -    }
  -
  -    public SOAPEnvelope(boolean registerPrefixes, SOAPConstants soapConstants)
  -    {
  -        this.soapConstants = soapConstants;
  -        header = new SOAPHeader(this, soapConstants);
  -        body = new SOAPBody(this, soapConstants);
  -
  -        if (registerPrefixes) {
  -            if (namespaces == null)
  -                namespaces = new ArrayList();
  -
  -            namespaces.add(new Mapping(soapConstants.getEnvelopeURI(),
  -                                       Constants.NS_PREFIX_SOAP_ENV));
  -            namespaces.add(new Mapping(Constants.NS_URI_CURRENT_SCHEMA_XSD,
  -                                       Constants.NS_PREFIX_SCHEMA_XSD));
  -            namespaces.add(new Mapping(Constants.NS_URI_CURRENT_SCHEMA_XSI,
  -                                       Constants.NS_PREFIX_SCHEMA_XSI));
  -        }
  -        
  -        setDirty(true);
  -    }
  -
  -    public SOAPEnvelope(InputStream input) throws SAXException {
  -        InputSource is = new InputSource(input);
  -        header = new SOAPHeader(this, soapConstants); // soapConstants = null!
  -        DeserializationContext dser = null ;
  -        AxisClient     tmpEngine = new AxisClient(new NullProvider());
  -        MessageContext msgContext = new MessageContext(tmpEngine);
  -        dser = new DeserializationContextImpl(is, msgContext,
  -                                              Message.REQUEST, this );
  -        dser.parse();
  -    }
  -    
  -    public String getMessageType()
  -    {
  -        return messageType;
  -    }
  -    
  -    public void setMessageType(String messageType)
  -    {
  -        this.messageType = messageType;
  -    }
  -    
  -    public Vector getBodyElements() throws AxisFault
  -    {
  -        if (body != null) {
  -            return body.getBodyElements();
  -        } else {
  -            return new Vector();
  -        }
  -    }
  -    
  -    public Vector getTrailers()
  -    {
  -        return trailers;
  -    }
  -    
  -    public SOAPBodyElement getFirstBody() throws AxisFault
  -    {
  -        if (body == null) {
  -            return null;
  -        } else {
  -            return body.getFirstBody();
  -        }
  -    }
  -    
  -    public Vector getHeaders() throws AxisFault
  -    {
  -        if (header != null) {
  -            return header.getHeaders();
  -        } else {
  -            return new Vector();
  -        }
  -    }
  -    
  -    /**
  -     * Get all the headers targeted at a list of actors.
  -     */ 
  -    public Vector getHeadersByActor(ArrayList actors)
  -    {
  -        if (header != null) {
  -            return header.getHeadersByActor(actors);
  -        } else {
  -            return new Vector();
  -        }
  -    }
  -    
  -    public void addHeader(SOAPHeaderElement hdr)
  -    {
  -        if (header == null) {
  -            header = new SOAPHeader(this, soapConstants);
  -        }
  -        hdr.setEnvelope(this);
  -        header.addHeader(hdr);
  -        _isDirty = true;
  -    }
  -    
  -    public void addBodyElement(SOAPBodyElement element)
  -    {
  -        if (body == null) {
  -            body = new SOAPBody(this, soapConstants);
  -        }
  -        element.setEnvelope(this);
  -        body.addBodyElement(element);
  -
  -        _isDirty = true;
  -    }
  -
  -    public void removeHeaders() {
  -        header = null;
  -    }
  -
  -    public void setHeader(SOAPHeader hdr) {
  -        header = hdr;
  -        try {
  -            header.setParentElement(this);
  -        } catch (SOAPException ex) {
  -            // class cast should never fail when parent is a SOAPEnvelope
  -            log.fatal(JavaUtils.getMessage("exception00"), ex);
  -        }
  -    }
  -
  -    public void removeHeader(SOAPHeaderElement hdr)
  -    {
  -        if (header != null) {
  -            header.removeHeader(hdr);
  -            _isDirty = true;
  -        }
  -    }
  -    
  -    public void removeBody() {
  -        body = null;
  -    }
  -
  -    public void setBody(SOAPBody body) {
  -        this.body = body;
  -        try {
  -            body.setParentElement(this);
  -        } catch (SOAPException ex) {
  -            // class cast should never fail when parent is a SOAPEnvelope
  -            log.fatal(JavaUtils.getMessage("exception00"), ex);
  -        }
  -    }
  -
  -    public void removeBodyElement(SOAPBodyElement element)
  -    {
  -        if (body != null) {
  -            body.removeBodyElement(element);
  -            _isDirty = true;
  -        }
  -    }
  -    
  -    public void removeTrailer(MessageElement element)
  -    {
  -        if (log.isDebugEnabled())
  -            log.debug(JavaUtils.getMessage("removeTrailer00"));
  -        trailers.removeElement(element);
  -        _isDirty = true;
  -    }
  -    
  -    public void clearBody()
  -    {
  -        if (body != null) {
  -            body.clearBody();
  -            _isDirty = true;
  -        }
  -    }
  -    
  -    public void addTrailer(MessageElement element)
  -    {
  -        if (log.isDebugEnabled())
  -            log.debug(JavaUtils.getMessage("removeTrailer00"));
  -        element.setEnvelope(this);
  -        trailers.addElement(element);
  -        _isDirty = true;
  -    }
  -
  -    /**
  -     * Get a header by name (always respecting the currently in-scope
  -     * actors list)
  -     */ 
  -    public SOAPHeaderElement getHeaderByName(String namespace,
  -                                             String localPart)
  -        throws AxisFault
  -    {
  -        return getHeaderByName(namespace, localPart, false);
  -    }
  -    
  -    /**
  -     * Get a header by name, filtering for headers targeted at this
  -     * engine depending on the accessAllHeaders parameter.
  -     */ 
  -    public SOAPHeaderElement getHeaderByName(String namespace,
  -                                             String localPart,
  -                                             boolean accessAllHeaders)
  -        throws AxisFault
  -    {
  -        if (header != null) {
  -            return header.getHeaderByName(namespace,
  -                                          localPart,
  -                                          accessAllHeaders);
  -        } else {
  -            return null;
  -        }
  -    }
  -    
  -    public SOAPBodyElement getBodyByName(String namespace, String localPart)
  -        throws AxisFault
  -    {
  -        if (body == null) {
  -            return null;
  -        } else {
  -            return body.getBodyByName(namespace, localPart);
  -        }
  -    }
  -    
  -    public Enumeration getHeadersByName(String namespace, String localPart)
  -        throws AxisFault
  -    {
  -        return getHeadersByName(namespace, localPart, false);
  -    }
  -
  -    /**
  -     * Return an Enumeration of headers which match the given namespace
  -     * and localPart.  Depending on the value of the accessAllHeaders
  -     * parameter, we will attempt to filter on the current engine's list
  -     * of actors.
  -     * 
  -     * !!! NOTE THAT RIGHT NOW WE ALWAYS ASSUME WE'RE THE "ULTIMATE
  -     * DESTINATION" (i.e. we match on null actor).  IF WE WANT TO FULLY SUPPORT
  -     * INTERMEDIARIES WE'LL NEED TO FIX THIS.
  -     */ 
  -    public Enumeration getHeadersByName(String namespace, String localPart,
  -                                        boolean accessAllHeaders)
  -        throws AxisFault
  -    {
  -        if (header != null) {
  -            return header.getHeadersByName(namespace,
  -                                           localPart,
  -                                           accessAllHeaders);
  -        } else {
  -            return new Vector().elements();
  -        }
  -    }
  -    
  -    /** Should make SOAPSerializationException?
  -     */
  -    public void outputImpl(SerializationContext context)
  -        throws Exception
  -    {
  -        boolean oldPretty = context.getPretty();
  -        context.setPretty(true);
  -
  -        // Register namespace prefixes.
  -        if (namespaces != null) {
  -            for (Iterator i = namespaces.iterator(); i.hasNext(); ) {
  -                Mapping mapping = (Mapping)i.next();
  -                context.registerPrefixForURI(mapping.getPrefix(),
  -                                             mapping.getNamespaceURI());
  -            }
  -        }
  -        
  -        Enumeration enum;
  -        
  -        // Output <SOAP-ENV:Envelope>
  -        context.startElement(new QName(soapConstants.getEnvelopeURI(),
  -                                       Constants.ELEM_ENVELOPE), attributes);
  -
  -        // Output headers        
  -        if (header != null) {
  -            header.outputImpl(context);
  -        }
  -
  -        // Output body
  -        if (body != null) {
  -            body.outputImpl(context);
  -        }
  -
  -        // Output trailers
  -        enum = trailers.elements();
  -        while (enum.hasMoreElements()) {
  -            MessageElement element = (MessageElement)enum.nextElement();
  -            element.output(context);
  -            // Output this independent element
  -        }
  -        
  -        // Output </SOAP-ENV:Envelope>
  -        context.endElement();
  -
  -        context.setPretty(oldPretty);
  -    }
  -
  -    SOAPConstants getSOAPConstants() {
  -        return soapConstants;
  -    }
  -
  -    // JAXM methods
  -
  -    public javax.xml.soap.SOAPBody addBody() throws SOAPException {
  -        if (body == null) {
  -            body = new SOAPBody(this, soapConstants);
  -            return body;
  -        } else {
  -            throw new SOAPException(JavaUtils.getMessage("bodyPresent"));
  -        }
  -    }
  -
  -    public javax.xml.soap.SOAPHeader addHeader() throws SOAPException {
  -        if (header == null) {
  -            header = new SOAPHeader(this, soapConstants);
  -            return header;
  -        } else {
  -            throw new SOAPException(JavaUtils.getMessage("headerPresent"));
  -        }
  -    }
  -
  -    public javax.xml.soap.Name createName(String localName)
  -        throws SOAPException {
  -        // Ok to use the SOAP envelope's namespace URI and prefix?
  -        return new PrefixedQName(namespaceURI, localName, prefix);
  -    }
  -    
  -    public javax.xml.soap.Name createName(String localName,
  -                                          String prefix,
  -                                          String uri)
  -        throws SOAPException {
  -        return new PrefixedQName(uri, localName, prefix);
  -    }
  -    
  -    public javax.xml.soap.SOAPBody getBody() throws SOAPException {
  -        return body;
  -    }
  -
  -    public javax.xml.soap.SOAPHeader getHeader() throws SOAPException {
  -        return header;
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.message;
  +
  +import org.apache.axis.AxisFault;
  +import org.apache.axis.Constants;
  +import org.apache.axis.Message;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.soap.SOAPConstants;
  +import org.apache.axis.configuration.NullProvider;
  +import org.apache.axis.client.AxisClient;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.DeserializationContextImpl;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.utils.Mapping;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.soap.SOAPException;
  +import javax.xml.rpc.namespace.QName;
  +
  +import java.io.InputStream;
  +import java.util.ArrayList;
  +import java.util.Enumeration;
  +import java.util.Iterator;
  +import java.util.Vector;
  +
  +public class SOAPEnvelope extends MessageElement
  +    implements javax.xml.soap.SOAPEnvelope
  +{
  +    protected static Log log =
  +        LogFactory.getLog(SOAPEnvelope.class.getName());
  +
  +    private SOAPHeader header;
  +    private SOAPBody body;
  +    
  +    public Vector trailers = new Vector();
  +    private SOAPConstants soapConstants;
  +
  +    // This is a hint to any service description to tell it what
  +    // "type" of message we are.  This might be "request", "response",
  +    // or anything else your particular service descripton requires.
  +    //
  +    // This gets passed back into the service description during
  +    // deserialization 
  +    public String messageType;
  +    
  +    public SOAPEnvelope()
  +    {
  +        this(true, SOAPConstants.SOAP11_CONSTANTS);
  +    }
  +
  +    public SOAPEnvelope(SOAPConstants soapConstants)
  +    {
  +        this(true, soapConstants);
  +    }
  +
  +    public SOAPEnvelope(boolean registerPrefixes, SOAPConstants soapConstants)
  +    {
  +        this.soapConstants = soapConstants;
  +        header = new SOAPHeader(this, soapConstants);
  +        body = new SOAPBody(this, soapConstants);
  +
  +        if (registerPrefixes) {
  +            if (namespaces == null)
  +                namespaces = new ArrayList();
  +
  +            namespaces.add(new Mapping(soapConstants.getEnvelopeURI(),
  +                                       Constants.NS_PREFIX_SOAP_ENV));
  +            namespaces.add(new Mapping(Constants.NS_URI_CURRENT_SCHEMA_XSD,
  +                                       Constants.NS_PREFIX_SCHEMA_XSD));
  +            namespaces.add(new Mapping(Constants.NS_URI_CURRENT_SCHEMA_XSI,
  +                                       Constants.NS_PREFIX_SCHEMA_XSI));
  +        }
  +        
  +        setDirty(true);
  +    }
  +
  +    public SOAPEnvelope(InputStream input) throws SAXException {
  +        InputSource is = new InputSource(input);
  +        header = new SOAPHeader(this, soapConstants); // soapConstants = null!
  +        DeserializationContext dser = null ;
  +        AxisClient     tmpEngine = new AxisClient(new NullProvider());
  +        MessageContext msgContext = new MessageContext(tmpEngine);
  +        dser = new DeserializationContextImpl(is, msgContext,
  +                                              Message.REQUEST, this );
  +        dser.parse();
  +    }
  +    
  +    public String getMessageType()
  +    {
  +        return messageType;
  +    }
  +    
  +    public void setMessageType(String messageType)
  +    {
  +        this.messageType = messageType;
  +    }
  +    
  +    public Vector getBodyElements() throws AxisFault
  +    {
  +        if (body != null) {
  +            return body.getBodyElements();
  +        } else {
  +            return new Vector();
  +        }
  +    }
  +    
  +    public Vector getTrailers()
  +    {
  +        return trailers;
  +    }
  +    
  +    public SOAPBodyElement getFirstBody() throws AxisFault
  +    {
  +        if (body == null) {
  +            return null;
  +        } else {
  +            return body.getFirstBody();
  +        }
  +    }
  +    
  +    public Vector getHeaders() throws AxisFault
  +    {
  +        if (header != null) {
  +            return header.getHeaders();
  +        } else {
  +            return new Vector();
  +        }
  +    }
  +    
  +    /**
  +     * Get all the headers targeted at a list of actors.
  +     */ 
  +    public Vector getHeadersByActor(ArrayList actors)
  +    {
  +        if (header != null) {
  +            return header.getHeadersByActor(actors);
  +        } else {
  +            return new Vector();
  +        }
  +    }
  +    
  +    public void addHeader(SOAPHeaderElement hdr)
  +    {
  +        if (header == null) {
  +            header = new SOAPHeader(this, soapConstants);
  +        }
  +        hdr.setEnvelope(this);
  +        header.addHeader(hdr);
  +        _isDirty = true;
  +    }
  +    
  +    public void addBodyElement(SOAPBodyElement element)
  +    {
  +        if (body == null) {
  +            body = new SOAPBody(this, soapConstants);
  +        }
  +        element.setEnvelope(this);
  +        body.addBodyElement(element);
  +
  +        _isDirty = true;
  +    }
  +
  +    public void removeHeaders() {
  +        header = null;
  +    }
  +
  +    public void setHeader(SOAPHeader hdr) {
  +        header = hdr;
  +        try {
  +            header.setParentElement(this);
  +        } catch (SOAPException ex) {
  +            // class cast should never fail when parent is a SOAPEnvelope
  +            log.fatal(JavaUtils.getMessage("exception00"), ex);
  +        }
  +    }
  +
  +    public void removeHeader(SOAPHeaderElement hdr)
  +    {
  +        if (header != null) {
  +            header.removeHeader(hdr);
  +            _isDirty = true;
  +        }
  +    }
  +    
  +    public void removeBody() {
  +        body = null;
  +    }
  +
  +    public void setBody(SOAPBody body) {
  +        this.body = body;
  +        try {
  +            body.setParentElement(this);
  +        } catch (SOAPException ex) {
  +            // class cast should never fail when parent is a SOAPEnvelope
  +            log.fatal(JavaUtils.getMessage("exception00"), ex);
  +        }
  +    }
  +
  +    public void removeBodyElement(SOAPBodyElement element)
  +    {
  +        if (body != null) {
  +            body.removeBodyElement(element);
  +            _isDirty = true;
  +        }
  +    }
  +    
  +    public void removeTrailer(MessageElement element)
  +    {
  +        if (log.isDebugEnabled())
  +            log.debug(JavaUtils.getMessage("removeTrailer00"));
  +        trailers.removeElement(element);
  +        _isDirty = true;
  +    }
  +    
  +    public void clearBody()
  +    {
  +        if (body != null) {
  +            body.clearBody();
  +            _isDirty = true;
  +        }
  +    }
  +    
  +    public void addTrailer(MessageElement element)
  +    {
  +        if (log.isDebugEnabled())
  +            log.debug(JavaUtils.getMessage("removeTrailer00"));
  +        element.setEnvelope(this);
  +        trailers.addElement(element);
  +        _isDirty = true;
  +    }
  +
  +    /**
  +     * Get a header by name (always respecting the currently in-scope
  +     * actors list)
  +     */ 
  +    public SOAPHeaderElement getHeaderByName(String namespace,
  +                                             String localPart)
  +        throws AxisFault
  +    {
  +        return getHeaderByName(namespace, localPart, false);
  +    }
  +    
  +    /**
  +     * Get a header by name, filtering for headers targeted at this
  +     * engine depending on the accessAllHeaders parameter.
  +     */ 
  +    public SOAPHeaderElement getHeaderByName(String namespace,
  +                                             String localPart,
  +                                             boolean accessAllHeaders)
  +        throws AxisFault
  +    {
  +        if (header != null) {
  +            return header.getHeaderByName(namespace,
  +                                          localPart,
  +                                          accessAllHeaders);
  +        } else {
  +            return null;
  +        }
  +    }
  +    
  +    public SOAPBodyElement getBodyByName(String namespace, String localPart)
  +        throws AxisFault
  +    {
  +        if (body == null) {
  +            return null;
  +        } else {
  +            return body.getBodyByName(namespace, localPart);
  +        }
  +    }
  +    
  +    public Enumeration getHeadersByName(String namespace, String localPart)
  +        throws AxisFault
  +    {
  +        return getHeadersByName(namespace, localPart, false);
  +    }
  +
  +    /**
  +     * Return an Enumeration of headers which match the given namespace
  +     * and localPart.  Depending on the value of the accessAllHeaders
  +     * parameter, we will attempt to filter on the current engine's list
  +     * of actors.
  +     * 
  +     * !!! NOTE THAT RIGHT NOW WE ALWAYS ASSUME WE'RE THE "ULTIMATE
  +     * DESTINATION" (i.e. we match on null actor).  IF WE WANT TO FULLY SUPPORT
  +     * INTERMEDIARIES WE'LL NEED TO FIX THIS.
  +     */ 
  +    public Enumeration getHeadersByName(String namespace, String localPart,
  +                                        boolean accessAllHeaders)
  +        throws AxisFault
  +    {
  +        if (header != null) {
  +            return header.getHeadersByName(namespace,
  +                                           localPart,
  +                                           accessAllHeaders);
  +        } else {
  +            return new Vector().elements();
  +        }
  +    }
  +    
  +    /** Should make SOAPSerializationException?
  +     */
  +    public void outputImpl(SerializationContext context)
  +        throws Exception
  +    {
  +        boolean oldPretty = context.getPretty();
  +        context.setPretty(true);
  +
  +        // Register namespace prefixes.
  +        if (namespaces != null) {
  +            for (Iterator i = namespaces.iterator(); i.hasNext(); ) {
  +                Mapping mapping = (Mapping)i.next();
  +                context.registerPrefixForURI(mapping.getPrefix(),
  +                                             mapping.getNamespaceURI());
  +            }
  +        }
  +        
  +        Enumeration enum;
  +        
  +        // Output <SOAP-ENV:Envelope>
  +        context.startElement(new QName(soapConstants.getEnvelopeURI(),
  +                                       Constants.ELEM_ENVELOPE), attributes);
  +
  +        // Output headers        
  +        if (header != null) {
  +            header.outputImpl(context);
  +        }
  +
  +        // Output body
  +        if (body != null) {
  +            body.outputImpl(context);
  +        }
  +
  +        // Output trailers
  +        enum = trailers.elements();
  +        while (enum.hasMoreElements()) {
  +            MessageElement element = (MessageElement)enum.nextElement();
  +            element.output(context);
  +            // Output this independent element
  +        }
  +        
  +        // Output </SOAP-ENV:Envelope>
  +        context.endElement();
  +
  +        context.setPretty(oldPretty);
  +    }
  +
  +    SOAPConstants getSOAPConstants() {
  +        return soapConstants;
  +    }
  +
  +    // JAXM methods
  +
  +    public javax.xml.soap.SOAPBody addBody() throws SOAPException {
  +        if (body == null) {
  +            body = new SOAPBody(this, soapConstants);
  +            return body;
  +        } else {
  +            throw new SOAPException(JavaUtils.getMessage("bodyPresent"));
  +        }
  +    }
  +
  +    public javax.xml.soap.SOAPHeader addHeader() throws SOAPException {
  +        if (header == null) {
  +            header = new SOAPHeader(this, soapConstants);
  +            return header;
  +        } else {
  +            throw new SOAPException(JavaUtils.getMessage("headerPresent"));
  +        }
  +    }
  +
  +    public javax.xml.soap.Name createName(String localName)
  +        throws SOAPException {
  +        // Ok to use the SOAP envelope's namespace URI and prefix?
  +        return new PrefixedQName(namespaceURI, localName, prefix);
  +    }
  +    
  +    public javax.xml.soap.Name createName(String localName,
  +                                          String prefix,
  +                                          String uri)
  +        throws SOAPException {
  +        return new PrefixedQName(uri, localName, prefix);
  +    }
  +    
  +    public javax.xml.soap.SOAPBody getBody() throws SOAPException {
  +        return body;
  +    }
  +
  +    public javax.xml.soap.SOAPHeader getHeader() throws SOAPException {
  +        return header;
  +    }
  +}
  
  
  
  1.17      +134 -134  xml-axis/java/src/org/apache/axis/transport/http/HTTPTransport.java
  
  Index: HTTPTransport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPTransport.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HTTPTransport.java	30 May 2002 03:06:11 -0000	1.16
  +++ HTTPTransport.java	30 May 2002 23:46:02 -0000	1.17
  @@ -1,134 +1,134 @@
  -/*
  - * 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/>.
  - */
  -
  -package org.apache.axis.transport.http;
  -
  -import org.apache.axis.AxisEngine;
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.client.Call;
  -import org.apache.axis.client.Transport;
  -
  -/**
  - * Extends Transport by implementing the setupMessageContext function to
  - * set HTTP-specific message context fields and transport chains.
  - * May not even be necessary if we arrange things differently somehow.
  - * Can hold state relating to URL properties.
  - *
  - * @author Rob Jellinghaus (robj@unrealities.com)
  - * @author Doug Davis (dug@us.ibm.com)
  - * @author Glen Daniels (gdaniels@allaire.com)
  - */
  -public class HTTPTransport extends Transport
  -{
  -    /**
  -     * HTTP properties
  -     */
  -    static public String URL = MessageContext.TRANS_URL;
  -
  -    private String cookie;
  -    private String cookie2;
  -    private String action;
  -    
  -    public HTTPTransport () {
  -        transportName = "http";
  -    }
  -    
  -    /**
  -     * helper constructor
  -     */
  -    public HTTPTransport (String url, String action)
  -    {
  -        transportName = "http";
  -        this.url = url;
  -        this.action = action;
  -    }
  -    
  -    /**
  -     * Set up any transport-specific derived properties in the message context.
  -     * @param context the context to set up
  -     * @param message the client service instance
  -     * @param engine the engine containing the registries
  -     * @throws AxisFault if service cannot be found
  -     */
  -    public void setupMessageContextImpl(MessageContext mc,
  -                                        Call call,
  -                                        AxisEngine engine)
  -        throws AxisFault
  -    {
  -        if (action != null) {
  -            mc.setUseSOAPAction(true);
  -            mc.setSOAPActionURI(action);
  -        }
  -
  -        // Set up any cookies we know about
  -        if (cookie != null)
  -            mc.setProperty(HTTPConstants.HEADER_COOKIE, cookie);
  -        if (cookie2 != null)
  -            mc.setProperty(HTTPConstants.HEADER_COOKIE2, cookie2);
  -
  -        // Allow the SOAPAction to determine the service, if the service
  -        // (a) has not already been determined, and (b) if a service matching
  -        // the soap action has been deployed.
  -        if (mc.getService() == null) {
  -            mc.setTargetService( (String)mc.getSOAPActionURI() );
  -        }
  -    }
  -
  -    public void processReturnedMessageContext(MessageContext context) {
  -        cookie = context.getStrProp(HTTPConstants.HEADER_COOKIE);
  -        cookie2 = context.getStrProp(HTTPConstants.HEADER_COOKIE2);
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package org.apache.axis.transport.http;
  +
  +import org.apache.axis.AxisEngine;
  +import org.apache.axis.AxisFault;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Transport;
  +
  +/**
  + * Extends Transport by implementing the setupMessageContext function to
  + * set HTTP-specific message context fields and transport chains.
  + * May not even be necessary if we arrange things differently somehow.
  + * Can hold state relating to URL properties.
  + *
  + * @author Rob Jellinghaus (robj@unrealities.com)
  + * @author Doug Davis (dug@us.ibm.com)
  + * @author Glen Daniels (gdaniels@allaire.com)
  + */
  +public class HTTPTransport extends Transport
  +{
  +    /**
  +     * HTTP properties
  +     */
  +    static public String URL = MessageContext.TRANS_URL;
  +
  +    private String cookie;
  +    private String cookie2;
  +    private String action;
  +    
  +    public HTTPTransport () {
  +        transportName = "http";
  +    }
  +    
  +    /**
  +     * helper constructor
  +     */
  +    public HTTPTransport (String url, String action)
  +    {
  +        transportName = "http";
  +        this.url = url;
  +        this.action = action;
  +    }
  +    
  +    /**
  +     * Set up any transport-specific derived properties in the message context.
  +     * @param context the context to set up
  +     * @param message the client service instance
  +     * @param engine the engine containing the registries
  +     * @throws AxisFault if service cannot be found
  +     */
  +    public void setupMessageContextImpl(MessageContext mc,
  +                                        Call call,
  +                                        AxisEngine engine)
  +        throws AxisFault
  +    {
  +        if (action != null) {
  +            mc.setUseSOAPAction(true);
  +            mc.setSOAPActionURI(action);
  +        }
  +
  +        // Set up any cookies we know about
  +        if (cookie != null)
  +            mc.setProperty(HTTPConstants.HEADER_COOKIE, cookie);
  +        if (cookie2 != null)
  +            mc.setProperty(HTTPConstants.HEADER_COOKIE2, cookie2);
  +
  +        // Allow the SOAPAction to determine the service, if the service
  +        // (a) has not already been determined, and (b) if a service matching
  +        // the soap action has been deployed.
  +        if (mc.getService() == null) {
  +            mc.setTargetService( (String)mc.getSOAPActionURI() );
  +        }
  +    }
  +
  +    public void processReturnedMessageContext(MessageContext context) {
  +        cookie = context.getStrProp(HTTPConstants.HEADER_COOKIE);
  +        cookie2 = context.getStrProp(HTTPConstants.HEADER_COOKIE2);
  +    }
  +}
  
  
  
  1.38      +1594 -1594xml-axis/java/src/org/apache/axis/utils/tcpmon.java
  
  Index: tcpmon.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/tcpmon.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- tcpmon.java	30 May 2002 03:06:12 -0000	1.37
  +++ tcpmon.java	30 May 2002 23:46:02 -0000	1.38
  @@ -1,1594 +1,1594 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.utils ;
  -
  -
  -import javax.swing.BorderFactory;
  -import javax.swing.Box;
  -import javax.swing.BoxLayout;
  -import javax.swing.ButtonGroup;
  -import javax.swing.JButton;
  -import javax.swing.JCheckBox;
  -import javax.swing.JFileChooser;
  -import javax.swing.JFrame;
  -import javax.swing.JLabel;
  -import javax.swing.JPanel;
  -import javax.swing.JRadioButton;
  -import javax.swing.JScrollPane;
  -import javax.swing.JSplitPane;
  -import javax.swing.JTabbedPane;
  -import javax.swing.JTable;
  -import javax.swing.JTextArea;
  -import javax.swing.JTextField;
  -import javax.swing.ListSelectionModel;
  -import javax.swing.SwingConstants;
  -import javax.swing.UIManager;
  -import javax.swing.border.TitledBorder;
  -import javax.swing.event.ChangeEvent;
  -import javax.swing.event.ListSelectionEvent;
  -import javax.swing.event.ListSelectionListener;
  -import javax.swing.plaf.basic.BasicButtonListener;
  -import javax.swing.table.DefaultTableModel;
  -import javax.swing.table.TableColumn;
  -import javax.swing.table.TableModel;
  -import java.awt.*;
  -import java.awt.event.ActionEvent;
  -import java.awt.event.ActionListener;
  -import java.awt.event.WindowEvent;
  -import java.io.ByteArrayInputStream;
  -import java.io.File;
  -import java.io.FileOutputStream;
  -import java.io.InputStream;
  -import java.io.OutputStream;
  -import java.io.PrintWriter;
  -import java.io.StringWriter;
  -import java.net.InetAddress;
  -import java.net.ServerSocket;
  -import java.net.Socket;
  -import java.net.URL;
  -import java.text.DateFormat;
  -import java.text.MessageFormat;
  -import java.text.SimpleDateFormat;
  -import java.util.Date;
  -import java.util.ResourceBundle;
  -import java.util.Vector;
  -
  -
  -/**
  - * @author Doug Davis (dug@us.ibm.com)
  - */
  -
  -public class tcpmon extends JFrame {
  -    private JTabbedPane  notebook = null ;
  -
  -    static private int STATE_COLUMN    = 0 ;
  -    static private int TIME_COLUMN     = 1 ;
  -    static private int INHOST_COLUMN   = 2 ;
  -    static private int OUTHOST_COLUMN  = 3 ;
  -    static private int REQ_COLUMN      = 4 ;
  -
  -    class AdminPage extends JPanel {
  -        public JRadioButton  listenerButton, proxyButton ;
  -        public JLabel        hostLabel, tportLabel;
  -        public JTextField    port, host, tport ;
  -        public JTabbedPane   noteb ;
  -        public JCheckBox     HTTPProxyBox ;
  -        public JTextField    HTTPProxyHost, HTTPProxyPort ;
  -        public JLabel        HTTPProxyHostLabel, HTTPProxyPortLabel ;
  -
  -        public AdminPage( JTabbedPane notebook, String name ) {
  -            JPanel     mainPane  = null ;
  -            JButton    addButton = null ;
  -
  -            this.setLayout( new BorderLayout() );
  -            noteb = notebook ;
  -
  -            GridBagLayout       layout        = new GridBagLayout();
  -            GridBagConstraints  c             = new GridBagConstraints();
  -
  -            mainPane = new JPanel(layout);
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER;
  -            mainPane.add( new JLabel(getMessage("newTCP00", "Create a new TCP/IP Monitor...") + " "), c );
  -
  -            // Add some blank space
  -            mainPane.add( Box.createRigidArea(new Dimension(1, 5)), c );
  -
  -            // The listener info
  -            ///////////////////////////////////////////////////////////////////
  -            JPanel   tmpPanel = new JPanel(new GridBagLayout());
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = 1 ;
  -            tmpPanel.add( new JLabel(getMessage("listenPort00", "Listen Port #") + " "), c );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            tmpPanel.add( port = new JTextField(4), c );
  -
  -            mainPane.add( tmpPanel, c );
  -
  -            mainPane.add( Box.createRigidArea(new Dimension(1, 5)), c );
  -
  -            // Group for the radio buttons
  -            ButtonGroup btns = new ButtonGroup();
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            mainPane.add( new JLabel(getMessage("actAs00", "Act as a...") ), c );
  -
  -            // Target Host/Port section
  -            ///////////////////////////////////////////////////////////////////
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -
  -            final String listener = getMessage("listener00", "Listener");
  -
  -            mainPane.add( listenerButton  = new JRadioButton( listener ), c );
  -            btns.add( listenerButton );
  -            listenerButton.setSelected( true );
  -
  -            listenerButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if (listener.equals(event.getActionCommand())) {
  -                            boolean state = listenerButton.isSelected();
  -
  -                            tport.setEnabled( state );
  -                            host.setEnabled( state );
  -                            hostLabel.setForeground(state ? Color.black : Color.gray);
  -                            tportLabel.setForeground(state ? Color.black : Color.gray);
  -                        }
  -                    }
  -                }
  -            );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = 1 ;
  -            mainPane.add( Box.createRigidArea(new Dimension(25, 0)) );
  -            mainPane.add( hostLabel = new JLabel(getMessage("targetHostname00", "Target Hostname") + " "), c );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            mainPane.add( host = new JTextField(30), c );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = 1 ;
  -            mainPane.add( Box.createRigidArea(new Dimension(25, 0)) );
  -            mainPane.add( tportLabel = new JLabel(getMessage("targetPort00", "Target Port #") + " "), c );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            mainPane.add( tport = new JTextField(4), c );
  -
  -            // Act as proxy section
  -            ///////////////////////////////////////////////////////////////////
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            final String proxy = getMessage("proxy00", "Proxy");
  -
  -            mainPane.add( proxyButton = new JRadioButton( proxy ), c);
  -            btns.add( proxyButton );
  -
  -            proxyButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if (proxy.equals(event.getActionCommand())) {
  -                            boolean state = proxyButton.isSelected();
  -
  -                            tport.setEnabled( !state );
  -                            host.setEnabled( !state );
  -                            hostLabel.setForeground(state ? Color.gray : Color.black);
  -                            tportLabel.setForeground(state ? Color.gray : Color.black);
  -                        }
  -                    }
  -                }
  -            );
  -
  -            // Spacer
  -            /////////////////////////////////////////////////////////////////
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            mainPane.add( Box.createRigidArea(new Dimension(1, 10)), c );
  -
  -            // Options section
  -            ///////////////////////////////////////////////////////////////////
  -            JPanel       opts = new JPanel(new GridBagLayout());
  -
  -            opts.setBorder( new TitledBorder(getMessage("options00", "Options")) );
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            mainPane.add( opts, c );
  -
  -            // HTTP Proxy Support section
  -            ///////////////////////////////////////////////////////////////////
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            final String proxySupport = getMessage("proxySupport00", "HTTP Proxy Support");
  -
  -            opts.add(HTTPProxyBox = new JCheckBox(proxySupport), c);
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = 1 ;
  -            opts.add( HTTPProxyHostLabel = new JLabel(getMessage("hostname00", "Hostname") + " "), c );
  -            HTTPProxyHostLabel.setForeground( Color.gray );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            opts.add( HTTPProxyHost = new JTextField(30), c );
  -            HTTPProxyHost.setEnabled( false );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = 1 ;
  -            opts.add( HTTPProxyPortLabel = new JLabel(getMessage("port00", "Port #") + " "), c );
  -            HTTPProxyPortLabel.setForeground( Color.gray );
  -
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            opts.add( HTTPProxyPort = new JTextField(4), c );
  -            HTTPProxyPort.setEnabled( false );
  -
  -            HTTPProxyBox.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if (proxySupport.equals(event.getActionCommand())) {
  -                            boolean b = HTTPProxyBox.isSelected();
  -                            Color   color = b ? Color.black : Color.gray ;
  -
  -                            HTTPProxyHost.setEnabled( b );
  -                            HTTPProxyPort.setEnabled( b );
  -                            HTTPProxyHostLabel.setForeground( color );
  -                            HTTPProxyPortLabel.setForeground( color );
  -                        }
  -                    }
  -                    ;
  -                }
  -            );
  -
  -            // Set default proxy values...
  -            String tmp = System.getProperty( "http.proxyHost" );
  -
  -            if ( tmp != null && tmp.equals("") )
  -                tmp = null ;
  -
  -            HTTPProxyBox.setSelected( tmp != null );
  -            HTTPProxyHost.setEnabled( tmp != null );
  -            HTTPProxyPort.setEnabled( tmp != null );
  -            HTTPProxyHostLabel.setForeground( tmp != null ? Color.black : Color.gray);
  -            HTTPProxyPortLabel.setForeground( tmp != null ? Color.black : Color.gray);
  -
  -            if ( tmp != null ) {
  -                HTTPProxyBox.setSelected( true );
  -                HTTPProxyHost.setText( tmp );
  -                tmp = System.getProperty( "http.proxyPort" );
  -                if ( tmp != null && tmp.equals("") ) tmp = null ;
  -                if ( tmp == null ) tmp = "80" ;
  -                HTTPProxyPort.setText( tmp );
  -            }
  -
  -            // Spacer
  -            //////////////////////////////////////////////////////////////////
  -            mainPane.add( Box.createRigidArea(new Dimension(1, 10)), c );
  -
  -            // ADD Button
  -            ///////////////////////////////////////////////////////////////////
  -            c.anchor    = GridBagConstraints.WEST ;
  -            c.gridwidth = GridBagConstraints.REMAINDER ;
  -            final String add = getMessage("add00", "Add");
  -
  -            mainPane.add( addButton = new JButton( add ), c );
  -
  -
  -            this.add( new JScrollPane( mainPane ), BorderLayout.CENTER );
  -
  -            // addButton.setEnabled( false );
  -            addButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if ( add.equals(event.getActionCommand()) ) {
  -                            String   text ;
  -                            Listener l = null ;
  -                            int      lPort = Integer.parseInt(port.getText());
  -                            String   tHost = host.getText();
  -                            int      tPort = 0 ;
  -
  -                            text = tport.getText();
  -                            if ( text != null && !text.equals("") )
  -                                tPort = Integer.parseInt(text);
  -                            l = new Listener( noteb, null, lPort, tHost, tPort,
  -                                proxyButton.isSelected() );
  -
  -                            // Pick-up the HTTP Proxy settings
  -                            ///////////////////////////////////////////////////
  -                            text = HTTPProxyHost.getText();
  -                            if ( "".equals(text) ) text = null ;
  -                            l.HTTPProxyHost = text ;
  -                            text = HTTPProxyPort.getText();
  -                            if ( "".equals(text) ) text = null ;
  -                            if ( text != null )
  -                                l.HTTPProxyPort = Integer.parseInt(text);
  -
  -                            port.setText(null);
  -                            host.setText(null);
  -                            tport.setText(null);
  -                        }
  -                    }
  -                    ;
  -                }
  -            );
  -
  -            notebook.addTab( name, this );
  -            notebook.repaint();
  -            notebook.setSelectedIndex( notebook.getTabCount() - 1 );
  -        }
  -    }
  -
  -    class SocketWaiter extends Thread {
  -        ServerSocket  sSocket = null ;
  -        Listener      listener ;
  -        int           port ;
  -        boolean       pleaseStop = false ;
  -
  -        public SocketWaiter(Listener l, int p) {
  -            listener = l ;
  -            port = p ;
  -            start();
  -        }
  -
  -        public void run() {
  -            try {
  -                listener.setLeft( new JLabel(getMessage("wait00", " Waiting for Connection...") ) );
  -                listener.repaint();
  -                sSocket = new ServerSocket( port );
  -                for (; ; ) {
  -                    Socket inSocket = sSocket.accept();
  -
  -                    if ( pleaseStop ) break ;
  -                    new Connection( listener, inSocket );
  -                    inSocket = null ;
  -                }
  -            }
  -            catch ( Exception exp ) {
  -                if ( !"socket closed".equals(exp.getMessage()) ) {
  -                    JLabel tmp = new JLabel( exp.toString() );
  -
  -                    tmp.setForeground( Color.red );
  -                    listener.setLeft( tmp );
  -                    listener.setRight( new JLabel("") );
  -                    listener.stop();
  -                }
  -            }
  -        }
  -
  -        public void halt() {
  -            try {
  -                pleaseStop = true ;
  -                new Socket( "127.0.0.1", port );
  -                if ( sSocket != null ) sSocket.close();
  -            }
  -            catch ( Exception e ) {
  -                e.printStackTrace();
  -            }
  -        }
  -    }
  -
  -
  -    class SocketRR extends Thread {
  -        Socket        inSocket  = null ;
  -        Socket        outSocket  = null ;
  -        JTextArea     textArea ;
  -        InputStream   in = null ;
  -        OutputStream  out = null ;
  -        boolean       xmlFormat ;
  -        volatile boolean       done = false ;
  -        TableModel    tmodel = null ;
  -        int           tableIndex = 0 ;
  -        String type = null;
  -        Connection    myConnection = null;
  -
  -        public SocketRR(Connection c, Socket inputSocket, InputStream inputStream,
  -            Socket outputSocket, OutputStream outputStream,
  -            JTextArea _textArea, boolean format,
  -            TableModel tModel, int index, final String type) {
  -            inSocket = inputSocket ;
  -            in       = inputStream ;
  -            outSocket = outputSocket ;
  -            out       = outputStream ;
  -            textArea  = _textArea ;
  -            xmlFormat = format ;
  -            tmodel    = tModel ;
  -            tableIndex = index ;
  -            this.type = type;
  -            myConnection = c;
  -            start();
  -        }
  -
  -        public boolean isDone() {
  -            return ( done );
  -        }
  -
  -        public void run() {
  -            try {
  -                byte[]      buffer = new byte[4096];
  -                byte[]      tmpbuffer = new byte[8192];
  -                int         saved = 0 ;
  -                int         len ;
  -                int         i1, i2 ;
  -                int         i ;
  -                int         reqSaved = 0 ;
  -                int         tabWidth = 3 ;
  -                boolean     atMargin = true ;
  -                int         thisIndent = -1,
  -                    nextIndent = -1,
  -                    previousIndent = -1;
  -
  -                //if ( inSocket  != null ) inSocket.setSoTimeout( 10 );
  -                //if ( outSocket != null ) outSocket.setSoTimeout( 10 );
  -
  -                if ( tmodel != null ) {
  -                    String tmpStr = (String) tmodel.getValueAt(tableIndex,
  -                            REQ_COLUMN);
  -
  -                    if ( !"".equals(tmpStr) )
  -                        reqSaved = tmpStr.length();
  -                }
  -
  -                a:
  -                for ( ; ; ) {
  -                    if ( done ) break;
  -                    //try{
  -                    //len = in.available();
  -                    //}catch(Exception e){len=0;}
  -                    len = buffer.length ;
  -                    // Used to be 1, but if we block it doesn't matter 
  -                    // however 1 will break with some servers, including apache
  -                    if ( len == 0 ) len = buffer.length;
  -                    if ( saved + len > buffer.length) len = buffer.length - saved ;
  -                    int len1 = 0;
  -
  -                    while ( len1 == 0 ) {
  -                        try {
  -                            len1 = in.read(buffer, saved, len);
  -                        } 
  -                        catch ( Exception ex ) {
  -                            if ( done && saved == 0  ) break a;
  -                            len1 = -1;
  -                            break;
  -                        }
  -                    }
  -                    len = len1;
  -
  -                    if ( len == -1 && saved == 0 ) break ;
  -                    if ( len == -1) done = true;
  -
  -                    // No matter how we may (or may not) format it, send it
  -                    // on unformatted - we don't want to mess with how its
  -                    // sent to the other side, just how its displayed
  -                    if ( out != null && len > 0 ) {
  -                        out.write( buffer, saved, len );
  -                    }
  -
  -                    if ( tmodel != null && reqSaved < 50 ) {
  -                        String old = (String) tmodel.getValueAt( tableIndex,
  -                                REQ_COLUMN);
  -
  -                        old = old + new String(buffer, saved, len);
  -                        if ( old.length() > 50 )
  -                            old = old.substring(0, 50);
  -
  -                        reqSaved = old.length();
  -
  -                        if ( (i = old.indexOf('\n')) > 0 ) {
  -                            old = old.substring(0, i - 1);
  -                            reqSaved = 50 ;
  -                        }
  -
  -                        tmodel.setValueAt( old, tableIndex, REQ_COLUMN );
  -                    }
  -
  -                    if ( xmlFormat ) {
  -                        // Do XML Formatting
  -                        boolean inXML = false ;
  -                        int     bufferLen = saved ;
  -
  -                        if ( len != -1 ) bufferLen += len ;
  -                        i1 = 0 ;
  -                        i2 = 0 ;
  -                        saved = 0 ;
  -                        for ( ; i1 < bufferLen ; i1++ ) {
  -                            // Except when we're at EOF, saved last char
  -                            if ( len != -1 && i1 + 1 == bufferLen ) {
  -                                saved = 1;
  -                                break;
  -                            }
  -                            thisIndent = -1;
  -                            if ( buffer[i1] == '<' && buffer[i1 + 1] != '/' ) {
  -                                previousIndent = nextIndent++;
  -                                thisIndent = nextIndent;
  -                                inXML = true ;
  -                            }
  -                            if ( buffer[i1] == '<' && buffer[i1 + 1] == '/' ) {
  -                                if (previousIndent > nextIndent)
  -                                    thisIndent = nextIndent;
  -                                previousIndent = nextIndent--;
  -                                inXML = true ;
  -                            }
  -                            if ( buffer[i1] == '/' && buffer[i1 + 1] == '>' ) {
  -                                previousIndent = nextIndent--;
  -                                inXML = true ;
  -                            }
  -                            if ( thisIndent != -1 ) {
  -                                if ( thisIndent > 0 ) tmpbuffer[i2++] = (byte) '\n';
  -                                for ( i = tabWidth * thisIndent; i > 0; i-- )
  -                                    tmpbuffer[i2++] = (byte) ' ';
  -                            }
  -                            atMargin = ( buffer[i1] == '\n' || buffer[i1] == '\r');
  -
  -                            if ( !inXML || !atMargin ) {
  -                                tmpbuffer[i2++] = buffer[i1];
  -                            }
  -                        }
  -
  -                        textArea.append( new String( tmpbuffer, 0, i2 ) );
  -
  -                        // Shift saved bytes to the beginning
  -                        for ( i = 0 ; i < saved ; i++ )
  -                            buffer[i] = buffer[bufferLen - saved + i];
  -                    }
  -                    else {
  -                        textArea.append( new String( buffer, 0, len ) );
  -                    }
  -                // this.sleep(3);  // Let other threads have a chance to run
  -                }
  -            // this.sleep(3);  // Let other threads have a chance to run
  -            // halt();
  -            // Only set the 'done' flag if we were reading from a
  -            // Socket - if we were reading from an input stream then
  -            // we'll let the other side control when we're done
  -            //      if ( inSocket != null ) done = true ;
  -            }
  -            catch ( Exception e ) {
  -                e.printStackTrace();
  -            }
  -            finally {
  -                done = true ;
  -                try {
  -                    if (out != null) {
  -                        out.flush();
  -                        if (null != outSocket) outSocket.shutdownOutput();
  -                        else out.close();
  -                        out = null;
  -                    }
  -                } 
  -                catch (Exception e) {
  -                    ;
  -                }
  -                try {
  -                    if (in != null) {
  -                        if (inSocket != null) inSocket.shutdownInput();
  -                        else in.close();
  -                        in = null;
  -                    }
  -                }
  -                catch (Exception e) {
  -                    ;
  -                }
  -                myConnection.wakeUp();
  -            }
  -        }
  -
  -        public  void halt() {
  -            try {
  -                if ( inSocket != null )  inSocket.close();
  -                if ( outSocket != null ) outSocket.close();
  -                inSocket  = null ;
  -                outSocket = null ;
  -                if ( in != null ) in.close();
  -                if ( out != null ) out.close();
  -                in = null ;
  -                out = null ;
  -                done = true;
  -            } 
  -            catch ( Exception e ) {
  -                e.printStackTrace();
  -            }
  -        }
  -    }
  -
  -
  -    class Connection extends Thread {
  -        Listener     listener ;
  -        boolean      active ;
  -        String       fromHost ;
  -        String       time ;
  -        JTextArea    inputText    = null ;
  -        JScrollPane  inputScroll  = null ;
  -        JTextArea    outputText   = null ;
  -        JScrollPane  outputScroll = null ;
  -        Socket       inSocket     = null ;
  -        Socket       outSocket    = null ;
  -        Thread       clientThread = null ;
  -        Thread       serverThread = null ;
  -        SocketRR     rr1          = null ;
  -        SocketRR     rr2          = null ;
  -        InputStream  inputStream  = null ;
  -
  -        String       HTTPProxyHost = null ;
  -        int          HTTPProxyPort = 80 ;
  -
  -        public Connection(Listener l) {
  -            listener = l ;
  -            HTTPProxyHost = l.HTTPProxyHost ;
  -            HTTPProxyPort = l.HTTPProxyPort ;
  -        }
  -
  -        public Connection(Listener l, Socket s ) {
  -            this (l);
  -            inSocket = s ;
  -            start();
  -        }
  -
  -        public Connection(Listener l, InputStream in ) {
  -            this (l);
  -            inputStream = in ;
  -            start();
  -        }
  -
  -        public void run() {
  -            try {
  -                active        = true ;
  -
  -                HTTPProxyHost = System.getProperty( "http.proxyHost" );
  -                if ( HTTPProxyHost != null && HTTPProxyHost.equals("") )
  -                    HTTPProxyHost = null ;
  -
  -                if ( HTTPProxyHost != null ) {
  -                    String tmp = System.getProperty( "http.proxyPort" );
  -
  -                    if ( tmp != null && tmp.equals("") ) tmp = null ;
  -                    if ( tmp == null ) HTTPProxyPort = 80 ;
  -                    else HTTPProxyPort = Integer.parseInt( tmp );
  -                }
  -
  -                if ( inSocket != null )
  -                    fromHost = (inSocket.getInetAddress()).getHostName();
  -                else
  -                    fromHost = "resend" ;
  -
  -                DateFormat   df = new SimpleDateFormat("MM/dd/yy hh:mm:ss aa");
  -
  -                time = df.format( new Date() );
  -
  -                int count = listener.connections.size();
  -
  -                listener.tableModel.insertRow(count + 1, new Object[] { 
  -                        getMessage("active00", "Active"),
  -                        time,
  -                        fromHost,
  -                        listener.hostField.getText(), "" 
  -                    }
  -                );
  -                listener.connections.add( this );
  -                inputText  = new JTextArea( null, null, 20, 80 );
  -                inputScroll = new JScrollPane( inputText );
  -                outputText = new JTextArea( null, null, 20, 80 );
  -                outputScroll = new JScrollPane( outputText );
  -
  -                ListSelectionModel lsm = listener.connectionTable.getSelectionModel();
  -
  -                if ( count == 0 || lsm.getLeadSelectionIndex() == 0 ) {
  -                    listener.outPane.setVisible( false );
  -                    int divLoc = listener.outPane.getDividerLocation();
  -
  -                    listener.setLeft( inputScroll );
  -                    listener.setRight( outputScroll );
  -
  -                    listener.removeButton.setEnabled(false);
  -                    listener.removeAllButton.setEnabled(true);
  -                    listener.saveButton.setEnabled(true);
  -                    listener.resendButton.setEnabled(true);
  -                    listener.outPane.setDividerLocation(divLoc);
  -                    listener.outPane.setVisible( true );
  -                }
  -
  -                String targetHost = listener.hostField.getText();
  -                int    targetPort = Integer.parseInt(listener.tPortField.getText());
  -
  -                InputStream  tmpIn1  = inputStream ;
  -                OutputStream tmpOut1 = null ;
  -
  -                InputStream  tmpIn2  = null ;
  -                OutputStream tmpOut2 = null ;
  -
  -                if ( tmpIn1 == null )
  -                    tmpIn1  = inSocket.getInputStream();
  -
  -                if ( inSocket != null )
  -                    tmpOut1 = inSocket.getOutputStream();
  -
  -                String         bufferedData = null ;
  -                StringBuffer   buf = null ;
  -
  -                int index = listener.connections.indexOf( this );
  -
  -                if (listener.isProxyBox.isSelected() || HTTPProxyHost != null) {
  -                    // Check if we're a proxy
  -                    byte[]       b = new byte[1];
  -
  -                    buf = new StringBuffer();
  -                    String       s ;
  -
  -                    for ( ; ; ) {
  -                        int len ;
  -
  -                        len = tmpIn1.read(b, 0, 1);
  -                        if ( len == -1 ) break ;
  -                        s = new String( b );
  -                        buf.append( s );
  -                        if ( b[0] != '\n' ) continue ;
  -                        break ;
  -                    }
  -
  -                    bufferedData = buf.toString();
  -                    inputText.append( bufferedData );
  -
  -                    if ( bufferedData.startsWith( "GET " ) ||
  -                        bufferedData.startsWith( "POST " ) ) {
  -                        int  start, end ;
  -                        URL  url ;
  -
  -                        start = bufferedData.indexOf( ' ' ) + 1;
  -                        while ( bufferedData.charAt(start) == ' ' ) start++ ;
  -                        end   = bufferedData.indexOf( ' ', start );
  -                        String urlString = bufferedData.substring( start, end );
  -
  -                        if ( urlString.charAt(0) == '/' ) urlString = urlString.substring(1);
  -                        if ( listener.isProxyBox.isSelected() ) {
  -                            url = new URL( urlString );
  -                            targetHost = url.getHost();
  -                            targetPort = url.getPort();
  -                            if ( targetPort == -1 ) targetPort = 80 ;
  -
  -                            listener.tableModel.setValueAt( targetHost, index + 1,
  -                                OUTHOST_COLUMN );
  -                            bufferedData = bufferedData.substring( 0, start) +
  -                            url.getFile() +
  -                            bufferedData.substring( end );
  -                        }
  -                        else {
  -                            url = new URL( "http://" + targetHost + ":" +
  -                                targetPort + "/" + urlString );
  -
  -                            listener.tableModel.setValueAt( targetHost, index + 1,
  -                                OUTHOST_COLUMN );
  -                            bufferedData = bufferedData.substring( 0, start) +
  -                            url.toExternalForm() +
  -                            bufferedData.substring( end );
  -
  -                            targetHost = HTTPProxyHost ;
  -                            targetPort = HTTPProxyPort ;
  -                        }
  -
  -                    }
  -                } 
  -                else {
  -                    //
  -                    // Change Host: header to point to correct host
  -                    //
  -                    byte[] b1 = new byte[1];
  -
  -                    buf = new StringBuffer();
  -                    String s1;
  -                    String lastLine = null ;
  -
  -                    for ( ; ; ) {
  -                        int len ;
  -
  -                        len = tmpIn1.read(b1, 0, 1);
  -                        if ( len == -1 )
  -                            break ;
  -                        s1 = new String( b1 );
  -                        buf.append( s1 );
  -                        if ( b1[0] != '\n' )
  -                            continue ;
  -                        // we have a complete line
  -                        String line = buf.toString();
  -
  -                        buf.setLength(0);
  -                        // check to see if we have found Host: header
  -                        if (line.startsWith("Host: ")) {
  -                            // we need to update the hostname to target host
  -                            String newHost = "Host: " + targetHost + "\r\n";
  -
  -                            bufferedData = bufferedData.concat(newHost);
  -                            break ;
  -                        }
  -                        // add it to our headers so far
  -                        if (bufferedData == null)
  -                            bufferedData = line;
  -                        else
  -                            bufferedData = bufferedData.concat(line);
  -
  -                        // failsafe
  -                        if (line.equals("\r\n")) break;
  -                        if ("\n".equals(lastLine) && line.equals("\n")) break ;
  -                        lastLine = line ;
  -                    }
  -                    if ( bufferedData != null ) {
  -                        inputText.append( bufferedData );
  -                        s1 = bufferedData.substring( 0, 50 );
  -                        int i = s1.indexOf('\n');
  -
  -                        if ( i > 0 ) s1 = s1.substring(0, i - 1);
  -                        s1 = s1 + "                           " +
  -                        "                       ";
  -                        s1 = s1.substring(0, 51);
  -                        listener.tableModel.setValueAt( s1, index + 1,
  -                            REQ_COLUMN );
  -                    }
  -                }
  -
  -                if ( targetPort == -1 ) targetPort = 80 ;
  -                outSocket = new Socket(targetHost, targetPort );
  -
  -                tmpIn2  = outSocket.getInputStream();
  -                tmpOut2 = outSocket.getOutputStream();
  -
  -                if ( bufferedData != null ) {
  -                    byte[] b = bufferedData.getBytes();
  -
  -                    tmpOut2.write( b );
  -                }
  -
  -                boolean format = listener.xmlFormatBox.isSelected();
  -
  -                rr1 = new SocketRR(this, inSocket, tmpIn1, outSocket,
  -                    tmpOut2, inputText, format,
  -                    listener.tableModel, index + 1, "request:" );
  -                rr2 = new SocketRR( this, outSocket, tmpIn2, inSocket,
  -                    tmpOut1, outputText, format,
  -                    null, 0, "response:" );
  -
  -                while ( rr1 != null || rr2 != null ) {
  -                    // Only loop as long as the connection to the target
  -                    // machine is available - once that's gone we can stop.
  -                    // The old way, loop until both are closed, left us
  -                    // looping forever since no one closed the 1st one.
  -                    // while( !rr2.isDone() ) 
  -                    if (null != rr1 && rr1.isDone()) {
  -                        if ( index >= 0  && rr2 != null) {
  -                            listener.tableModel.setValueAt(getMessage("resp00", "Resp"),
  -                                1 + index, STATE_COLUMN );
  -                        }
  -                       rr1 = null;
  -                    }
  -                    if (null != rr2 && rr2.isDone()) {
  -                        if ( index >= 0 && rr1 != null ) {
  -                            listener.tableModel.setValueAt(getMessage("req00", "Req"),
  -                                1 + index, STATE_COLUMN );
  -                        }
  -                        rr2 = null;
  -                    }
  -
  -                    //  Thread.sleep( 10 );
  -                    synchronized ( this) {
  -                        wait(1000); //Safety just incase we're not told to wake up.
  -                    }
  -                }
  -
  -                //  System.out.println("Done ");
  -                // rr1.halt();
  -                // rr2.halt();
  -
  -
  -                active = false ;
  -
  -                /*
  -                 if ( inSocket != null ) {
  -                 inSocket.close();
  -                 inSocket = null ;
  -                 }
  -                 outSocket.close();
  -                 outSocket = null ;
  -                 */
  -
  -                if ( index >= 0 ) {
  -                    listener.tableModel.setValueAt(getMessage("done00", "Done"),
  -                        1 + index, STATE_COLUMN );
  -
  -                }
  -            }
  -            catch ( Exception e ) {
  -                StringWriter st = new StringWriter();
  -                PrintWriter  wr = new PrintWriter(st);
  -                int index = listener.connections.indexOf( this );
  -
  -                if ( index >= 0 )
  -                    listener.tableModel.setValueAt( getMessage("error00", "Error"), 1 + index, STATE_COLUMN );
  -                e.printStackTrace(wr);
  -                wr.close();
  -                outputText.append( st.toString() );
  -                halt();
  -            }
  -        }
  -
  -        synchronized void wakeUp() {
  -            notifyAll();
  -        }
  -
  -        public void halt() {
  -            try {
  -                if ( rr1 != null ) rr1.halt();
  -                if ( rr2 != null ) rr2.halt();
  -                if ( inSocket  != null ) inSocket.close();
  -                inSocket = null ;
  -                if ( outSocket != null ) outSocket.close();
  -                outSocket = null ;
  -            }
  -            catch ( Exception e ) {
  -                e.printStackTrace();
  -            }
  -        }
  -
  -        public void remove() {
  -            int index = -1;
  -
  -            try {
  -                halt();
  -                index = listener.connections.indexOf( this );
  -                listener.tableModel.removeRow( index + 1 );
  -                listener.connections.remove( index );
  -            }
  -            catch ( Exception e ) {
  -                System.err.println("index:=" + index + this );
  -                e.printStackTrace();
  -            }
  -        }
  -    }
  -
  -
  -    class Listener extends JPanel {
  -        public  Socket      inputSocket     = null ;
  -        public  Socket      outputSocket    = null ;
  -        public  JTextField  portField       = null ;
  -        public  JTextField  hostField       = null ;
  -        public  JTextField  tPortField      = null ;
  -        public  JCheckBox   isProxyBox      = null ;
  -        public  JButton     stopButton      = null ;
  -        public  JButton     removeButton    = null ;
  -        public  JButton     removeAllButton = null ;
  -        public  JCheckBox   xmlFormatBox    = null ;
  -        public  JButton     saveButton      = null ;
  -        public  JButton     resendButton    = null ;
  -        public  JButton     switchButton    = null ;
  -        public  JButton     closeButton     = null ;
  -        public  JTable      connectionTable = null ;
  -        public  DefaultTableModel  tableModel      = null ;
  -        public  JSplitPane  outPane         = null ;
  -        public  ServerSocket sSocket        = null ;
  -        public  SocketWaiter sw = null ;
  -        public  JPanel      leftPanel       = null ;
  -        public  JPanel      rightPanel      = null ;
  -        public  JTabbedPane notebook        = null ;
  -        public  String      HTTPProxyHost   = null ;
  -        public  int         HTTPProxyPort   = 80 ;
  -
  -        final public Vector connections = new Vector();
  -
  -        public Listener(JTabbedPane _notebook, String name,
  -            int listenPort, String host, int targetPort,
  -            boolean isProxy) {
  -            notebook = _notebook ;
  -            if ( name == null ) name = getMessage("port01", "Port") + " " + listenPort ;
  -
  -            this.setLayout( new BorderLayout() );
  -
  -            // 1st component is just a row of labels and 1-line entry fields
  -            /////////////////////////////////////////////////////////////////////
  -            JPanel top = new JPanel();
  -
  -            top.setLayout( new BoxLayout(top, BoxLayout.X_AXIS) );
  -            top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  -            final String start = getMessage("start00", "Start");
  -
  -            top.add( stopButton = new JButton( start ) );
  -            top.add( Box.createRigidArea(new Dimension(5, 0)) );
  -            top.add( new JLabel( "  " + getMessage("listenPort01", "Listen Port:") + " ", SwingConstants.RIGHT ) );
  -            top.add( portField = new JTextField( "" + listenPort, 4 ) );
  -            top.add( new JLabel( "  " + getMessage("host00", "Host:"), SwingConstants.RIGHT ) );
  -            top.add( hostField = new JTextField( host, 30 ) );
  -            top.add( new JLabel( "  " + getMessage("port02", "Port:") + " ", SwingConstants.RIGHT ) );
  -            top.add( tPortField = new JTextField( "" + targetPort, 4 ) );
  -            top.add( Box.createRigidArea(new Dimension(5, 0)) );
  -            top.add( isProxyBox = new JCheckBox(getMessage("proxy00", "Proxy")) );
  -
  -            isProxyBox.addChangeListener( new BasicButtonListener(isProxyBox) {
  -                    public void stateChanged(ChangeEvent event) {
  -                        JCheckBox box = (JCheckBox) event.getSource();
  -                        boolean state = box.isSelected();
  -
  -                        tPortField.setEnabled( !state );
  -                        hostField.setEnabled( !state );
  -                    }
  -                }
  -            );
  -
  -            isProxyBox.setSelected(isProxy);
  -
  -            portField.setEditable(false);
  -            portField.setMaximumSize(new Dimension(50, Short.MAX_VALUE) );
  -            hostField.setEditable(false);
  -            hostField.setMaximumSize(new Dimension(85, Short.MAX_VALUE) );
  -            tPortField.setEditable(false);
  -            tPortField.setMaximumSize(new Dimension(50, Short.MAX_VALUE) );
  -
  -            stopButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if ( getMessage("stop00", "Stop").equals(event.getActionCommand()) ) stop();
  -                        if ( start.equals(event.getActionCommand()) ) start();
  -                    }
  -                }
  -            );
  -
  -            this.add( top, BorderLayout.NORTH );
  -
  -            // 2nd component is a split pane with a table on the top
  -            // and the request/response text areas on the bottom
  -            /////////////////////////////////////////////////////////////////////
  -
  -            tableModel = new DefaultTableModel(new String[] {
  -                    getMessage("state00", "State"),
  -                    getMessage("time00", "Time"),
  -                    getMessage("requestHost00", "Request Host"),
  -                    getMessage("targetHost", "Target Host"),
  -                    getMessage("request00", "Request...")
  -                } , 0 );
  -
  -            connectionTable = new JTable(1, 2);
  -            connectionTable.setModel( tableModel );
  -            connectionTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  -            // Reduce the STATE column and increase the REQ column
  -            TableColumn col ;
  -
  -            col = connectionTable.getColumnModel().getColumn(STATE_COLUMN);
  -            col.setMaxWidth( col.getPreferredWidth() / 2 );
  -            col = connectionTable.getColumnModel().getColumn(REQ_COLUMN);
  -            col.setPreferredWidth( col.getPreferredWidth() * 2 );
  -
  -
  -            ListSelectionModel sel = connectionTable.getSelectionModel();
  -
  -            sel.addListSelectionListener( new ListSelectionListener() {
  -                    public void valueChanged(ListSelectionEvent event) {
  -                        if (event.getValueIsAdjusting()) return ;
  -                        ListSelectionModel m = (ListSelectionModel) event.getSource();
  -                        int divLoc = outPane.getDividerLocation();
  -
  -                        if (m.isSelectionEmpty()) {
  -                            setLeft( new JLabel(" " + getMessage("wait00", "Waiting for Connection...") ) );
  -                            setRight( new JLabel("") );
  -                            removeButton.setEnabled(false);
  -                            removeAllButton.setEnabled(false);
  -                            saveButton.setEnabled(false);
  -                            resendButton.setEnabled(false);
  -                        }
  -                        else {
  -                            int row = m.getLeadSelectionIndex();
  -
  -                            if ( row == 0 ) {
  -                                if ( connections.size() == 0 ) {
  -                                    setLeft(new JLabel(" " + getMessage("wait00", "Waiting for connection...")));
  -                                    setRight(new JLabel(""));
  -                                    removeButton.setEnabled(false);
  -                                    removeAllButton.setEnabled(false);
  -                                    saveButton.setEnabled(false);
  -                                    resendButton.setEnabled(false);
  -                                }
  -                                else {
  -                                    Connection conn = (Connection) connections.lastElement();
  -
  -                                    setLeft( conn.inputScroll );
  -                                    setRight( conn.outputScroll );
  -                                    removeButton.setEnabled(false);
  -                                    removeAllButton.setEnabled(true);
  -                                    saveButton.setEnabled(true);
  -                                    resendButton.setEnabled(true);
  -                                }
  -                            }
  -                            else {
  -                                Connection conn = (Connection) connections.get(row - 1);
  -
  -                                setLeft( conn.inputScroll );
  -                                setRight( conn.outputScroll );
  -                                removeButton.setEnabled(true);
  -                                removeAllButton.setEnabled(true);
  -                                saveButton.setEnabled(true);
  -                                resendButton.setEnabled(true);
  -                            }
  -                        }
  -                        outPane.setDividerLocation(divLoc);
  -                    }
  -                } 
  -            );
  -            tableModel.addRow( new Object[] { 
  -                    "---", getMessage("mostRecent00", "Most Recent"), "---", "---", "---" 
  -                } 
  -            );
  -
  -            JPanel  tablePane = new JPanel();
  -
  -            tablePane.setLayout( new BorderLayout() );
  -
  -            JScrollPane tableScrollPane = new JScrollPane( connectionTable );
  -
  -            tablePane.add( tableScrollPane, BorderLayout.CENTER );
  -            JPanel buttons = new JPanel();
  -
  -            buttons.setLayout( new BoxLayout(buttons, BoxLayout.X_AXIS) );
  -            buttons.setBorder( BorderFactory.createEmptyBorder(5, 5, 5, 5) );
  -            final String removeSelected = getMessage("removeSelected00", "Remove Selected");
  -
  -            buttons.add( removeButton = new JButton(removeSelected) );
  -            buttons.add( Box.createRigidArea(new Dimension(5, 0)) );
  -            final String removeAll = getMessage("removeAll00", "Remove All");
  -
  -            buttons.add( removeAllButton = new JButton(removeAll) );
  -            tablePane.add( buttons, BorderLayout.SOUTH );
  -
  -            removeButton.setEnabled( false );
  -            removeButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if ( removeSelected.equals(event.getActionCommand()) ) remove();
  -                    }
  -                }
  -            );
  -
  -            removeAllButton.setEnabled( false );
  -            removeAllButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if ( removeAll.equals(event.getActionCommand()) ) removeAll();
  -                    }
  -                }
  -            );
  -
  -            // Add Response Section
  -            /////////////////////////////////////////////////////////////////////
  -            JPanel     pane2     = new JPanel();
  -
  -            pane2.setLayout( new BorderLayout() );
  -
  -            leftPanel = new JPanel();
  -            leftPanel.setAlignmentX( Component.LEFT_ALIGNMENT );
  -            leftPanel.setLayout( new BoxLayout(leftPanel, BoxLayout.Y_AXIS) );
  -            leftPanel.add( new JLabel("  " + getMessage("request01", "Request")) );
  -            leftPanel.add( new JLabel(" " + getMessage("wait01", "Waiting for connection") ));
  -
  -            rightPanel = new JPanel();
  -            rightPanel.setLayout( new BoxLayout(rightPanel, BoxLayout.Y_AXIS) );
  -            rightPanel.add( new JLabel("  " + getMessage("response00", "Response")) );
  -            rightPanel.add( new JLabel("") );
  -
  -            outPane = new JSplitPane(0, leftPanel, rightPanel );
  -            outPane.setDividerSize(4);
  -            pane2.add( outPane, BorderLayout.CENTER );
  -
  -            JPanel bottomButtons = new JPanel();
  -
  -            bottomButtons.setLayout( new BoxLayout(bottomButtons, BoxLayout.X_AXIS));
  -            bottomButtons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  -            bottomButtons.add( xmlFormatBox = new JCheckBox( getMessage("xmlFormat00", "XML Format") ) );
  -            bottomButtons.add( Box.createRigidArea(new Dimension(5, 0)) );
  -            final String save = getMessage("save00", "Save");
  -
  -            bottomButtons.add( saveButton = new JButton( save ) );
  -            bottomButtons.add( Box.createRigidArea(new Dimension(5, 0)) );
  -            final String resend = getMessage("resend00", "Resend");
  -
  -            bottomButtons.add( resendButton = new JButton( resend ) );
  -            bottomButtons.add( Box.createRigidArea(new Dimension(5, 0)) );
  -            final String switchStr = getMessage("switch00", "Switch Layout");
  -
  -            bottomButtons.add( switchButton = new JButton( switchStr ) );
  -            bottomButtons.add( Box.createHorizontalGlue() );
  -            final String close = getMessage("close00", "Close");
  -
  -            bottomButtons.add( closeButton = new JButton( close ) );
  -            pane2.add( bottomButtons, BorderLayout.SOUTH );
  -
  -            saveButton.setEnabled( false );
  -            saveButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if ( save.equals(event.getActionCommand()) ) save();
  -                    }
  -                }
  -            );
  -
  -            resendButton.setEnabled( false );
  -            resendButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if ( resend.equals(event.getActionCommand()) ) resend();
  -                    }
  -                }
  -            );
  -
  -            switchButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if (switchStr.equals(event.getActionCommand()) ) {
  -                            int v = outPane.getOrientation();
  -
  -                            if ( v == 0 )  // top/bottom
  -                                outPane.setOrientation(1);
  -                            else  // left/right
  -                                outPane.setOrientation(0);
  -                            outPane.setDividerLocation(0.5);
  -                        }
  -                    }
  -                }
  -            );
  -
  -            closeButton.addActionListener( new ActionListener() {
  -                    public void actionPerformed(ActionEvent event) {
  -                        if (close.equals(event.getActionCommand()) )
  -                            close();
  -                    }
  -                }
  -            );
  -
  -            JSplitPane  pane1 = new JSplitPane( 0 );
  -
  -            pane1.setDividerSize(4);
  -            pane1.setTopComponent( tablePane );
  -            pane1.setBottomComponent( pane2 );
  -            pane1.setDividerLocation( 150 );
  -            this.add( pane1, BorderLayout.CENTER );
  -
  -            // 
  -            ////////////////////////////////////////////////////////////////////
  -            sel.setSelectionInterval(0, 0);
  -            outPane.setDividerLocation( 150 );
  -            notebook.addTab( name, this );
  -            start();
  -        }
  -
  -        public void setLeft(Component left) {
  -            leftPanel.remove(1);
  -            leftPanel.add(left);
  -        }
  -
  -        public void setRight(Component right) {
  -            rightPanel.remove(1);
  -            rightPanel.add(right);
  -        }
  -
  -        public void start() {
  -            int  port = Integer.parseInt( portField.getText() );
  -
  -            portField.setText( "" + port );
  -            int i = notebook.indexOfComponent( this );
  -
  -            notebook.setTitleAt( i, getMessage("port01", "Port") + " " + port );
  -
  -            int  tmp = Integer.parseInt( tPortField.getText() );
  -
  -            tPortField.setText( "" + tmp );
  -
  -            sw = new SocketWaiter( this, port );
  -            stopButton.setText( getMessage("stop00", "Stop") );
  -
  -            portField.setEditable(false);
  -            hostField.setEditable(false);
  -            tPortField.setEditable(false);
  -            isProxyBox.setEnabled(false);
  -        }
  -
  -        public void close() {
  -            stop();
  -            notebook.remove( this );
  -        }
  -
  -        public void stop() {
  -            try {
  -                for ( int i = 0 ; i < connections.size() ; i++ ) {
  -                    Connection conn = (Connection) connections.get( i );
  -
  -                    conn.halt();
  -                }
  -                sw.halt();
  -                stopButton.setText( getMessage("start00", "Start") );
  -                portField.setEditable(true);
  -                hostField.setEditable(true);
  -                tPortField.setEditable(true);
  -                isProxyBox.setEnabled(true);
  -            }
  -            catch ( Exception e ) {
  -                e.printStackTrace();
  -            }
  -        }
  -
  -        public void remove() {
  -            ListSelectionModel lsm = connectionTable.getSelectionModel();
  -            int bot = lsm.getMinSelectionIndex();
  -            int top = lsm.getMaxSelectionIndex();
  -
  -            for ( int i = top ; i >= bot ; i-- ) {
  -                ((Connection) connections.get(i - 1)).remove();
  -            }
  -            if ( bot > connections.size() ) bot = connections.size();
  -            lsm.setSelectionInterval(bot, bot);
  -        }
  -
  -        public void removeAll() {
  -            ListSelectionModel lsm = connectionTable.getSelectionModel();
  -            lsm.clearSelection();
  -            while ( connections.size() > 0 )
  -                ((Connection) connections.get(0)).remove();
  -
  -            lsm.setSelectionInterval(0, 0);
  -        }
  -
  -        public void save() {
  -            JFileChooser  dialog = new JFileChooser( "." );
  -            int rc = dialog.showSaveDialog( this );
  -
  -            if ( rc == JFileChooser.APPROVE_OPTION ) {
  -                try {
  -                    File             file = dialog.getSelectedFile();
  -                    FileOutputStream out  = new FileOutputStream( file );
  -
  -                    ListSelectionModel lsm = connectionTable.getSelectionModel();
  -
  -                    rc = lsm.getLeadSelectionIndex();
  -                    if ( rc == 0 ) rc = connections.size();
  -                    Connection conn = (Connection) connections.get( rc - 1 );
  -
  -                    rc = Integer.parseInt( portField.getText() );
  -                    out.write( (new String(getMessage("listenPort01", "Listen Port:") + " " + rc + "\n" )).getBytes() );
  -                    out.write( (new String(getMessage("targetHost01", "Target Host:") + " " + hostField.getText() +
  -                                "\n" )).getBytes() );
  -                    rc = Integer.parseInt( tPortField.getText() );
  -                    out.write( (new String(getMessage("targetPort01", "Target Port:") + " " + rc + "\n" )).getBytes() );
  -
  -                    out.write( (new String("==== " + getMessage("request01", "Request") + " ====\n" )).getBytes() );
  -                    out.write( conn.inputText.getText().getBytes() );
  -
  -                    out.write( (new String("==== " + getMessage("response00", "Response") + " ====\n" )).getBytes() );
  -                    out.write( conn.outputText.getText().getBytes() );
  -
  -                    out.close();
  -                }
  -                catch ( Exception e ) {
  -                    e.printStackTrace();
  -                }
  -            }
  -        }
  -
  -        public void resend() {
  -            int rc ;
  -
  -            try {
  -                ListSelectionModel lsm = connectionTable.getSelectionModel();
  -
  -                rc = lsm.getLeadSelectionIndex();
  -                if ( rc == 0 ) rc = connections.size();
  -                Connection conn = (Connection) connections.get( rc - 1 );
  -
  -                if ( rc > 0 ) {
  -                    lsm.clearSelection();
  -                    lsm.setSelectionInterval(0, 0);
  -                }
  -
  -                InputStream in = null ;
  -                String      text = conn.inputText.getText();
  -
  -                // Fix Content-Length HTTP headers
  -                if ( text.startsWith("POST ") || text.startsWith("GET ") ) {
  -                    System.err.println("IN CL" );
  -                    int         pos1, pos2, pos3 ;
  -                    String      body, headers, headers1, header2 ;
  -
  -                    pos3 = text.indexOf( "\n\n" );
  -                    if ( pos3 == -1 ) {
  -                        pos3 = text.indexOf( "\r\n\r\n" );
  -                        if ( pos3 != -1 ) pos3 = pos3 + 4 ;
  -                    }
  -                    else
  -                        pos3 += 2 ;
  -
  -                    headers = text.substring( 0, pos3 );
  -
  -                    pos1 = headers.indexOf( "Content-Length:" );
  -                    System.err.println("pos1: " + pos1 );
  -                    System.err.println("pos3: " + pos3 );
  -                    if ( pos1 != -1 ) {
  -                        int  newLen = text.length() - pos3 ;
  -
  -                        pos2 = headers.indexOf( "\n", pos1 );
  -
  -                        System.err.println("CL: " + newLen );
  -                        System.err.println("Hdrs: '" + headers + "'" );
  -                        System.err.println("subTEXT: '" +
  -                            text.substring(pos3, pos3 + newLen) + "'");
  -                        text = headers.substring(0, pos1) +
  -                        "Content-Length: " + newLen + "\n" +
  -                        headers.substring(pos2 + 1) +
  -                        text.substring(pos3) ;
  -                        System.err.println("\nTEXT: '" + text + "'" );
  -                    }
  -                }
  -
  -                in = new ByteArrayInputStream( text.getBytes() );
  -                new Connection( this, in );
  -            }
  -            catch ( Exception e ) {
  -                e.printStackTrace();
  -            }
  -        }
  -    }
  -
  -
  -    public tcpmon(int listenPort, String targetHost, int targetPort) {
  -        super ( getMessage("tcpmon00", "TCPMonitor") );
  -
  -        notebook = new JTabbedPane();
  -        this.getContentPane().add( notebook );
  -
  -        new AdminPage( notebook, getMessage("admin00", "Admin") );
  -
  -        if ( listenPort != 0 ) {
  -            Listener l = null ;
  -
  -            if ( targetHost == null )
  -                l = new Listener( notebook, null, listenPort,
  -                    targetHost, targetPort, true );
  -            else
  -                l = new Listener( notebook, null, listenPort,
  -                    targetHost, targetPort, false );
  -            notebook.setSelectedIndex( 1 );
  -
  -            l.HTTPProxyHost = System.getProperty( "http.proxyHost" );
  -            if ( l.HTTPProxyHost != null && l.HTTPProxyHost.equals("") )
  -                l.HTTPProxyHost = null ;
  -
  -            if ( l.HTTPProxyHost != null ) {
  -                String tmp = System.getProperty( "http.proxyPort" );
  -
  -                if ( tmp != null && tmp.equals("") ) tmp = null ;
  -                if ( tmp == null ) l.HTTPProxyPort = 80 ;
  -                else l.HTTPProxyPort = Integer.parseInt( tmp );
  -            }
  -        }
  -
  -        this.pack();
  -        this.setSize( 600, 600 );
  -        this.setVisible( true );
  -    }
  -
  -    protected void processWindowEvent(WindowEvent event) {
  -        switch ( event.getID() ) {
  -        case WindowEvent.WINDOW_CLOSING: 
  -            exit();
  -            break ;
  -
  -        default: 
  -            super.processWindowEvent(event);
  -            break ;
  -        }
  -    }
  -
  -    private void exit() {
  -        System.exit(0);
  -    }
  -
  -    public void setInputPort(int port) {
  -    }
  -
  -    public void setOutputHostPort(char hostName, int port) {
  -    }
  -
  -    public static void main(String[] args) {
  -        try {
  -            if ( args.length == 3 ) {
  -                int p1 = Integer.parseInt( args[0] );
  -                int p2 = Integer.parseInt( args[2] );
  -
  -                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  -                new tcpmon( p1, args[1], p2 );
  -            }
  -            else if ( args.length == 1 ) {
  -                int p1 = Integer.parseInt( args[0] );
  -
  -                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  -                new tcpmon( p1, null, 0 );
  -            }
  -            else if ( args.length != 0 ) {
  -                System.err.println( getMessage("usage00", "Usage:") + " tcpmon [listenPort targetHost targetPort]\n");
  -            }
  -            else {
  -                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  -                new tcpmon(0, null, 0);
  -            }
  -        }
  -        catch ( Throwable exp ) {
  -            exp.printStackTrace();
  -        }
  -    }
  -
  -    // Message resource bundle.
  -    private static ResourceBundle messages = null;
  -
  -    /**
  -     * Get the message with the given key.  There are no arguments for this message.
  -     */
  -    public static String getMessage(String key, String defaultMsg) {
  -        try {
  -            if (messages == null) {
  -                initializeMessages();
  -            }
  -            return messages.getString(key);
  -        }
  -        catch (Throwable t) {
  -            // If there is any problem whatsoever getting the internationalized
  -            // message, return the default.
  -            return defaultMsg;
  -        }
  -    } // getMessage
  -
  -    /**
  -     * Load the resource bundle messages from the properties file.  This is ONLY done when it is
  -     * needed.  If no messages are printed (for example, only Wsdl2java is being run in non-
  -     * verbose mode) then there is no need to read the properties file.
  -     */
  -    private static void initializeMessages() {
  -        messages = ResourceBundle.getBundle("org.apache.axis.utils.tcpmon");
  -    } // initializeMessages
  -
  -}
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.utils ;
  +
  +
  +import javax.swing.BorderFactory;
  +import javax.swing.Box;
  +import javax.swing.BoxLayout;
  +import javax.swing.ButtonGroup;
  +import javax.swing.JButton;
  +import javax.swing.JCheckBox;
  +import javax.swing.JFileChooser;
  +import javax.swing.JFrame;
  +import javax.swing.JLabel;
  +import javax.swing.JPanel;
  +import javax.swing.JRadioButton;
  +import javax.swing.JScrollPane;
  +import javax.swing.JSplitPane;
  +import javax.swing.JTabbedPane;
  +import javax.swing.JTable;
  +import javax.swing.JTextArea;
  +import javax.swing.JTextField;
  +import javax.swing.ListSelectionModel;
  +import javax.swing.SwingConstants;
  +import javax.swing.UIManager;
  +import javax.swing.border.TitledBorder;
  +import javax.swing.event.ChangeEvent;
  +import javax.swing.event.ListSelectionEvent;
  +import javax.swing.event.ListSelectionListener;
  +import javax.swing.plaf.basic.BasicButtonListener;
  +import javax.swing.table.DefaultTableModel;
  +import javax.swing.table.TableColumn;
  +import javax.swing.table.TableModel;
  +import java.awt.*;
  +import java.awt.event.ActionEvent;
  +import java.awt.event.ActionListener;
  +import java.awt.event.WindowEvent;
  +import java.io.ByteArrayInputStream;
  +import java.io.File;
  +import java.io.FileOutputStream;
  +import java.io.InputStream;
  +import java.io.OutputStream;
  +import java.io.PrintWriter;
  +import java.io.StringWriter;
  +import java.net.InetAddress;
  +import java.net.ServerSocket;
  +import java.net.Socket;
  +import java.net.URL;
  +import java.text.DateFormat;
  +import java.text.MessageFormat;
  +import java.text.SimpleDateFormat;
  +import java.util.Date;
  +import java.util.ResourceBundle;
  +import java.util.Vector;
  +
  +
  +/**
  + * @author Doug Davis (dug@us.ibm.com)
  + */
  +
  +public class tcpmon extends JFrame {
  +    private JTabbedPane  notebook = null ;
  +
  +    static private int STATE_COLUMN    = 0 ;
  +    static private int TIME_COLUMN     = 1 ;
  +    static private int INHOST_COLUMN   = 2 ;
  +    static private int OUTHOST_COLUMN  = 3 ;
  +    static private int REQ_COLUMN      = 4 ;
  +
  +    class AdminPage extends JPanel {
  +        public JRadioButton  listenerButton, proxyButton ;
  +        public JLabel        hostLabel, tportLabel;
  +        public JTextField    port, host, tport ;
  +        public JTabbedPane   noteb ;
  +        public JCheckBox     HTTPProxyBox ;
  +        public JTextField    HTTPProxyHost, HTTPProxyPort ;
  +        public JLabel        HTTPProxyHostLabel, HTTPProxyPortLabel ;
  +
  +        public AdminPage( JTabbedPane notebook, String name ) {
  +            JPanel     mainPane  = null ;
  +            JButton    addButton = null ;
  +
  +            this.setLayout( new BorderLayout() );
  +            noteb = notebook ;
  +
  +            GridBagLayout       layout        = new GridBagLayout();
  +            GridBagConstraints  c             = new GridBagConstraints();
  +
  +            mainPane = new JPanel(layout);
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER;
  +            mainPane.add( new JLabel(getMessage("newTCP00", "Create a new TCP/IP Monitor...") + " "), c );
  +
  +            // Add some blank space
  +            mainPane.add( Box.createRigidArea(new Dimension(1, 5)), c );
  +
  +            // The listener info
  +            ///////////////////////////////////////////////////////////////////
  +            JPanel   tmpPanel = new JPanel(new GridBagLayout());
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = 1 ;
  +            tmpPanel.add( new JLabel(getMessage("listenPort00", "Listen Port #") + " "), c );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            tmpPanel.add( port = new JTextField(4), c );
  +
  +            mainPane.add( tmpPanel, c );
  +
  +            mainPane.add( Box.createRigidArea(new Dimension(1, 5)), c );
  +
  +            // Group for the radio buttons
  +            ButtonGroup btns = new ButtonGroup();
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            mainPane.add( new JLabel(getMessage("actAs00", "Act as a...") ), c );
  +
  +            // Target Host/Port section
  +            ///////////////////////////////////////////////////////////////////
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +
  +            final String listener = getMessage("listener00", "Listener");
  +
  +            mainPane.add( listenerButton  = new JRadioButton( listener ), c );
  +            btns.add( listenerButton );
  +            listenerButton.setSelected( true );
  +
  +            listenerButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if (listener.equals(event.getActionCommand())) {
  +                            boolean state = listenerButton.isSelected();
  +
  +                            tport.setEnabled( state );
  +                            host.setEnabled( state );
  +                            hostLabel.setForeground(state ? Color.black : Color.gray);
  +                            tportLabel.setForeground(state ? Color.black : Color.gray);
  +                        }
  +                    }
  +                }
  +            );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = 1 ;
  +            mainPane.add( Box.createRigidArea(new Dimension(25, 0)) );
  +            mainPane.add( hostLabel = new JLabel(getMessage("targetHostname00", "Target Hostname") + " "), c );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            mainPane.add( host = new JTextField(30), c );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = 1 ;
  +            mainPane.add( Box.createRigidArea(new Dimension(25, 0)) );
  +            mainPane.add( tportLabel = new JLabel(getMessage("targetPort00", "Target Port #") + " "), c );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            mainPane.add( tport = new JTextField(4), c );
  +
  +            // Act as proxy section
  +            ///////////////////////////////////////////////////////////////////
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            final String proxy = getMessage("proxy00", "Proxy");
  +
  +            mainPane.add( proxyButton = new JRadioButton( proxy ), c);
  +            btns.add( proxyButton );
  +
  +            proxyButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if (proxy.equals(event.getActionCommand())) {
  +                            boolean state = proxyButton.isSelected();
  +
  +                            tport.setEnabled( !state );
  +                            host.setEnabled( !state );
  +                            hostLabel.setForeground(state ? Color.gray : Color.black);
  +                            tportLabel.setForeground(state ? Color.gray : Color.black);
  +                        }
  +                    }
  +                }
  +            );
  +
  +            // Spacer
  +            /////////////////////////////////////////////////////////////////
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            mainPane.add( Box.createRigidArea(new Dimension(1, 10)), c );
  +
  +            // Options section
  +            ///////////////////////////////////////////////////////////////////
  +            JPanel       opts = new JPanel(new GridBagLayout());
  +
  +            opts.setBorder( new TitledBorder(getMessage("options00", "Options")) );
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            mainPane.add( opts, c );
  +
  +            // HTTP Proxy Support section
  +            ///////////////////////////////////////////////////////////////////
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            final String proxySupport = getMessage("proxySupport00", "HTTP Proxy Support");
  +
  +            opts.add(HTTPProxyBox = new JCheckBox(proxySupport), c);
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = 1 ;
  +            opts.add( HTTPProxyHostLabel = new JLabel(getMessage("hostname00", "Hostname") + " "), c );
  +            HTTPProxyHostLabel.setForeground( Color.gray );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            opts.add( HTTPProxyHost = new JTextField(30), c );
  +            HTTPProxyHost.setEnabled( false );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = 1 ;
  +            opts.add( HTTPProxyPortLabel = new JLabel(getMessage("port00", "Port #") + " "), c );
  +            HTTPProxyPortLabel.setForeground( Color.gray );
  +
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            opts.add( HTTPProxyPort = new JTextField(4), c );
  +            HTTPProxyPort.setEnabled( false );
  +
  +            HTTPProxyBox.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if (proxySupport.equals(event.getActionCommand())) {
  +                            boolean b = HTTPProxyBox.isSelected();
  +                            Color   color = b ? Color.black : Color.gray ;
  +
  +                            HTTPProxyHost.setEnabled( b );
  +                            HTTPProxyPort.setEnabled( b );
  +                            HTTPProxyHostLabel.setForeground( color );
  +                            HTTPProxyPortLabel.setForeground( color );
  +                        }
  +                    }
  +                    ;
  +                }
  +            );
  +
  +            // Set default proxy values...
  +            String tmp = System.getProperty( "http.proxyHost" );
  +
  +            if ( tmp != null && tmp.equals("") )
  +                tmp = null ;
  +
  +            HTTPProxyBox.setSelected( tmp != null );
  +            HTTPProxyHost.setEnabled( tmp != null );
  +            HTTPProxyPort.setEnabled( tmp != null );
  +            HTTPProxyHostLabel.setForeground( tmp != null ? Color.black : Color.gray);
  +            HTTPProxyPortLabel.setForeground( tmp != null ? Color.black : Color.gray);
  +
  +            if ( tmp != null ) {
  +                HTTPProxyBox.setSelected( true );
  +                HTTPProxyHost.setText( tmp );
  +                tmp = System.getProperty( "http.proxyPort" );
  +                if ( tmp != null && tmp.equals("") ) tmp = null ;
  +                if ( tmp == null ) tmp = "80" ;
  +                HTTPProxyPort.setText( tmp );
  +            }
  +
  +            // Spacer
  +            //////////////////////////////////////////////////////////////////
  +            mainPane.add( Box.createRigidArea(new Dimension(1, 10)), c );
  +
  +            // ADD Button
  +            ///////////////////////////////////////////////////////////////////
  +            c.anchor    = GridBagConstraints.WEST ;
  +            c.gridwidth = GridBagConstraints.REMAINDER ;
  +            final String add = getMessage("add00", "Add");
  +
  +            mainPane.add( addButton = new JButton( add ), c );
  +
  +
  +            this.add( new JScrollPane( mainPane ), BorderLayout.CENTER );
  +
  +            // addButton.setEnabled( false );
  +            addButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if ( add.equals(event.getActionCommand()) ) {
  +                            String   text ;
  +                            Listener l = null ;
  +                            int      lPort = Integer.parseInt(port.getText());
  +                            String   tHost = host.getText();
  +                            int      tPort = 0 ;
  +
  +                            text = tport.getText();
  +                            if ( text != null && !text.equals("") )
  +                                tPort = Integer.parseInt(text);
  +                            l = new Listener( noteb, null, lPort, tHost, tPort,
  +                                proxyButton.isSelected() );
  +
  +                            // Pick-up the HTTP Proxy settings
  +                            ///////////////////////////////////////////////////
  +                            text = HTTPProxyHost.getText();
  +                            if ( "".equals(text) ) text = null ;
  +                            l.HTTPProxyHost = text ;
  +                            text = HTTPProxyPort.getText();
  +                            if ( "".equals(text) ) text = null ;
  +                            if ( text != null )
  +                                l.HTTPProxyPort = Integer.parseInt(text);
  +
  +                            port.setText(null);
  +                            host.setText(null);
  +                            tport.setText(null);
  +                        }
  +                    }
  +                    ;
  +                }
  +            );
  +
  +            notebook.addTab( name, this );
  +            notebook.repaint();
  +            notebook.setSelectedIndex( notebook.getTabCount() - 1 );
  +        }
  +    }
  +
  +    class SocketWaiter extends Thread {
  +        ServerSocket  sSocket = null ;
  +        Listener      listener ;
  +        int           port ;
  +        boolean       pleaseStop = false ;
  +
  +        public SocketWaiter(Listener l, int p) {
  +            listener = l ;
  +            port = p ;
  +            start();
  +        }
  +
  +        public void run() {
  +            try {
  +                listener.setLeft( new JLabel(getMessage("wait00", " Waiting for Connection...") ) );
  +                listener.repaint();
  +                sSocket = new ServerSocket( port );
  +                for (; ; ) {
  +                    Socket inSocket = sSocket.accept();
  +
  +                    if ( pleaseStop ) break ;
  +                    new Connection( listener, inSocket );
  +                    inSocket = null ;
  +                }
  +            }
  +            catch ( Exception exp ) {
  +                if ( !"socket closed".equals(exp.getMessage()) ) {
  +                    JLabel tmp = new JLabel( exp.toString() );
  +
  +                    tmp.setForeground( Color.red );
  +                    listener.setLeft( tmp );
  +                    listener.setRight( new JLabel("") );
  +                    listener.stop();
  +                }
  +            }
  +        }
  +
  +        public void halt() {
  +            try {
  +                pleaseStop = true ;
  +                new Socket( "127.0.0.1", port );
  +                if ( sSocket != null ) sSocket.close();
  +            }
  +            catch ( Exception e ) {
  +                e.printStackTrace();
  +            }
  +        }
  +    }
  +
  +
  +    class SocketRR extends Thread {
  +        Socket        inSocket  = null ;
  +        Socket        outSocket  = null ;
  +        JTextArea     textArea ;
  +        InputStream   in = null ;
  +        OutputStream  out = null ;
  +        boolean       xmlFormat ;
  +        volatile boolean       done = false ;
  +        TableModel    tmodel = null ;
  +        int           tableIndex = 0 ;
  +        String type = null;
  +        Connection    myConnection = null;
  +
  +        public SocketRR(Connection c, Socket inputSocket, InputStream inputStream,
  +            Socket outputSocket, OutputStream outputStream,
  +            JTextArea _textArea, boolean format,
  +            TableModel tModel, int index, final String type) {
  +            inSocket = inputSocket ;
  +            in       = inputStream ;
  +            outSocket = outputSocket ;
  +            out       = outputStream ;
  +            textArea  = _textArea ;
  +            xmlFormat = format ;
  +            tmodel    = tModel ;
  +            tableIndex = index ;
  +            this.type = type;
  +            myConnection = c;
  +            start();
  +        }
  +
  +        public boolean isDone() {
  +            return ( done );
  +        }
  +
  +        public void run() {
  +            try {
  +                byte[]      buffer = new byte[4096];
  +                byte[]      tmpbuffer = new byte[8192];
  +                int         saved = 0 ;
  +                int         len ;
  +                int         i1, i2 ;
  +                int         i ;
  +                int         reqSaved = 0 ;
  +                int         tabWidth = 3 ;
  +                boolean     atMargin = true ;
  +                int         thisIndent = -1,
  +                    nextIndent = -1,
  +                    previousIndent = -1;
  +
  +                //if ( inSocket  != null ) inSocket.setSoTimeout( 10 );
  +                //if ( outSocket != null ) outSocket.setSoTimeout( 10 );
  +
  +                if ( tmodel != null ) {
  +                    String tmpStr = (String) tmodel.getValueAt(tableIndex,
  +                            REQ_COLUMN);
  +
  +                    if ( !"".equals(tmpStr) )
  +                        reqSaved = tmpStr.length();
  +                }
  +
  +                a:
  +                for ( ; ; ) {
  +                    if ( done ) break;
  +                    //try{
  +                    //len = in.available();
  +                    //}catch(Exception e){len=0;}
  +                    len = buffer.length ;
  +                    // Used to be 1, but if we block it doesn't matter 
  +                    // however 1 will break with some servers, including apache
  +                    if ( len == 0 ) len = buffer.length;
  +                    if ( saved + len > buffer.length) len = buffer.length - saved ;
  +                    int len1 = 0;
  +
  +                    while ( len1 == 0 ) {
  +                        try {
  +                            len1 = in.read(buffer, saved, len);
  +                        } 
  +                        catch ( Exception ex ) {
  +                            if ( done && saved == 0  ) break a;
  +                            len1 = -1;
  +                            break;
  +                        }
  +                    }
  +                    len = len1;
  +
  +                    if ( len == -1 && saved == 0 ) break ;
  +                    if ( len == -1) done = true;
  +
  +                    // No matter how we may (or may not) format it, send it
  +                    // on unformatted - we don't want to mess with how its
  +                    // sent to the other side, just how its displayed
  +                    if ( out != null && len > 0 ) {
  +                        out.write( buffer, saved, len );
  +                    }
  +
  +                    if ( tmodel != null && reqSaved < 50 ) {
  +                        String old = (String) tmodel.getValueAt( tableIndex,
  +                                REQ_COLUMN);
  +
  +                        old = old + new String(buffer, saved, len);
  +                        if ( old.length() > 50 )
  +                            old = old.substring(0, 50);
  +
  +                        reqSaved = old.length();
  +
  +                        if ( (i = old.indexOf('\n')) > 0 ) {
  +                            old = old.substring(0, i - 1);
  +                            reqSaved = 50 ;
  +                        }
  +
  +                        tmodel.setValueAt( old, tableIndex, REQ_COLUMN );
  +                    }
  +
  +                    if ( xmlFormat ) {
  +                        // Do XML Formatting
  +                        boolean inXML = false ;
  +                        int     bufferLen = saved ;
  +
  +                        if ( len != -1 ) bufferLen += len ;
  +                        i1 = 0 ;
  +                        i2 = 0 ;
  +                        saved = 0 ;
  +                        for ( ; i1 < bufferLen ; i1++ ) {
  +                            // Except when we're at EOF, saved last char
  +                            if ( len != -1 && i1 + 1 == bufferLen ) {
  +                                saved = 1;
  +                                break;
  +                            }
  +                            thisIndent = -1;
  +                            if ( buffer[i1] == '<' && buffer[i1 + 1] != '/' ) {
  +                                previousIndent = nextIndent++;
  +                                thisIndent = nextIndent;
  +                                inXML = true ;
  +                            }
  +                            if ( buffer[i1] == '<' && buffer[i1 + 1] == '/' ) {
  +                                if (previousIndent > nextIndent)
  +                                    thisIndent = nextIndent;
  +                                previousIndent = nextIndent--;
  +                                inXML = true ;
  +                            }
  +                            if ( buffer[i1] == '/' && buffer[i1 + 1] == '>' ) {
  +                                previousIndent = nextIndent--;
  +                                inXML = true ;
  +                            }
  +                            if ( thisIndent != -1 ) {
  +                                if ( thisIndent > 0 ) tmpbuffer[i2++] = (byte) '\n';
  +                                for ( i = tabWidth * thisIndent; i > 0; i-- )
  +                                    tmpbuffer[i2++] = (byte) ' ';
  +                            }
  +                            atMargin = ( buffer[i1] == '\n' || buffer[i1] == '\r');
  +
  +                            if ( !inXML || !atMargin ) {
  +                                tmpbuffer[i2++] = buffer[i1];
  +                            }
  +                        }
  +
  +                        textArea.append( new String( tmpbuffer, 0, i2 ) );
  +
  +                        // Shift saved bytes to the beginning
  +                        for ( i = 0 ; i < saved ; i++ )
  +                            buffer[i] = buffer[bufferLen - saved + i];
  +                    }
  +                    else {
  +                        textArea.append( new String( buffer, 0, len ) );
  +                    }
  +                // this.sleep(3);  // Let other threads have a chance to run
  +                }
  +            // this.sleep(3);  // Let other threads have a chance to run
  +            // halt();
  +            // Only set the 'done' flag if we were reading from a
  +            // Socket - if we were reading from an input stream then
  +            // we'll let the other side control when we're done
  +            //      if ( inSocket != null ) done = true ;
  +            }
  +            catch ( Exception e ) {
  +                e.printStackTrace();
  +            }
  +            finally {
  +                done = true ;
  +                try {
  +                    if (out != null) {
  +                        out.flush();
  +                        if (null != outSocket) outSocket.shutdownOutput();
  +                        else out.close();
  +                        out = null;
  +                    }
  +                } 
  +                catch (Exception e) {
  +                    ;
  +                }
  +                try {
  +                    if (in != null) {
  +                        if (inSocket != null) inSocket.shutdownInput();
  +                        else in.close();
  +                        in = null;
  +                    }
  +                }
  +                catch (Exception e) {
  +                    ;
  +                }
  +                myConnection.wakeUp();
  +            }
  +        }
  +
  +        public  void halt() {
  +            try {
  +                if ( inSocket != null )  inSocket.close();
  +                if ( outSocket != null ) outSocket.close();
  +                inSocket  = null ;
  +                outSocket = null ;
  +                if ( in != null ) in.close();
  +                if ( out != null ) out.close();
  +                in = null ;
  +                out = null ;
  +                done = true;
  +            } 
  +            catch ( Exception e ) {
  +                e.printStackTrace();
  +            }
  +        }
  +    }
  +
  +
  +    class Connection extends Thread {
  +        Listener     listener ;
  +        boolean      active ;
  +        String       fromHost ;
  +        String       time ;
  +        JTextArea    inputText    = null ;
  +        JScrollPane  inputScroll  = null ;
  +        JTextArea    outputText   = null ;
  +        JScrollPane  outputScroll = null ;
  +        Socket       inSocket     = null ;
  +        Socket       outSocket    = null ;
  +        Thread       clientThread = null ;
  +        Thread       serverThread = null ;
  +        SocketRR     rr1          = null ;
  +        SocketRR     rr2          = null ;
  +        InputStream  inputStream  = null ;
  +
  +        String       HTTPProxyHost = null ;
  +        int          HTTPProxyPort = 80 ;
  +
  +        public Connection(Listener l) {
  +            listener = l ;
  +            HTTPProxyHost = l.HTTPProxyHost ;
  +            HTTPProxyPort = l.HTTPProxyPort ;
  +        }
  +
  +        public Connection(Listener l, Socket s ) {
  +            this (l);
  +            inSocket = s ;
  +            start();
  +        }
  +
  +        public Connection(Listener l, InputStream in ) {
  +            this (l);
  +            inputStream = in ;
  +            start();
  +        }
  +
  +        public void run() {
  +            try {
  +                active        = true ;
  +
  +                HTTPProxyHost = System.getProperty( "http.proxyHost" );
  +                if ( HTTPProxyHost != null && HTTPProxyHost.equals("") )
  +                    HTTPProxyHost = null ;
  +
  +                if ( HTTPProxyHost != null ) {
  +                    String tmp = System.getProperty( "http.proxyPort" );
  +
  +                    if ( tmp != null && tmp.equals("") ) tmp = null ;
  +                    if ( tmp == null ) HTTPProxyPort = 80 ;
  +                    else HTTPProxyPort = Integer.parseInt( tmp );
  +                }
  +
  +                if ( inSocket != null )
  +                    fromHost = (inSocket.getInetAddress()).getHostName();
  +                else
  +                    fromHost = "resend" ;
  +
  +                DateFormat   df = new SimpleDateFormat("MM/dd/yy hh:mm:ss aa");
  +
  +                time = df.format( new Date() );
  +
  +                int count = listener.connections.size();
  +
  +                listener.tableModel.insertRow(count + 1, new Object[] { 
  +                        getMessage("active00", "Active"),
  +                        time,
  +                        fromHost,
  +                        listener.hostField.getText(), "" 
  +                    }
  +                );
  +                listener.connections.add( this );
  +                inputText  = new JTextArea( null, null, 20, 80 );
  +                inputScroll = new JScrollPane( inputText );
  +                outputText = new JTextArea( null, null, 20, 80 );
  +                outputScroll = new JScrollPane( outputText );
  +
  +                ListSelectionModel lsm = listener.connectionTable.getSelectionModel();
  +
  +                if ( count == 0 || lsm.getLeadSelectionIndex() == 0 ) {
  +                    listener.outPane.setVisible( false );
  +                    int divLoc = listener.outPane.getDividerLocation();
  +
  +                    listener.setLeft( inputScroll );
  +                    listener.setRight( outputScroll );
  +
  +                    listener.removeButton.setEnabled(false);
  +                    listener.removeAllButton.setEnabled(true);
  +                    listener.saveButton.setEnabled(true);
  +                    listener.resendButton.setEnabled(true);
  +                    listener.outPane.setDividerLocation(divLoc);
  +                    listener.outPane.setVisible( true );
  +                }
  +
  +                String targetHost = listener.hostField.getText();
  +                int    targetPort = Integer.parseInt(listener.tPortField.getText());
  +
  +                InputStream  tmpIn1  = inputStream ;
  +                OutputStream tmpOut1 = null ;
  +
  +                InputStream  tmpIn2  = null ;
  +                OutputStream tmpOut2 = null ;
  +
  +                if ( tmpIn1 == null )
  +                    tmpIn1  = inSocket.getInputStream();
  +
  +                if ( inSocket != null )
  +                    tmpOut1 = inSocket.getOutputStream();
  +
  +                String         bufferedData = null ;
  +                StringBuffer   buf = null ;
  +
  +                int index = listener.connections.indexOf( this );
  +
  +                if (listener.isProxyBox.isSelected() || HTTPProxyHost != null) {
  +                    // Check if we're a proxy
  +                    byte[]       b = new byte[1];
  +
  +                    buf = new StringBuffer();
  +                    String       s ;
  +
  +                    for ( ; ; ) {
  +                        int len ;
  +
  +                        len = tmpIn1.read(b, 0, 1);
  +                        if ( len == -1 ) break ;
  +                        s = new String( b );
  +                        buf.append( s );
  +                        if ( b[0] != '\n' ) continue ;
  +                        break ;
  +                    }
  +
  +                    bufferedData = buf.toString();
  +                    inputText.append( bufferedData );
  +
  +                    if ( bufferedData.startsWith( "GET " ) ||
  +                        bufferedData.startsWith( "POST " ) ) {
  +                        int  start, end ;
  +                        URL  url ;
  +
  +                        start = bufferedData.indexOf( ' ' ) + 1;
  +                        while ( bufferedData.charAt(start) == ' ' ) start++ ;
  +                        end   = bufferedData.indexOf( ' ', start );
  +                        String urlString = bufferedData.substring( start, end );
  +
  +                        if ( urlString.charAt(0) == '/' ) urlString = urlString.substring(1);
  +                        if ( listener.isProxyBox.isSelected() ) {
  +                            url = new URL( urlString );
  +                            targetHost = url.getHost();
  +                            targetPort = url.getPort();
  +                            if ( targetPort == -1 ) targetPort = 80 ;
  +
  +                            listener.tableModel.setValueAt( targetHost, index + 1,
  +                                OUTHOST_COLUMN );
  +                            bufferedData = bufferedData.substring( 0, start) +
  +                            url.getFile() +
  +                            bufferedData.substring( end );
  +                        }
  +                        else {
  +                            url = new URL( "http://" + targetHost + ":" +
  +                                targetPort + "/" + urlString );
  +
  +                            listener.tableModel.setValueAt( targetHost, index + 1,
  +                                OUTHOST_COLUMN );
  +                            bufferedData = bufferedData.substring( 0, start) +
  +                            url.toExternalForm() +
  +                            bufferedData.substring( end );
  +
  +                            targetHost = HTTPProxyHost ;
  +                            targetPort = HTTPProxyPort ;
  +                        }
  +
  +                    }
  +                } 
  +                else {
  +                    //
  +                    // Change Host: header to point to correct host
  +                    //
  +                    byte[] b1 = new byte[1];
  +
  +                    buf = new StringBuffer();
  +                    String s1;
  +                    String lastLine = null ;
  +
  +                    for ( ; ; ) {
  +                        int len ;
  +
  +                        len = tmpIn1.read(b1, 0, 1);
  +                        if ( len == -1 )
  +                            break ;
  +                        s1 = new String( b1 );
  +                        buf.append( s1 );
  +                        if ( b1[0] != '\n' )
  +                            continue ;
  +                        // we have a complete line
  +                        String line = buf.toString();
  +
  +                        buf.setLength(0);
  +                        // check to see if we have found Host: header
  +                        if (line.startsWith("Host: ")) {
  +                            // we need to update the hostname to target host
  +                            String newHost = "Host: " + targetHost + "\r\n";
  +
  +                            bufferedData = bufferedData.concat(newHost);
  +                            break ;
  +                        }
  +                        // add it to our headers so far
  +                        if (bufferedData == null)
  +                            bufferedData = line;
  +                        else
  +                            bufferedData = bufferedData.concat(line);
  +
  +                        // failsafe
  +                        if (line.equals("\r\n")) break;
  +                        if ("\n".equals(lastLine) && line.equals("\n")) break ;
  +                        lastLine = line ;
  +                    }
  +                    if ( bufferedData != null ) {
  +                        inputText.append( bufferedData );
  +                        s1 = bufferedData.substring( 0, 50 );
  +                        int i = s1.indexOf('\n');
  +
  +                        if ( i > 0 ) s1 = s1.substring(0, i - 1);
  +                        s1 = s1 + "                           " +
  +                        "                       ";
  +                        s1 = s1.substring(0, 51);
  +                        listener.tableModel.setValueAt( s1, index + 1,
  +                            REQ_COLUMN );
  +                    }
  +                }
  +
  +                if ( targetPort == -1 ) targetPort = 80 ;
  +                outSocket = new Socket(targetHost, targetPort );
  +
  +                tmpIn2  = outSocket.getInputStream();
  +                tmpOut2 = outSocket.getOutputStream();
  +
  +                if ( bufferedData != null ) {
  +                    byte[] b = bufferedData.getBytes();
  +
  +                    tmpOut2.write( b );
  +                }
  +
  +                boolean format = listener.xmlFormatBox.isSelected();
  +
  +                rr1 = new SocketRR(this, inSocket, tmpIn1, outSocket,
  +                    tmpOut2, inputText, format,
  +                    listener.tableModel, index + 1, "request:" );
  +                rr2 = new SocketRR( this, outSocket, tmpIn2, inSocket,
  +                    tmpOut1, outputText, format,
  +                    null, 0, "response:" );
  +
  +                while ( rr1 != null || rr2 != null ) {
  +                    // Only loop as long as the connection to the target
  +                    // machine is available - once that's gone we can stop.
  +                    // The old way, loop until both are closed, left us
  +                    // looping forever since no one closed the 1st one.
  +                    // while( !rr2.isDone() ) 
  +                    if (null != rr1 && rr1.isDone()) {
  +                        if ( index >= 0  && rr2 != null) {
  +                            listener.tableModel.setValueAt(getMessage("resp00", "Resp"),
  +                                1 + index, STATE_COLUMN );
  +                        }
  +                       rr1 = null;
  +                    }
  +                    if (null != rr2 && rr2.isDone()) {
  +                        if ( index >= 0 && rr1 != null ) {
  +                            listener.tableModel.setValueAt(getMessage("req00", "Req"),
  +                                1 + index, STATE_COLUMN );
  +                        }
  +                        rr2 = null;
  +                    }
  +
  +                    //  Thread.sleep( 10 );
  +                    synchronized ( this) {
  +                        wait(1000); //Safety just incase we're not told to wake up.
  +                    }
  +                }
  +
  +                //  System.out.println("Done ");
  +                // rr1.halt();
  +                // rr2.halt();
  +
  +
  +                active = false ;
  +
  +                /*
  +                 if ( inSocket != null ) {
  +                 inSocket.close();
  +                 inSocket = null ;
  +                 }
  +                 outSocket.close();
  +                 outSocket = null ;
  +                 */
  +
  +                if ( index >= 0 ) {
  +                    listener.tableModel.setValueAt(getMessage("done00", "Done"),
  +                        1 + index, STATE_COLUMN );
  +
  +                }
  +            }
  +            catch ( Exception e ) {
  +                StringWriter st = new StringWriter();
  +                PrintWriter  wr = new PrintWriter(st);
  +                int index = listener.connections.indexOf( this );
  +
  +                if ( index >= 0 )
  +                    listener.tableModel.setValueAt( getMessage("error00", "Error"), 1 + index, STATE_COLUMN );
  +                e.printStackTrace(wr);
  +                wr.close();
  +                outputText.append( st.toString() );
  +                halt();
  +            }
  +        }
  +
  +        synchronized void wakeUp() {
  +            notifyAll();
  +        }
  +
  +        public void halt() {
  +            try {
  +                if ( rr1 != null ) rr1.halt();
  +                if ( rr2 != null ) rr2.halt();
  +                if ( inSocket  != null ) inSocket.close();
  +                inSocket = null ;
  +                if ( outSocket != null ) outSocket.close();
  +                outSocket = null ;
  +            }
  +            catch ( Exception e ) {
  +                e.printStackTrace();
  +            }
  +        }
  +
  +        public void remove() {
  +            int index = -1;
  +
  +            try {
  +                halt();
  +                index = listener.connections.indexOf( this );
  +                listener.tableModel.removeRow( index + 1 );
  +                listener.connections.remove( index );
  +            }
  +            catch ( Exception e ) {
  +                System.err.println("index:=" + index + this );
  +                e.printStackTrace();
  +            }
  +        }
  +    }
  +
  +
  +    class Listener extends JPanel {
  +        public  Socket      inputSocket     = null ;
  +        public  Socket      outputSocket    = null ;
  +        public  JTextField  portField       = null ;
  +        public  JTextField  hostField       = null ;
  +        public  JTextField  tPortField      = null ;
  +        public  JCheckBox   isProxyBox      = null ;
  +        public  JButton     stopButton      = null ;
  +        public  JButton     removeButton    = null ;
  +        public  JButton     removeAllButton = null ;
  +        public  JCheckBox   xmlFormatBox    = null ;
  +        public  JButton     saveButton      = null ;
  +        public  JButton     resendButton    = null ;
  +        public  JButton     switchButton    = null ;
  +        public  JButton     closeButton     = null ;
  +        public  JTable      connectionTable = null ;
  +        public  DefaultTableModel  tableModel      = null ;
  +        public  JSplitPane  outPane         = null ;
  +        public  ServerSocket sSocket        = null ;
  +        public  SocketWaiter sw = null ;
  +        public  JPanel      leftPanel       = null ;
  +        public  JPanel      rightPanel      = null ;
  +        public  JTabbedPane notebook        = null ;
  +        public  String      HTTPProxyHost   = null ;
  +        public  int         HTTPProxyPort   = 80 ;
  +
  +        final public Vector connections = new Vector();
  +
  +        public Listener(JTabbedPane _notebook, String name,
  +            int listenPort, String host, int targetPort,
  +            boolean isProxy) {
  +            notebook = _notebook ;
  +            if ( name == null ) name = getMessage("port01", "Port") + " " + listenPort ;
  +
  +            this.setLayout( new BorderLayout() );
  +
  +            // 1st component is just a row of labels and 1-line entry fields
  +            /////////////////////////////////////////////////////////////////////
  +            JPanel top = new JPanel();
  +
  +            top.setLayout( new BoxLayout(top, BoxLayout.X_AXIS) );
  +            top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  +            final String start = getMessage("start00", "Start");
  +
  +            top.add( stopButton = new JButton( start ) );
  +            top.add( Box.createRigidArea(new Dimension(5, 0)) );
  +            top.add( new JLabel( "  " + getMessage("listenPort01", "Listen Port:") + " ", SwingConstants.RIGHT ) );
  +            top.add( portField = new JTextField( "" + listenPort, 4 ) );
  +            top.add( new JLabel( "  " + getMessage("host00", "Host:"), SwingConstants.RIGHT ) );
  +            top.add( hostField = new JTextField( host, 30 ) );
  +            top.add( new JLabel( "  " + getMessage("port02", "Port:") + " ", SwingConstants.RIGHT ) );
  +            top.add( tPortField = new JTextField( "" + targetPort, 4 ) );
  +            top.add( Box.createRigidArea(new Dimension(5, 0)) );
  +            top.add( isProxyBox = new JCheckBox(getMessage("proxy00", "Proxy")) );
  +
  +            isProxyBox.addChangeListener( new BasicButtonListener(isProxyBox) {
  +                    public void stateChanged(ChangeEvent event) {
  +                        JCheckBox box = (JCheckBox) event.getSource();
  +                        boolean state = box.isSelected();
  +
  +                        tPortField.setEnabled( !state );
  +                        hostField.setEnabled( !state );
  +                    }
  +                }
  +            );
  +
  +            isProxyBox.setSelected(isProxy);
  +
  +            portField.setEditable(false);
  +            portField.setMaximumSize(new Dimension(50, Short.MAX_VALUE) );
  +            hostField.setEditable(false);
  +            hostField.setMaximumSize(new Dimension(85, Short.MAX_VALUE) );
  +            tPortField.setEditable(false);
  +            tPortField.setMaximumSize(new Dimension(50, Short.MAX_VALUE) );
  +
  +            stopButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if ( getMessage("stop00", "Stop").equals(event.getActionCommand()) ) stop();
  +                        if ( start.equals(event.getActionCommand()) ) start();
  +                    }
  +                }
  +            );
  +
  +            this.add( top, BorderLayout.NORTH );
  +
  +            // 2nd component is a split pane with a table on the top
  +            // and the request/response text areas on the bottom
  +            /////////////////////////////////////////////////////////////////////
  +
  +            tableModel = new DefaultTableModel(new String[] {
  +                    getMessage("state00", "State"),
  +                    getMessage("time00", "Time"),
  +                    getMessage("requestHost00", "Request Host"),
  +                    getMessage("targetHost", "Target Host"),
  +                    getMessage("request00", "Request...")
  +                } , 0 );
  +
  +            connectionTable = new JTable(1, 2);
  +            connectionTable.setModel( tableModel );
  +            connectionTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  +            // Reduce the STATE column and increase the REQ column
  +            TableColumn col ;
  +
  +            col = connectionTable.getColumnModel().getColumn(STATE_COLUMN);
  +            col.setMaxWidth( col.getPreferredWidth() / 2 );
  +            col = connectionTable.getColumnModel().getColumn(REQ_COLUMN);
  +            col.setPreferredWidth( col.getPreferredWidth() * 2 );
  +
  +
  +            ListSelectionModel sel = connectionTable.getSelectionModel();
  +
  +            sel.addListSelectionListener( new ListSelectionListener() {
  +                    public void valueChanged(ListSelectionEvent event) {
  +                        if (event.getValueIsAdjusting()) return ;
  +                        ListSelectionModel m = (ListSelectionModel) event.getSource();
  +                        int divLoc = outPane.getDividerLocation();
  +
  +                        if (m.isSelectionEmpty()) {
  +                            setLeft( new JLabel(" " + getMessage("wait00", "Waiting for Connection...") ) );
  +                            setRight( new JLabel("") );
  +                            removeButton.setEnabled(false);
  +                            removeAllButton.setEnabled(false);
  +                            saveButton.setEnabled(false);
  +                            resendButton.setEnabled(false);
  +                        }
  +                        else {
  +                            int row = m.getLeadSelectionIndex();
  +
  +                            if ( row == 0 ) {
  +                                if ( connections.size() == 0 ) {
  +                                    setLeft(new JLabel(" " + getMessage("wait00", "Waiting for connection...")));
  +                                    setRight(new JLabel(""));
  +                                    removeButton.setEnabled(false);
  +                                    removeAllButton.setEnabled(false);
  +                                    saveButton.setEnabled(false);
  +                                    resendButton.setEnabled(false);
  +                                }
  +                                else {
  +                                    Connection conn = (Connection) connections.lastElement();
  +
  +                                    setLeft( conn.inputScroll );
  +                                    setRight( conn.outputScroll );
  +                                    removeButton.setEnabled(false);
  +                                    removeAllButton.setEnabled(true);
  +                                    saveButton.setEnabled(true);
  +                                    resendButton.setEnabled(true);
  +                                }
  +                            }
  +                            else {
  +                                Connection conn = (Connection) connections.get(row - 1);
  +
  +                                setLeft( conn.inputScroll );
  +                                setRight( conn.outputScroll );
  +                                removeButton.setEnabled(true);
  +                                removeAllButton.setEnabled(true);
  +                                saveButton.setEnabled(true);
  +                                resendButton.setEnabled(true);
  +                            }
  +                        }
  +                        outPane.setDividerLocation(divLoc);
  +                    }
  +                } 
  +            );
  +            tableModel.addRow( new Object[] { 
  +                    "---", getMessage("mostRecent00", "Most Recent"), "---", "---", "---" 
  +                } 
  +            );
  +
  +            JPanel  tablePane = new JPanel();
  +
  +            tablePane.setLayout( new BorderLayout() );
  +
  +            JScrollPane tableScrollPane = new JScrollPane( connectionTable );
  +
  +            tablePane.add( tableScrollPane, BorderLayout.CENTER );
  +            JPanel buttons = new JPanel();
  +
  +            buttons.setLayout( new BoxLayout(buttons, BoxLayout.X_AXIS) );
  +            buttons.setBorder( BorderFactory.createEmptyBorder(5, 5, 5, 5) );
  +            final String removeSelected = getMessage("removeSelected00", "Remove Selected");
  +
  +            buttons.add( removeButton = new JButton(removeSelected) );
  +            buttons.add( Box.createRigidArea(new Dimension(5, 0)) );
  +            final String removeAll = getMessage("removeAll00", "Remove All");
  +
  +            buttons.add( removeAllButton = new JButton(removeAll) );
  +            tablePane.add( buttons, BorderLayout.SOUTH );
  +
  +            removeButton.setEnabled( false );
  +            removeButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if ( removeSelected.equals(event.getActionCommand()) ) remove();
  +                    }
  +                }
  +            );
  +
  +            removeAllButton.setEnabled( false );
  +            removeAllButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if ( removeAll.equals(event.getActionCommand()) ) removeAll();
  +                    }
  +                }
  +            );
  +
  +            // Add Response Section
  +            /////////////////////////////////////////////////////////////////////
  +            JPanel     pane2     = new JPanel();
  +
  +            pane2.setLayout( new BorderLayout() );
  +
  +            leftPanel = new JPanel();
  +            leftPanel.setAlignmentX( Component.LEFT_ALIGNMENT );
  +            leftPanel.setLayout( new BoxLayout(leftPanel, BoxLayout.Y_AXIS) );
  +            leftPanel.add( new JLabel("  " + getMessage("request01", "Request")) );
  +            leftPanel.add( new JLabel(" " + getMessage("wait01", "Waiting for connection") ));
  +
  +            rightPanel = new JPanel();
  +            rightPanel.setLayout( new BoxLayout(rightPanel, BoxLayout.Y_AXIS) );
  +            rightPanel.add( new JLabel("  " + getMessage("response00", "Response")) );
  +            rightPanel.add( new JLabel("") );
  +
  +            outPane = new JSplitPane(0, leftPanel, rightPanel );
  +            outPane.setDividerSize(4);
  +            pane2.add( outPane, BorderLayout.CENTER );
  +
  +            JPanel bottomButtons = new JPanel();
  +
  +            bottomButtons.setLayout( new BoxLayout(bottomButtons, BoxLayout.X_AXIS));
  +            bottomButtons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  +            bottomButtons.add( xmlFormatBox = new JCheckBox( getMessage("xmlFormat00", "XML Format") ) );
  +            bottomButtons.add( Box.createRigidArea(new Dimension(5, 0)) );
  +            final String save = getMessage("save00", "Save");
  +
  +            bottomButtons.add( saveButton = new JButton( save ) );
  +            bottomButtons.add( Box.createRigidArea(new Dimension(5, 0)) );
  +            final String resend = getMessage("resend00", "Resend");
  +
  +            bottomButtons.add( resendButton = new JButton( resend ) );
  +            bottomButtons.add( Box.createRigidArea(new Dimension(5, 0)) );
  +            final String switchStr = getMessage("switch00", "Switch Layout");
  +
  +            bottomButtons.add( switchButton = new JButton( switchStr ) );
  +            bottomButtons.add( Box.createHorizontalGlue() );
  +            final String close = getMessage("close00", "Close");
  +
  +            bottomButtons.add( closeButton = new JButton( close ) );
  +            pane2.add( bottomButtons, BorderLayout.SOUTH );
  +
  +            saveButton.setEnabled( false );
  +            saveButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if ( save.equals(event.getActionCommand()) ) save();
  +                    }
  +                }
  +            );
  +
  +            resendButton.setEnabled( false );
  +            resendButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if ( resend.equals(event.getActionCommand()) ) resend();
  +                    }
  +                }
  +            );
  +
  +            switchButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if (switchStr.equals(event.getActionCommand()) ) {
  +                            int v = outPane.getOrientation();
  +
  +                            if ( v == 0 )  // top/bottom
  +                                outPane.setOrientation(1);
  +                            else  // left/right
  +                                outPane.setOrientation(0);
  +                            outPane.setDividerLocation(0.5);
  +                        }
  +                    }
  +                }
  +            );
  +
  +            closeButton.addActionListener( new ActionListener() {
  +                    public void actionPerformed(ActionEvent event) {
  +                        if (close.equals(event.getActionCommand()) )
  +                            close();
  +                    }
  +                }
  +            );
  +
  +            JSplitPane  pane1 = new JSplitPane( 0 );
  +
  +            pane1.setDividerSize(4);
  +            pane1.setTopComponent( tablePane );
  +            pane1.setBottomComponent( pane2 );
  +            pane1.setDividerLocation( 150 );
  +            this.add( pane1, BorderLayout.CENTER );
  +
  +            // 
  +            ////////////////////////////////////////////////////////////////////
  +            sel.setSelectionInterval(0, 0);
  +            outPane.setDividerLocation( 150 );
  +            notebook.addTab( name, this );
  +            start();
  +        }
  +
  +        public void setLeft(Component left) {
  +            leftPanel.remove(1);
  +            leftPanel.add(left);
  +        }
  +
  +        public void setRight(Component right) {
  +            rightPanel.remove(1);
  +            rightPanel.add(right);
  +        }
  +
  +        public void start() {
  +            int  port = Integer.parseInt( portField.getText() );
  +
  +            portField.setText( "" + port );
  +            int i = notebook.indexOfComponent( this );
  +
  +            notebook.setTitleAt( i, getMessage("port01", "Port") + " " + port );
  +
  +            int  tmp = Integer.parseInt( tPortField.getText() );
  +
  +            tPortField.setText( "" + tmp );
  +
  +            sw = new SocketWaiter( this, port );
  +            stopButton.setText( getMessage("stop00", "Stop") );
  +
  +            portField.setEditable(false);
  +            hostField.setEditable(false);
  +            tPortField.setEditable(false);
  +            isProxyBox.setEnabled(false);
  +        }
  +
  +        public void close() {
  +            stop();
  +            notebook.remove( this );
  +        }
  +
  +        public void stop() {
  +            try {
  +                for ( int i = 0 ; i < connections.size() ; i++ ) {
  +                    Connection conn = (Connection) connections.get( i );
  +
  +                    conn.halt();
  +                }
  +                sw.halt();
  +                stopButton.setText( getMessage("start00", "Start") );
  +                portField.setEditable(true);
  +                hostField.setEditable(true);
  +                tPortField.setEditable(true);
  +                isProxyBox.setEnabled(true);
  +            }
  +            catch ( Exception e ) {
  +                e.printStackTrace();
  +            }
  +        }
  +
  +        public void remove() {
  +            ListSelectionModel lsm = connectionTable.getSelectionModel();
  +            int bot = lsm.getMinSelectionIndex();
  +            int top = lsm.getMaxSelectionIndex();
  +
  +            for ( int i = top ; i >= bot ; i-- ) {
  +                ((Connection) connections.get(i - 1)).remove();
  +            }
  +            if ( bot > connections.size() ) bot = connections.size();
  +            lsm.setSelectionInterval(bot, bot);
  +        }
  +
  +        public void removeAll() {
  +            ListSelectionModel lsm = connectionTable.getSelectionModel();
  +            lsm.clearSelection();
  +            while ( connections.size() > 0 )
  +                ((Connection) connections.get(0)).remove();
  +
  +            lsm.setSelectionInterval(0, 0);
  +        }
  +
  +        public void save() {
  +            JFileChooser  dialog = new JFileChooser( "." );
  +            int rc = dialog.showSaveDialog( this );
  +
  +            if ( rc == JFileChooser.APPROVE_OPTION ) {
  +                try {
  +                    File             file = dialog.getSelectedFile();
  +                    FileOutputStream out  = new FileOutputStream( file );
  +
  +                    ListSelectionModel lsm = connectionTable.getSelectionModel();
  +
  +                    rc = lsm.getLeadSelectionIndex();
  +                    if ( rc == 0 ) rc = connections.size();
  +                    Connection conn = (Connection) connections.get( rc - 1 );
  +
  +                    rc = Integer.parseInt( portField.getText() );
  +                    out.write( (new String(getMessage("listenPort01", "Listen Port:") + " " + rc + "\n" )).getBytes() );
  +                    out.write( (new String(getMessage("targetHost01", "Target Host:") + " " + hostField.getText() +
  +                                "\n" )).getBytes() );
  +                    rc = Integer.parseInt( tPortField.getText() );
  +                    out.write( (new String(getMessage("targetPort01", "Target Port:") + " " + rc + "\n" )).getBytes() );
  +
  +                    out.write( (new String("==== " + getMessage("request01", "Request") + " ====\n" )).getBytes() );
  +                    out.write( conn.inputText.getText().getBytes() );
  +
  +                    out.write( (new String("==== " + getMessage("response00", "Response") + " ====\n" )).getBytes() );
  +                    out.write( conn.outputText.getText().getBytes() );
  +
  +                    out.close();
  +                }
  +                catch ( Exception e ) {
  +                    e.printStackTrace();
  +                }
  +            }
  +        }
  +
  +        public void resend() {
  +            int rc ;
  +
  +            try {
  +                ListSelectionModel lsm = connectionTable.getSelectionModel();
  +
  +                rc = lsm.getLeadSelectionIndex();
  +                if ( rc == 0 ) rc = connections.size();
  +                Connection conn = (Connection) connections.get( rc - 1 );
  +
  +                if ( rc > 0 ) {
  +                    lsm.clearSelection();
  +                    lsm.setSelectionInterval(0, 0);
  +                }
  +
  +                InputStream in = null ;
  +                String      text = conn.inputText.getText();
  +
  +                // Fix Content-Length HTTP headers
  +                if ( text.startsWith("POST ") || text.startsWith("GET ") ) {
  +                    System.err.println("IN CL" );
  +                    int         pos1, pos2, pos3 ;
  +                    String      body, headers, headers1, header2 ;
  +
  +                    pos3 = text.indexOf( "\n\n" );
  +                    if ( pos3 == -1 ) {
  +                        pos3 = text.indexOf( "\r\n\r\n" );
  +                        if ( pos3 != -1 ) pos3 = pos3 + 4 ;
  +                    }
  +                    else
  +                        pos3 += 2 ;
  +
  +                    headers = text.substring( 0, pos3 );
  +
  +                    pos1 = headers.indexOf( "Content-Length:" );
  +                    System.err.println("pos1: " + pos1 );
  +                    System.err.println("pos3: " + pos3 );
  +                    if ( pos1 != -1 ) {
  +                        int  newLen = text.length() - pos3 ;
  +
  +                        pos2 = headers.indexOf( "\n", pos1 );
  +
  +                        System.err.println("CL: " + newLen );
  +                        System.err.println("Hdrs: '" + headers + "'" );
  +                        System.err.println("subTEXT: '" +
  +                            text.substring(pos3, pos3 + newLen) + "'");
  +                        text = headers.substring(0, pos1) +
  +                        "Content-Length: " + newLen + "\n" +
  +                        headers.substring(pos2 + 1) +
  +                        text.substring(pos3) ;
  +                        System.err.println("\nTEXT: '" + text + "'" );
  +                    }
  +                }
  +
  +                in = new ByteArrayInputStream( text.getBytes() );
  +                new Connection( this, in );
  +            }
  +            catch ( Exception e ) {
  +                e.printStackTrace();
  +            }
  +        }
  +    }
  +
  +
  +    public tcpmon(int listenPort, String targetHost, int targetPort) {
  +        super ( getMessage("tcpmon00", "TCPMonitor") );
  +
  +        notebook = new JTabbedPane();
  +        this.getContentPane().add( notebook );
  +
  +        new AdminPage( notebook, getMessage("admin00", "Admin") );
  +
  +        if ( listenPort != 0 ) {
  +            Listener l = null ;
  +
  +            if ( targetHost == null )
  +                l = new Listener( notebook, null, listenPort,
  +                    targetHost, targetPort, true );
  +            else
  +                l = new Listener( notebook, null, listenPort,
  +                    targetHost, targetPort, false );
  +            notebook.setSelectedIndex( 1 );
  +
  +            l.HTTPProxyHost = System.getProperty( "http.proxyHost" );
  +            if ( l.HTTPProxyHost != null && l.HTTPProxyHost.equals("") )
  +                l.HTTPProxyHost = null ;
  +
  +            if ( l.HTTPProxyHost != null ) {
  +                String tmp = System.getProperty( "http.proxyPort" );
  +
  +                if ( tmp != null && tmp.equals("") ) tmp = null ;
  +                if ( tmp == null ) l.HTTPProxyPort = 80 ;
  +                else l.HTTPProxyPort = Integer.parseInt( tmp );
  +            }
  +        }
  +
  +        this.pack();
  +        this.setSize( 600, 600 );
  +        this.setVisible( true );
  +    }
  +
  +    protected void processWindowEvent(WindowEvent event) {
  +        switch ( event.getID() ) {
  +        case WindowEvent.WINDOW_CLOSING: 
  +            exit();
  +            break ;
  +
  +        default: 
  +            super.processWindowEvent(event);
  +            break ;
  +        }
  +    }
  +
  +    private void exit() {
  +        System.exit(0);
  +    }
  +
  +    public void setInputPort(int port) {
  +    }
  +
  +    public void setOutputHostPort(char hostName, int port) {
  +    }
  +
  +    public static void main(String[] args) {
  +        try {
  +            if ( args.length == 3 ) {
  +                int p1 = Integer.parseInt( args[0] );
  +                int p2 = Integer.parseInt( args[2] );
  +
  +                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  +                new tcpmon( p1, args[1], p2 );
  +            }
  +            else if ( args.length == 1 ) {
  +                int p1 = Integer.parseInt( args[0] );
  +
  +                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  +                new tcpmon( p1, null, 0 );
  +            }
  +            else if ( args.length != 0 ) {
  +                System.err.println( getMessage("usage00", "Usage:") + " tcpmon [listenPort targetHost targetPort]\n");
  +            }
  +            else {
  +                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  +                new tcpmon(0, null, 0);
  +            }
  +        }
  +        catch ( Throwable exp ) {
  +            exp.printStackTrace();
  +        }
  +    }
  +
  +    // Message resource bundle.
  +    private static ResourceBundle messages = null;
  +
  +    /**
  +     * Get the message with the given key.  There are no arguments for this message.
  +     */
  +    public static String getMessage(String key, String defaultMsg) {
  +        try {
  +            if (messages == null) {
  +                initializeMessages();
  +            }
  +            return messages.getString(key);
  +        }
  +        catch (Throwable t) {
  +            // If there is any problem whatsoever getting the internationalized
  +            // message, return the default.
  +            return defaultMsg;
  +        }
  +    } // getMessage
  +
  +    /**
  +     * Load the resource bundle messages from the properties file.  This is ONLY done when it is
  +     * needed.  If no messages are printed (for example, only Wsdl2java is being run in non-
  +     * verbose mode) then there is no need to read the properties file.
  +     */
  +    private static void initializeMessages() {
  +        messages = ResourceBundle.getBundle("org.apache.axis.utils.tcpmon");
  +    } // initializeMessages
  +
  +}
  
  
  
  1.4       +53 -53    xml-axis/java/src/org/apache/axis/utils/tcpmon.properties
  
  Index: tcpmon.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/tcpmon.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- tcpmon.properties	30 May 2002 03:06:12 -0000	1.3
  +++ tcpmon.properties	30 May 2002 23:46:02 -0000	1.4
  @@ -1,53 +1,53 @@
  -# Translation instructions.
  -# 1.  Each message line is of the form key=value.  Translate the value, DO NOT translate the key.
  -# 2.  The messages may contain arguments that will be filled in by the runtime.  These are of the form:  {0}, {1}, etc.  These must appear as is in the message, though the order may be changed to support proper language syntax.
  -# 3.  If a single quote character is to appear in the resulting message, it must appear in this file as two consecutive single quote characters.
  -# 4.  Lines beginning with "#" (like this one) are comment lines and may contain translation instructions.  They need not be translated unless your translated file, rather than this file, will serve as a base for other translators.
  -
  -actAs00=Act as a...
  -active00=Active
  -add00=Add
  -admin00=Admin
  -close00=Close
  -done00=Done
  -resp00=Resp
  -req00=Req
  -error00=Error
  -host00=Host:
  -hostname00=Hostname
  -listener00=Listener
  -listenPort00=Listen Port #
  -listenPort01=Listen Port:
  -mostRecent00=Most Recent
  -newTCP00=Create a new TCP/IP Monitor...
  -options00=Options
  -port00=Port #
  -port01=Port
  -port02=Port:
  -proxy00=Proxy
  -proxySupport00=HTTP Proxy Support
  -removeAll00=Remove All
  -removeSelected00=Remove Selected
  -request00=Request...
  -request01=Request
  -requestHost00=Request Host
  -resend00=Resend
  -response00=Response
  -save00=Save
  -start00=Start
  -state00=State
  -stop00=Stop
  -switch00=Switch Layout
  -targetHost00=Target Host
  -targetHost01=Target Host:
  -targetHostname00=Target Hostname
  -targetPort00=Target Port #
  -targetPort01=Target Port:
  -tcpmon00=TCPMonitor
  -time00=Time
  -usage00=Usage:
  -wait00=Waiting for Connection...
  -wait01=Waiting for Connection
  -
  -# NOTE:  in xmlFormat00, do not translate "XML"
  -xmlFormat00=XML Format
  +# Translation instructions.
  +# 1.  Each message line is of the form key=value.  Translate the value, DO NOT translate the key.
  +# 2.  The messages may contain arguments that will be filled in by the runtime.  These are of the form:  {0}, {1}, etc.  These must appear as is in the message, though the order may be changed to support proper language syntax.
  +# 3.  If a single quote character is to appear in the resulting message, it must appear in this file as two consecutive single quote characters.
  +# 4.  Lines beginning with "#" (like this one) are comment lines and may contain translation instructions.  They need not be translated unless your translated file, rather than this file, will serve as a base for other translators.
  +
  +actAs00=Act as a...
  +active00=Active
  +add00=Add
  +admin00=Admin
  +close00=Close
  +done00=Done
  +resp00=Resp
  +req00=Req
  +error00=Error
  +host00=Host:
  +hostname00=Hostname
  +listener00=Listener
  +listenPort00=Listen Port #
  +listenPort01=Listen Port:
  +mostRecent00=Most Recent
  +newTCP00=Create a new TCP/IP Monitor...
  +options00=Options
  +port00=Port #
  +port01=Port
  +port02=Port:
  +proxy00=Proxy
  +proxySupport00=HTTP Proxy Support
  +removeAll00=Remove All
  +removeSelected00=Remove Selected
  +request00=Request...
  +request01=Request
  +requestHost00=Request Host
  +resend00=Resend
  +response00=Response
  +save00=Save
  +start00=Start
  +state00=State
  +stop00=Stop
  +switch00=Switch Layout
  +targetHost00=Target Host
  +targetHost01=Target Host:
  +targetHostname00=Target Hostname
  +targetPort00=Target Port #
  +targetPort01=Target Port:
  +tcpmon00=TCPMonitor
  +time00=Time
  +usage00=Usage:
  +wait00=Waiting for Connection...
  +wait01=Waiting for Connection
  +
  +# NOTE:  in xmlFormat00, do not translate "XML"
  +xmlFormat00=XML Format
  
  
  
  1.5       +1076 -1076xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SchemaUtils.java	30 May 2002 03:06:12 -0000	1.4
  +++ SchemaUtils.java	30 May 2002 23:46:02 -0000	1.5
  @@ -1,1076 +1,1076 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.wsdl.symbolTable;
  -
  -import java.util.Vector;
  -
  -import javax.wsdl.QName;
  -
  -import javax.xml.rpc.holders.BooleanHolder;
  -import javax.xml.rpc.holders.IntHolder;
  -
  -import org.apache.axis.Constants;
  -
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  -
  -/**
  - * This class contains static utility methods specifically for schema type queries.
  - *
  - * @author Rich Scheuerle  (scheu@us.ibm.com)
  - */
  -public class SchemaUtils {
  -
  -    /**
  -     * If the specified node represents a supported JAX-RPC complexType or 
  -     * simpleType, a Vector is returned which contains ElementDecls for the 
  -     * child element names. 
  -     * If the element is a simpleType, an ElementDecls is built representing
  -     * the restricted type with the special name "value".
  -     * If the element is a complexType which has simpleContent, an ElementDecl
  -     * is built representing the extended type with the special name "value".
  -     * This method does not return attribute names and types
  -     * (use the getContainedAttributeTypes)
  -     * If the specified node is not a supported 
  -     * JAX-RPC complexType/simpleType/element null is returned.
  -     */
  -    public static Vector getContainedElementDeclarations(Node node, SymbolTable symbolTable) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node complexNode = null;
  -            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  -                QName complexKind = Utils.getNodeQName(children.item(j));
  -                if (complexKind != null &&
  -                    complexKind.getLocalPart().equals("complexType") &&
  -                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  -                    complexNode = children.item(j);
  -                    node = complexNode;
  -                }
  -            }
  -        }
  -
  -        // Expecting a schema complexType or simpleType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("complexType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the complexType there could be complexContent/simpleContent
  -            // and extension elements if this is a derived type.  Skip over these.
  -            NodeList children = node.getChildNodes();
  -            Node complexContent = null;
  -            Node simpleContent = null;
  -            Node extension = null;
  -            for (int j = 0; j < children.getLength() && complexContent == null; j++) {
  -                QName complexContentKind = Utils.getNodeQName(children.item(j));
  -                if (complexContentKind != null &&
  -                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
  -                    if (complexContentKind.getLocalPart().equals("complexContent") )
  -                        complexContent = children.item(j);
  -                    else if (complexContentKind.getLocalPart().equals("simpleContent"))
  -                        simpleContent = children.item(j);
  -                }
  -            }
  -            if (complexContent != null) {
  -                children = complexContent.getChildNodes();
  -                for (int j = 0; j < children.getLength() && extension == null; j++) {
  -                    QName extensionKind = Utils.getNodeQName(children.item(j));
  -                    if (extensionKind != null &&
  -                        extensionKind.getLocalPart().equals("extension") &&
  -                        Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
  -                        extension = children.item(j);
  -                }
  -            }
  -            if (simpleContent != null) {
  -                children = simpleContent.getChildNodes();
  -                for (int j = 0; j < children.getLength() && extension == null; j++) {
  -                    QName extensionKind = Utils.getNodeQName(children.item(j));
  -                    if (extensionKind != null &&
  -                        extensionKind.getLocalPart().equals("extension") &&
  -                        Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
  -                        
  -                        // get the type of the extension
  -                        QName extendsType =
  -                                Utils.getNodeTypeRefQName(children.item(j), 
  -                                                          "base");
  -                        
  -                        // Return an element declaration with a fixed name
  -                        // ("value") and the correct type.                        
  -                        Vector v = new Vector();
  -                        ElementDecl elem = new ElementDecl();
  -                        elem.setType(symbolTable.getTypeEntry(extendsType, false));
  -                        elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
  -                        v.add(elem);
  -                        return v;
  -                    }
  -                        
  -                }
  -            }
  -
  -            if (extension != null) {
  -                node = extension;  // Skip over complexContent and extension
  -            }
  -
  -            // Under the complexType there may be choice, sequence, group and/or all nodes.      
  -            // (There may be other #text nodes, which we will ignore).
  -            children = node.getChildNodes();
  -            Vector v = new Vector();
  -            for (int j = 0; j < children.getLength(); j++) {
  -                QName subNodeKind = Utils.getNodeQName(children.item(j));
  -                if (subNodeKind != null &&
  -                    Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  -                    if (subNodeKind.getLocalPart().equals("sequence")) {
  -                        v.addAll(processSequenceNode(children.item(j), symbolTable));
  -                    } else if (subNodeKind.getLocalPart().equals("all")) {
  -                        v.addAll(processAllNode(children.item(j), symbolTable));
  -                    } else if (subNodeKind.getLocalPart().equals("choice")) {
  -                        v.addAll(processChoiceNode(children.item(j), symbolTable));
  -                    } else if (subNodeKind.getLocalPart().equals("group")) {
  -                        v.addAll(processGroupNode(children.item(j), symbolTable));
  -                    }
  -                }
  -            }
  -            return v;
  -        } else {
  -            // This may be a simpleType, return the type with the name "value"
  -            QName simpleQName = getSimpleTypeBase(node, symbolTable);
  -            if (simpleQName != null) {
  -                TypeEntry simpleType = symbolTable.getType(simpleQName);
  -                if (simpleType != null) {
  -                    Vector v = new Vector();
  -                    ElementDecl elem = new ElementDecl();
  -                    elem.setType(simpleType);
  -                    elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
  -                    v.add(elem);
  -                    return v;
  -                }
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Invoked by getContainedElementDeclarations to get the child element types
  -     * and child element names underneath a Choice Node
  -     */
  -    private static Vector processChoiceNode(Node choiceNode, 
  -                                            SymbolTable symbolTable) {
  -        Vector v = new Vector();
  -        NodeList children = choiceNode.getChildNodes();
  -        for (int j = 0; j < children.getLength(); j++) {
  -            QName subNodeKind = Utils.getNodeQName(children.item(j));
  -            if (subNodeKind != null &&
  -                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  -                if (subNodeKind.getLocalPart().equals("choice")) {
  -                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  -                    v.addAll(processSequenceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("group")) {
  -                    v.addAll(processGroupNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("element")) {
  -                    ElementDecl elem = 
  -                            processChildElementNode(children.item(j), 
  -                                                    symbolTable);
  -                    if (elem != null)
  -                        v.add(elem);
  -                }
  -            }
  -        }
  -        return v;
  -    }
  -
  -    /**
  -     * Invoked by getContainedElementDeclarations to get the child element types
  -     * and child element names underneath a Sequence Node
  -     */
  -    private static Vector processSequenceNode(Node sequenceNode, 
  -                                              SymbolTable symbolTable) {
  -        Vector v = new Vector();
  -        NodeList children = sequenceNode.getChildNodes();
  -        for (int j = 0; j < children.getLength(); j++) {
  -            QName subNodeKind = Utils.getNodeQName(children.item(j));
  -            if (subNodeKind != null &&
  -                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  -                if (subNodeKind.getLocalPart().equals("choice")) {
  -                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  -                    v.addAll(processSequenceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("group")) {
  -                    v.addAll(processGroupNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("any")) {
  -                    TypeEntry type = new DefinedType(Utils.getWSDLQName(Constants.XSD_ANYTYPE), sequenceNode);
  -                    type.setName("java.lang.Object");
  -                    ElementDecl elem = new ElementDecl(type, Utils.getAxisQName(new QName("","any")));
  -                    v.add(elem);
  -                } else if (subNodeKind.getLocalPart().equals("element")) {
  -                    ElementDecl elem = 
  -                            processChildElementNode(children.item(j), 
  -                                                    symbolTable);
  -                    if (elem != null)
  -                        v.add(elem);
  -                }
  -            }
  -        }
  -        return v;
  -    }
  -
  -    /**
  -     * Invoked by getContainedElementDeclarations to get the child element types
  -     * and child element names underneath a group node.
  -     * (Currently the code only supports a defined group it does not
  -     * support a group that references a previously defined group)
  -     */
  -    private static Vector processGroupNode(Node groupNode, SymbolTable symbolTable) {
  -        Vector v = new Vector();
  -        NodeList children = groupNode.getChildNodes();
  -        for (int j = 0; j < children.getLength(); j++) {
  -            QName subNodeKind = Utils.getNodeQName(children.item(j));
  -            if (subNodeKind != null &&
  -                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  -                if (subNodeKind.getLocalPart().equals("choice")) {
  -                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  -                    v.addAll(processSequenceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("all")) {
  -                    v.addAll(processAllNode(children.item(j), symbolTable));
  -                }
  -            }
  -        }
  -        return v;
  -    }
  -
  -    /**
  -     * Invoked by getContainedElementDeclarations to get the child element types
  -     * and child element names underneath an all node.
  -     */
  -    private static Vector processAllNode(Node allNode, SymbolTable symbolTable) {
  -        Vector v = new Vector();
  -        NodeList children = allNode.getChildNodes();
  -        for (int j = 0; j < children.getLength(); j++) {
  -            QName subNodeKind = Utils.getNodeQName(children.item(j));
  -            if (subNodeKind != null &&
  -                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  -                if (subNodeKind.getLocalPart().equals("element")) {
  -                    ElementDecl elem = 
  -                            processChildElementNode(children.item(j), 
  -                                                    symbolTable);
  -                    if (elem != null)
  -                        v.add(elem);
  -                }
  -            }
  -        }
  -        return v;
  -    }
  -
  -
  -    /**
  -     * Invoked by getContainedElementDeclarations to get the child element type
  -     * and child element name for a child element node.
  -     *
  -     * If the specified node represents a supported JAX-RPC child element,
  -     * we return an ElementDecl containing the child element name and type.
  -     */
  -    private static ElementDecl processChildElementNode(Node elementNode, 
  -                                                  SymbolTable symbolTable) {
  -        // Get the name and type qnames.
  -        // The type qname is used to locate the TypeEntry, which is then
  -        // used to retrieve the proper java name of the type.
  -        QName nodeName = Utils.getNodeNameQName(elementNode);
  -        BooleanHolder forElement = new BooleanHolder();
  -        QName nodeType = Utils.getNodeTypeRefQName(elementNode, forElement);
  -
  -
  -        // An element inside a complex type is either qualified or unqualified.
  -        // If the ref= attribute is used, the name of the ref'd element is used
  -        // (which must be a root element).  If the ref= attribute is not
  -        // used, the name of the element is unqualified.
  -
  -        if (!forElement.value) {
  -            // check the Form (or elementFormDefault) attribute of this node to
  -            // determine if it should be namespace quailfied or not.
  -            String form = Utils.getAttribute(elementNode, "form");
  -            if (form != null && form.equals("unqualified")) {
  -                // Unqualified nodeName
  -                nodeName = new QName("", nodeName.getLocalPart());            
  -            } else if (form == null) {
  -                // check elementForDefault on schema element
  -                String def = Utils.getScopedAttribute(elementNode, 
  -                                                      "elementFormDefault");
  -                if (def == null || def.equals("unqualified")) {
  -                    // Unqualified nodeName
  -                    nodeName = new QName("", nodeName.getLocalPart());            
  -                }
  -            }
  -        } else {
  -            nodeName = nodeType;
  -        }
  -        if (nodeType == null) {
  -            nodeType = getElementAnonQName(elementNode);            
  -            forElement.value = false;
  -        }
  -
  -        
  -        TypeEntry type = (TypeEntry)symbolTable.getTypeEntry(nodeType, 
  -                                                             forElement.value);
  -        if (type != null) {
  -            ElementDecl elem = new ElementDecl(type ,Utils.getAxisQName(nodeName));
  -            String minOccurs = Utils.getAttribute(elementNode, "minOccurs");
  -            if (minOccurs != null && minOccurs.equals("0")) {
  -                elem.setMinOccursIs0(true);
  -            }
  -            return elem;
  -        }
  -        
  -        return null;
  -    }
  -
  -    /**
  -     * Returns the WSDL2Java QName for the anonymous type of the element
  -     * or null.
  -     */
  -    public static QName getElementAnonQName(Node node) {
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            for (int j = 0; j < children.getLength(); j++) {
  -                QName kind = Utils.getNodeQName(children.item(j));
  -                if (kind != null &&
  -                    (kind.getLocalPart().equals("complexType") ||
  -                     kind.getLocalPart().equals("simpleType")) &&
  -                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  -                    return Utils.getNodeNameQName(children.item(j));
  -                }
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Returns the WSDL2Java QName for the anonymous type of the attribute
  -     * or null.
  -     */
  -    public static QName getAttributeAnonQName(Node node) {
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("attribute") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            for (int j = 0; j < children.getLength(); j++) {
  -                QName kind = Utils.getNodeQName(children.item(j));
  -                if (kind != null &&
  -                    (kind.getLocalPart().equals("complexType") ||
  -                     kind.getLocalPart().equals("simpleType")) &&
  -                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  -                    return Utils.getNodeNameQName(children.item(j));
  -                }
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * If the specified node is a simple type or contains simpleContent, return true
  -     */
  -    public static boolean isSimpleTypeOrSimpleContent(Node node) {
  -        if (node == null) {
  -            return false;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node complexNode = null;
  -            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  -                QName kind = Utils.getNodeQName(children.item(j));
  -                if (kind != null &&
  -                    kind.getLocalPart().equals("complexType") &&
  -                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  -                    complexNode = children.item(j);
  -                    node = complexNode;
  -                }
  -                if (kind != null &&
  -                    kind.getLocalPart().equals("simpleType") &&
  -                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  -                    return true;
  -                }
  -            }
  -        }
  -
  -        // Expecting a schema complexType or simpleType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("simpleType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            return true;
  -        }
  -
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("complexType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the complexType there could be complexContent/simpleContent
  -            // and extension elements if this is a derived type.  Skip over these.
  -            NodeList children = node.getChildNodes();
  -            Node complexContent = null;
  -            Node simpleContent = null;
  -            for (int j = 0; j < children.getLength() && complexContent == null; j++) {
  -                QName complexContentKind = Utils.getNodeQName(children.item(j));
  -                if (complexContentKind != null &&
  -                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
  -                    if (complexContentKind.getLocalPart().equals("complexContent") )
  -                        complexContent = children.item(j);
  -                    else if (complexContentKind.getLocalPart().equals("simpleContent"))
  -                        simpleContent = children.item(j);
  -                }
  -            }
  -            if (complexContent != null) {
  -                return false;
  -            }
  -            if (simpleContent != null) {
  -                return true;
  -            }
  -        }
  -        return false;
  -    }
  -
  -    /**
  -     * If the specified node represents a supported JAX-RPC complexType/element
  -     * which extends another complexType.  The Type of the base is returned.
  -     */
  -    public static TypeEntry getComplexElementExtensionBase(Node node, SymbolTable symbolTable) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node complexNode = null;
  -            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  -                QName complexKind = Utils.getNodeQName(children.item(j));
  -                if (complexKind != null &&
  -                    complexKind.getLocalPart().equals("complexType") &&
  -                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  -                    complexNode = children.item(j);
  -                    node = complexNode;
  -                }
  -            }
  -        }
  -
  -        // Expecting a schema complexType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("complexType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the complexType there could be should be a complexContent &
  -            // extension elements if this is a derived type. 
  -            NodeList children = node.getChildNodes();
  -            Node content = null;
  -            Node extension = null;
  -            for (int j = 0; j < children.getLength() && content == null; j++) {
  -                QName contentKind = Utils.getNodeQName(children.item(j));
  -                if (contentKind != null &&
  -                    contentKind.getLocalPart().equals("complexContent") &&
  -                    Constants.isSchemaXSD(contentKind.getNamespaceURI()))
  -                    content = children.item(j);
  -                if (contentKind != null &&
  -                    contentKind.getLocalPart().equals("simpleContent") &&
  -                    Constants.isSchemaXSD(contentKind.getNamespaceURI()))
  -                    content = children.item(j);
  -            }
  -            if (content != null) {
  -                children = content.getChildNodes();
  -                for (int j = 0; j < children.getLength() && extension == null; j++) {
  -                    QName extensionKind = Utils.getNodeQName(children.item(j));
  -                    if (extensionKind != null &&
  -                        extensionKind.getLocalPart().equals("extension") &&
  -                        Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
  -                        extension = children.item(j);
  -                }
  -            }
  -            if (extension == null) {
  -                return null;  // No extension                               
  -            }
  -
  -            // Get the QName of the extension base
  -            QName extendsType = Utils.getNodeTypeRefQName(extension, "base");
  -            if (extendsType == null) {
  -                return null; // No extension base
  -            }
  -            // Return associated Type
  -            return (TypeEntry) symbolTable.getType(extendsType);
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * If the specified node represents a 'normal' non-enumeration simpleType,
  -     * the QName of the simpleType base is returned.
  -     */
  -    public static QName getSimpleTypeBase(Node node, SymbolTable symbolTable) {
  -        QName baseQName = null;
  -
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node simpleNode = null;
  -            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
  -                QName simpleKind = Utils.getNodeQName(children.item(j));
  -                if (simpleKind != null &&
  -                    simpleKind.getLocalPart().equals("simpleType") &&
  -                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
  -                    simpleNode = children.item(j);
  -                    node = simpleNode;
  -                }
  -            }
  -        }
  -        // Get the node kind, expecting a schema simpleType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("simpleType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the simpleType there should be a restriction.
  -            // (There may be other #text nodes, which we will ignore).
  -            NodeList children = node.getChildNodes();
  -            Node restrictionNode = null;
  -            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  -                QName restrictionKind = Utils.getNodeQName(children.item(j));
  -                if (restrictionKind != null &&
  -                    restrictionKind.getLocalPart().equals("restriction") &&
  -                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  -                    restrictionNode = children.item(j);
  -            }
  -
  -            // The restriction node indicates the type being restricted
  -            // (the base attribute contains this type).
  -            
  -            if (restrictionNode != null) {
  -                baseQName = Utils.getNodeTypeRefQName(restrictionNode, "base");
  -            }
  -            
  -            // Look for enumeration elements underneath the restriction node
  -            if (baseQName != null && restrictionNode != null) {
  -                NodeList enums = restrictionNode.getChildNodes();
  -                for (int i=0; i < enums.getLength(); i++) {
  -                    QName enumKind = Utils.getNodeQName(enums.item(i));
  -                    if (enumKind != null &&
  -                        enumKind.getLocalPart().equals("enumeration") &&
  -                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
  -                        
  -                        // Found an enumeration, this isn't a 
  -                        // 'normal' simple type.
  -                        return null;
  -                    }
  -                }
  -            }
  -        }
  -        return baseQName;
  -    }
  -
  -    /**
  -     * Returns the contained restriction or extension node underneath
  -     * the specified node.  Returns null if not found
  -     */
  -    public static Node getRestrictionOrExtensionNode(Node node) {
  -        Node re = null;
  -        if (node == null) {
  -            return re;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node node2 = null;
  -            for (int j = 0; j < children.getLength() && node2 == null; j++) {
  -                QName kind2 = Utils.getNodeQName(children.item(j));
  -                if (kind2 != null &&
  -                    (kind2.getLocalPart().equals("simpleType") ||
  -                     kind2.getLocalPart().equals("complexType") ||
  -                     kind2.getLocalPart().equals("simpleContent")) &&
  -                    Constants.isSchemaXSD(kind2.getNamespaceURI())) {
  -                    node2 = children.item(j);
  -                    node = node2;
  -                }
  -            }
  -        }
  -        // Get the node kind, expecting a schema simpleType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            (nodeKind.getLocalPart().equals("simpleType") ||
  -             nodeKind.getLocalPart().equals("complexType")) &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the complexType there could be a complexContent.
  -            NodeList children = node.getChildNodes();
  -            Node complexContent = null;
  -            if (nodeKind.getLocalPart().equals("complexType")) {
  -                for (int j = 0; j < children.getLength() && complexContent == null; j++) {
  -                    QName complexContentKind = Utils.getNodeQName(children.item(j));
  -                    if (complexContentKind != null &&
  -                        (complexContentKind.getLocalPart().equals("complexContent") ||
  -                         complexContentKind.getLocalPart().equals("simpleContent"))&&
  -                        Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
  -                        complexContent = children.item(j);
  -                }
  -                node = complexContent;
  -            }
  -            // Now get the extension or restriction node
  -            if (node != null) {
  -                children = node.getChildNodes();
  -                for (int j = 0; j < children.getLength() && re == null; j++) {
  -                    QName reKind = Utils.getNodeQName(children.item(j));
  -                    if (reKind != null &&
  -                        (reKind.getLocalPart().equals("extension") ||
  -                         reKind.getLocalPart().equals("restriction")) &&
  -                        Constants.isSchemaXSD(reKind.getNamespaceURI()))
  -                        re = children.item(j);
  -                }
  -            }
  -        }
  -            
  -        return re;
  -    }
  -
  -    /**
  -     * If the specified node represents an array encoding of one of the following
  -     * forms, then return the qname repesenting the element type of the array.
  -     * @param node is the node
  -     * @param dims is the output value that contains the number of dimensions if return is not null
  -     * @return QName or null
  -     */
  -    public static QName getArrayElementQName(Node node, IntHolder dims) {
  -        dims.value = 1;  // assume 1 dimension
  -        QName qName = getCollectionElementQName(node);
  -        if (qName == null) {
  -            qName = getArrayElementQName_JAXRPC(node, dims);
  -        }
  -        return qName;
  -    }
  -
  -    /**
  -     * If the specified node represents an element that refernces a collection
  -     * then return the qname repesenting the element type of the collection.
  -     *
  -     *  <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
  -     *
  -     */
  -    private static QName getCollectionElementQName(Node node) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        // If the node kind is an element, dive get its type.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Get the qName of just the type.
  -            // The compare it against the full type of the node, which
  -            // takes into account maxOccurs and could return a collection type.
  -            // If different, return just the type (which is the collection element type).
  -            QName justTypeQName = Utils.getNodeTypeRefQName(node, "type");
  -            if (justTypeQName != null) {
  -                QName fullTypeQName = Utils.getNodeTypeRefQName(node, new BooleanHolder());
  -                if (justTypeQName != fullTypeQName)
  -                    return justTypeQName;
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * If the specified node represents an array encoding of one of the following
  -     * forms, then return the qname repesenting the element type of the array.
  -     *
  -     * @param node is the node
  -     * @param dims is the output value that contains the number of dimensions if return is not null
  -     * @return QName or null
  -     *
  -     * JAX-RPC Style 2:
  -     *<xsd:complexType name="hobbyArray">
  -     *  <xsd:complexContent>
  -     *    <xsd:restriction base="soapenc:Array">
  -     *      <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
  -     *    </xsd:restriction>
  -     *  </xsd:complexContent>
  -     *</xsd:complexType>
  -     *
  -     * JAX-RPC Style 3:
  -     *<xsd:complexType name="petArray">
  -     *  <xsd:complexContent>
  -     *    <xsd:restriction base="soapenc:Array">
  -     *      <xsd:sequence>
  -     *        <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
  -     *      </xsd:sequence>
  -     *    </xsd:restriction>
  -     *  </xsd:complexContent>
  -     *</xsd:complexType>
  -     *
  -     */
  -    private static QName getArrayElementQName_JAXRPC(Node node, IntHolder dims) {
  -        dims.value = 0;  // Assume 0
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node complexNode = null;
  -            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  -                QName complexKind = Utils.getNodeQName(children.item(j));
  -                if (complexKind != null &&
  -                    complexKind.getLocalPart().equals("complexType") &&
  -                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  -                    complexNode = children.item(j);
  -                    node = complexNode;
  -                }
  -            }
  -        }
  -        // Get the node kind, expecting a schema complexType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("complexType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the complexType there should be a complexContent.
  -            // (There may be other #text nodes, which we will ignore).
  -            NodeList children = node.getChildNodes();
  -            Node complexContentNode = null;
  -            for (int j = 0; j < children.getLength() && complexContentNode == null; j++) {
  -                QName complexContentKind = Utils.getNodeQName(children.item(j));
  -                if (complexContentKind != null &&
  -                    (complexContentKind.getLocalPart().equals("complexContent") ||
  -                    complexContentKind.getLocalPart().equals("simpleContent")) &&
  -                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
  -                    complexContentNode = children.item(j);
  -            }
  -
  -            // Under the complexContent there should be a restriction.
  -            // (There may be other #text nodes, which we will ignore).
  -            Node restrictionNode = null;
  -            if (complexContentNode != null) {
  -                children = complexContentNode.getChildNodes();
  -                for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  -                    QName restrictionKind = Utils.getNodeQName(children.item(j));
  -                    if (restrictionKind != null &&
  -                        restrictionKind.getLocalPart().equals("restriction") &&
  -                        Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  -                        restrictionNode = children.item(j);
  -                }
  -            }
  -
  -            // The restriction node must have a base of soapenc:Array.  
  -            QName baseType = null;
  -            if (restrictionNode != null) {
  -                baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
  -                if (baseType != null &&
  -                    baseType.getLocalPart().equals("Array") &&
  -                    Constants.isSOAP_ENC(baseType.getNamespaceURI()))
  -                    ; // Okay
  -                else
  -                    baseType = null;  // Did not find base=soapenc:Array
  -            }
  -
  -            
  -            // Under the restriction there should be an attribute OR a sequence/all group node.
  -            // (There may be other #text nodes, which we will ignore).
  -            Node groupNode = null;
  -            Node attributeNode = null;
  -            if (baseType != null) {
  -                children = restrictionNode.getChildNodes();
  -                for (int j = 0;
  -                     j < children.getLength() && groupNode == null && attributeNode == null;
  -                     j++) {
  -                    QName kind = Utils.getNodeQName(children.item(j));
  -                    if (kind != null &&
  -                        (kind.getLocalPart().equals("sequence") ||
  -                         kind.getLocalPart().equals("all")) &&
  -                        Constants.isSchemaXSD(kind.getNamespaceURI())) {
  -                        groupNode = children.item(j);
  -                    }
  -                    if (kind != null &&
  -                        kind.getLocalPart().equals("attribute") &&
  -                        Constants.isSchemaXSD(kind.getNamespaceURI())) {
  -                        // If the attribute node does not have ref="soapenc:arrayType"
  -                        // then keep looking.
  -                        QName refQName = Utils.getNodeTypeRefQName(children.item(j), "ref");
  -                        if (refQName != null &&
  -                            refQName.getLocalPart().equals("arrayType") &&
  -                            Constants.isSOAP_ENC(refQName.getNamespaceURI())) {
  -                            attributeNode = children.item(j);
  -                        }
  -                    }
  -                }
  -            }
  -
  -            // If there is an attribute node, look at wsdl:arrayType to get the element type
  -            if (attributeNode != null) {
  -                String wsdlArrayTypeValue = null;
  -                Vector attrs = Utils.getAttributesWithLocalName(attributeNode, "arrayType");
  -                for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
  -                    Node attrNode = (Node) attrs.elementAt(i);
  -                    String attrName = attrNode.getNodeName();
  -                    QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
  -                    if (Constants.isWSDL(attrQName.getNamespaceURI())) {
  -                        wsdlArrayTypeValue = attrNode.getNodeValue();
  -                    }
  -                }
  -
  -                // The value could have any number of [] or [,] on the end
  -                // Strip these off to get the prefixed name.
  -                // The convert the prefixed name into a qname.
  -                // Count the number of [ and , to get the dim information.
  -                if (wsdlArrayTypeValue != null) {
  -                    int i = wsdlArrayTypeValue.indexOf('[');
  -                    if (i > 0) {
  -                        String prefixedName = wsdlArrayTypeValue.substring(0,i);
  -                        String mangledString = wsdlArrayTypeValue.replace(',', '[');
  -                        dims.value = 0;
  -                        int index = mangledString.indexOf('[');
  -                        while (index > 0) {
  -                            dims.value++;
  -                            index = mangledString.indexOf('[',index+1);
  -                        }
  -                        
  -                        return Utils.getQNameFromPrefixedName(restrictionNode, prefixedName);
  -                    }
  -                }
  -            } else if (groupNode != null) {
  -
  -                // Get the first element node under the group node.       
  -                NodeList elements = groupNode.getChildNodes();
  -                Node elementNode = null;
  -                for (int i=0; i < elements.getLength() && elementNode == null; i++) {
  -                    QName elementKind = Utils.getNodeQName(elements.item(i));
  -                    if (elementKind != null &&
  -                        elementKind.getLocalPart().equals("element") &&
  -                        Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
  -                        elementNode = elements.item(i);
  -                    }
  -                }
  -                 
  -                // The element node should have maxOccurs="unbounded" and
  -                // a type
  -                if (elementNode != null) {
  -                    String maxOccursValue = Utils.getAttribute(elementNode, "maxOccurs");
  -                    if (maxOccursValue != null &&
  -                        maxOccursValue.equalsIgnoreCase("unbounded")) {
  -                        // Get the QName of just the type
  -                        dims.value = 1;
  -                        return Utils.getNodeTypeRefQName(elementNode, "type");
  -                    }
  -                }
  -            }
  -            
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Return the attribute names and types if any in the node
  -     * The even indices are the element types (TypeEntry) and
  -     * the odd indices are the corresponding names (Strings).
  -     * 
  -     * Example:
  -     * <complexType name="Person">
  -     *   <sequence>
  -     *     <element minOccurs="1" maxOccurs="1" name="Age" type="double" />
  -     *     <element minOccurs="1" maxOccurs="1" name="ID" type="xsd:float" />
  -     *   </sequence>
  -     *   <attribute name="Name" type="string" />
  -     *   <attribute name="Male" type="boolean" />
  -     * </complexType>
  -     * 
  -     */ 
  -    public static Vector getContainedAttributeTypes(Node node, 
  -                                                    SymbolTable symbolTable) 
  -    {
  -        Vector v = null;    // return value
  -        
  -        if (node == null) {
  -            return null;
  -        }
  -        // Check for SimpleContent
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node complexNode = null;
  -            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  -                QName complexKind = Utils.getNodeQName(children.item(j));
  -                if (complexKind != null &&
  -                    complexKind.getLocalPart().equals("complexType") &&
  -                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  -                    complexNode = children.item(j);
  -                    node = complexNode;
  -                }
  -            }
  -        }
  -
  -        // Expecting a schema complexType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("complexType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the complexType there could be complexContent/simpleContent
  -            // and extension elements if this is a derived type.  Skip over these.
  -            NodeList children = node.getChildNodes();
  -            Node content = null;
  -            Node extension = null;
  -            for (int j = 0; j < children.getLength() && content == null; j++) {
  -                QName complexContentKind = Utils.getNodeQName(children.item(j));
  -                if (complexContentKind != null &&
  -                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
  -                    if (complexContentKind.getLocalPart().equals("complexContent") ||
  -                        complexContentKind.getLocalPart().equals("simpleContent")) {
  -                        content = children.item(j);
  -                    }
  -                }
  -            }
  -            // Check for extensions
  -            if (content != null) {
  -                children = content.getChildNodes();
  -                for (int j = 0; j < children.getLength(); j++) {
  -                    QName extensionKind = Utils.getNodeQName(children.item(j));
  -                    if (extensionKind != null &&
  -                            extensionKind.getLocalPart().equals("extension") &&
  -                            Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
  -                        extension = children.item(j);
  -                        break;
  -                    }
  -                }
  -            }
  -            
  -            if (extension != null) {
  -                node = extension;
  -            }
  -            
  -            // examine children of the node for <attribute> elements
  -            children = node.getChildNodes();
  -            for (int i = 0; i < children.getLength(); i++) {
  -                Node child = children.item(i);
  -                nodeKind = Utils.getNodeQName(child);
  -                if (nodeKind == null ||
  -                        ! nodeKind.getLocalPart().equals("attribute"))
  -                    continue;
  -                
  -                // we have an attribute node
  -                if (v == null)
  -                    v = new Vector();
  -                
  -                // type
  -                QName typeAttr = Utils.getNodeTypeRefQName(child, "type");
  -                if (typeAttr == null) {
  -                    // Could be defined as an anonymous type
  -                    typeAttr = getAttributeAnonQName(child);
  -                }
  -
  -                // Get the corresponding TypeEntry
  -                TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
  -
  -                // Need to add code here to get the qualified or unqualified
  -                // name.  Similar to the code around line 350 for elenments.
  -                // Rich Scheuerle
  -
  -                // Now get the name.
  -                QName name = Utils.getNodeNameQName(child);
  -                // add type and name to vector, skip it if we couldn't parse it
  -                // XXX - this may need to be revisited.
  -                if (type != null && name != null) {
  -                    v.add(type);
  -                    v.add(name.getLocalPart());
  -                }
  -            }
  -        }            
  -        return v;
  -    }
  -
  -}
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.wsdl.symbolTable;
  +
  +import java.util.Vector;
  +
  +import javax.wsdl.QName;
  +
  +import javax.xml.rpc.holders.BooleanHolder;
  +import javax.xml.rpc.holders.IntHolder;
  +
  +import org.apache.axis.Constants;
  +
  +import org.w3c.dom.Node;
  +import org.w3c.dom.NodeList;
  +
  +/**
  + * This class contains static utility methods specifically for schema type queries.
  + *
  + * @author Rich Scheuerle  (scheu@us.ibm.com)
  + */
  +public class SchemaUtils {
  +
  +    /**
  +     * If the specified node represents a supported JAX-RPC complexType or 
  +     * simpleType, a Vector is returned which contains ElementDecls for the 
  +     * child element names. 
  +     * If the element is a simpleType, an ElementDecls is built representing
  +     * the restricted type with the special name "value".
  +     * If the element is a complexType which has simpleContent, an ElementDecl
  +     * is built representing the extended type with the special name "value".
  +     * This method does not return attribute names and types
  +     * (use the getContainedAttributeTypes)
  +     * If the specified node is not a supported 
  +     * JAX-RPC complexType/simpleType/element null is returned.
  +     */
  +    public static Vector getContainedElementDeclarations(Node node, SymbolTable symbolTable) {
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node complexNode = null;
  +            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  +                QName complexKind = Utils.getNodeQName(children.item(j));
  +                if (complexKind != null &&
  +                    complexKind.getLocalPart().equals("complexType") &&
  +                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  +                    complexNode = children.item(j);
  +                    node = complexNode;
  +                }
  +            }
  +        }
  +
  +        // Expecting a schema complexType or simpleType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("complexType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the complexType there could be complexContent/simpleContent
  +            // and extension elements if this is a derived type.  Skip over these.
  +            NodeList children = node.getChildNodes();
  +            Node complexContent = null;
  +            Node simpleContent = null;
  +            Node extension = null;
  +            for (int j = 0; j < children.getLength() && complexContent == null; j++) {
  +                QName complexContentKind = Utils.getNodeQName(children.item(j));
  +                if (complexContentKind != null &&
  +                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
  +                    if (complexContentKind.getLocalPart().equals("complexContent") )
  +                        complexContent = children.item(j);
  +                    else if (complexContentKind.getLocalPart().equals("simpleContent"))
  +                        simpleContent = children.item(j);
  +                }
  +            }
  +            if (complexContent != null) {
  +                children = complexContent.getChildNodes();
  +                for (int j = 0; j < children.getLength() && extension == null; j++) {
  +                    QName extensionKind = Utils.getNodeQName(children.item(j));
  +                    if (extensionKind != null &&
  +                        extensionKind.getLocalPart().equals("extension") &&
  +                        Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
  +                        extension = children.item(j);
  +                }
  +            }
  +            if (simpleContent != null) {
  +                children = simpleContent.getChildNodes();
  +                for (int j = 0; j < children.getLength() && extension == null; j++) {
  +                    QName extensionKind = Utils.getNodeQName(children.item(j));
  +                    if (extensionKind != null &&
  +                        extensionKind.getLocalPart().equals("extension") &&
  +                        Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
  +                        
  +                        // get the type of the extension
  +                        QName extendsType =
  +                                Utils.getNodeTypeRefQName(children.item(j), 
  +                                                          "base");
  +                        
  +                        // Return an element declaration with a fixed name
  +                        // ("value") and the correct type.                        
  +                        Vector v = new Vector();
  +                        ElementDecl elem = new ElementDecl();
  +                        elem.setType(symbolTable.getTypeEntry(extendsType, false));
  +                        elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
  +                        v.add(elem);
  +                        return v;
  +                    }
  +                        
  +                }
  +            }
  +
  +            if (extension != null) {
  +                node = extension;  // Skip over complexContent and extension
  +            }
  +
  +            // Under the complexType there may be choice, sequence, group and/or all nodes.      
  +            // (There may be other #text nodes, which we will ignore).
  +            children = node.getChildNodes();
  +            Vector v = new Vector();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                QName subNodeKind = Utils.getNodeQName(children.item(j));
  +                if (subNodeKind != null &&
  +                    Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  +                    if (subNodeKind.getLocalPart().equals("sequence")) {
  +                        v.addAll(processSequenceNode(children.item(j), symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("all")) {
  +                        v.addAll(processAllNode(children.item(j), symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("choice")) {
  +                        v.addAll(processChoiceNode(children.item(j), symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("group")) {
  +                        v.addAll(processGroupNode(children.item(j), symbolTable));
  +                    }
  +                }
  +            }
  +            return v;
  +        } else {
  +            // This may be a simpleType, return the type with the name "value"
  +            QName simpleQName = getSimpleTypeBase(node, symbolTable);
  +            if (simpleQName != null) {
  +                TypeEntry simpleType = symbolTable.getType(simpleQName);
  +                if (simpleType != null) {
  +                    Vector v = new Vector();
  +                    ElementDecl elem = new ElementDecl();
  +                    elem.setType(simpleType);
  +                    elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
  +                    v.add(elem);
  +                    return v;
  +                }
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Invoked by getContainedElementDeclarations to get the child element types
  +     * and child element names underneath a Choice Node
  +     */
  +    private static Vector processChoiceNode(Node choiceNode, 
  +                                            SymbolTable symbolTable) {
  +        Vector v = new Vector();
  +        NodeList children = choiceNode.getChildNodes();
  +        for (int j = 0; j < children.getLength(); j++) {
  +            QName subNodeKind = Utils.getNodeQName(children.item(j));
  +            if (subNodeKind != null &&
  +                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  +                if (subNodeKind.getLocalPart().equals("choice")) {
  +                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  +                    v.addAll(processSequenceNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("group")) {
  +                    v.addAll(processGroupNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("element")) {
  +                    ElementDecl elem = 
  +                            processChildElementNode(children.item(j), 
  +                                                    symbolTable);
  +                    if (elem != null)
  +                        v.add(elem);
  +                }
  +            }
  +        }
  +        return v;
  +    }
  +
  +    /**
  +     * Invoked by getContainedElementDeclarations to get the child element types
  +     * and child element names underneath a Sequence Node
  +     */
  +    private static Vector processSequenceNode(Node sequenceNode, 
  +                                              SymbolTable symbolTable) {
  +        Vector v = new Vector();
  +        NodeList children = sequenceNode.getChildNodes();
  +        for (int j = 0; j < children.getLength(); j++) {
  +            QName subNodeKind = Utils.getNodeQName(children.item(j));
  +            if (subNodeKind != null &&
  +                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  +                if (subNodeKind.getLocalPart().equals("choice")) {
  +                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  +                    v.addAll(processSequenceNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("group")) {
  +                    v.addAll(processGroupNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("any")) {
  +                    TypeEntry type = new DefinedType(Utils.getWSDLQName(Constants.XSD_ANYTYPE), sequenceNode);
  +                    type.setName("java.lang.Object");
  +                    ElementDecl elem = new ElementDecl(type, Utils.getAxisQName(new QName("","any")));
  +                    v.add(elem);
  +                } else if (subNodeKind.getLocalPart().equals("element")) {
  +                    ElementDecl elem = 
  +                            processChildElementNode(children.item(j), 
  +                                                    symbolTable);
  +                    if (elem != null)
  +                        v.add(elem);
  +                }
  +            }
  +        }
  +        return v;
  +    }
  +
  +    /**
  +     * Invoked by getContainedElementDeclarations to get the child element types
  +     * and child element names underneath a group node.
  +     * (Currently the code only supports a defined group it does not
  +     * support a group that references a previously defined group)
  +     */
  +    private static Vector processGroupNode(Node groupNode, SymbolTable symbolTable) {
  +        Vector v = new Vector();
  +        NodeList children = groupNode.getChildNodes();
  +        for (int j = 0; j < children.getLength(); j++) {
  +            QName subNodeKind = Utils.getNodeQName(children.item(j));
  +            if (subNodeKind != null &&
  +                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  +                if (subNodeKind.getLocalPart().equals("choice")) {
  +                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  +                    v.addAll(processSequenceNode(children.item(j), symbolTable));
  +                } else if (subNodeKind.getLocalPart().equals("all")) {
  +                    v.addAll(processAllNode(children.item(j), symbolTable));
  +                }
  +            }
  +        }
  +        return v;
  +    }
  +
  +    /**
  +     * Invoked by getContainedElementDeclarations to get the child element types
  +     * and child element names underneath an all node.
  +     */
  +    private static Vector processAllNode(Node allNode, SymbolTable symbolTable) {
  +        Vector v = new Vector();
  +        NodeList children = allNode.getChildNodes();
  +        for (int j = 0; j < children.getLength(); j++) {
  +            QName subNodeKind = Utils.getNodeQName(children.item(j));
  +            if (subNodeKind != null &&
  +                Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  +                if (subNodeKind.getLocalPart().equals("element")) {
  +                    ElementDecl elem = 
  +                            processChildElementNode(children.item(j), 
  +                                                    symbolTable);
  +                    if (elem != null)
  +                        v.add(elem);
  +                }
  +            }
  +        }
  +        return v;
  +    }
  +
  +
  +    /**
  +     * Invoked by getContainedElementDeclarations to get the child element type
  +     * and child element name for a child element node.
  +     *
  +     * If the specified node represents a supported JAX-RPC child element,
  +     * we return an ElementDecl containing the child element name and type.
  +     */
  +    private static ElementDecl processChildElementNode(Node elementNode, 
  +                                                  SymbolTable symbolTable) {
  +        // Get the name and type qnames.
  +        // The type qname is used to locate the TypeEntry, which is then
  +        // used to retrieve the proper java name of the type.
  +        QName nodeName = Utils.getNodeNameQName(elementNode);
  +        BooleanHolder forElement = new BooleanHolder();
  +        QName nodeType = Utils.getNodeTypeRefQName(elementNode, forElement);
  +
  +
  +        // An element inside a complex type is either qualified or unqualified.
  +        // If the ref= attribute is used, the name of the ref'd element is used
  +        // (which must be a root element).  If the ref= attribute is not
  +        // used, the name of the element is unqualified.
  +
  +        if (!forElement.value) {
  +            // check the Form (or elementFormDefault) attribute of this node to
  +            // determine if it should be namespace quailfied or not.
  +            String form = Utils.getAttribute(elementNode, "form");
  +            if (form != null && form.equals("unqualified")) {
  +                // Unqualified nodeName
  +                nodeName = new QName("", nodeName.getLocalPart());            
  +            } else if (form == null) {
  +                // check elementForDefault on schema element
  +                String def = Utils.getScopedAttribute(elementNode, 
  +                                                      "elementFormDefault");
  +                if (def == null || def.equals("unqualified")) {
  +                    // Unqualified nodeName
  +                    nodeName = new QName("", nodeName.getLocalPart());            
  +                }
  +            }
  +        } else {
  +            nodeName = nodeType;
  +        }
  +        if (nodeType == null) {
  +            nodeType = getElementAnonQName(elementNode);            
  +            forElement.value = false;
  +        }
  +
  +        
  +        TypeEntry type = (TypeEntry)symbolTable.getTypeEntry(nodeType, 
  +                                                             forElement.value);
  +        if (type != null) {
  +            ElementDecl elem = new ElementDecl(type ,Utils.getAxisQName(nodeName));
  +            String minOccurs = Utils.getAttribute(elementNode, "minOccurs");
  +            if (minOccurs != null && minOccurs.equals("0")) {
  +                elem.setMinOccursIs0(true);
  +            }
  +            return elem;
  +        }
  +        
  +        return null;
  +    }
  +
  +    /**
  +     * Returns the WSDL2Java QName for the anonymous type of the element
  +     * or null.
  +     */
  +    public static QName getElementAnonQName(Node node) {
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                QName kind = Utils.getNodeQName(children.item(j));
  +                if (kind != null &&
  +                    (kind.getLocalPart().equals("complexType") ||
  +                     kind.getLocalPart().equals("simpleType")) &&
  +                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  +                    return Utils.getNodeNameQName(children.item(j));
  +                }
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Returns the WSDL2Java QName for the anonymous type of the attribute
  +     * or null.
  +     */
  +    public static QName getAttributeAnonQName(Node node) {
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("attribute") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                QName kind = Utils.getNodeQName(children.item(j));
  +                if (kind != null &&
  +                    (kind.getLocalPart().equals("complexType") ||
  +                     kind.getLocalPart().equals("simpleType")) &&
  +                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  +                    return Utils.getNodeNameQName(children.item(j));
  +                }
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * If the specified node is a simple type or contains simpleContent, return true
  +     */
  +    public static boolean isSimpleTypeOrSimpleContent(Node node) {
  +        if (node == null) {
  +            return false;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node complexNode = null;
  +            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  +                QName kind = Utils.getNodeQName(children.item(j));
  +                if (kind != null &&
  +                    kind.getLocalPart().equals("complexType") &&
  +                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  +                    complexNode = children.item(j);
  +                    node = complexNode;
  +                }
  +                if (kind != null &&
  +                    kind.getLocalPart().equals("simpleType") &&
  +                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
  +                    return true;
  +                }
  +            }
  +        }
  +
  +        // Expecting a schema complexType or simpleType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("simpleType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            return true;
  +        }
  +
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("complexType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the complexType there could be complexContent/simpleContent
  +            // and extension elements if this is a derived type.  Skip over these.
  +            NodeList children = node.getChildNodes();
  +            Node complexContent = null;
  +            Node simpleContent = null;
  +            for (int j = 0; j < children.getLength() && complexContent == null; j++) {
  +                QName complexContentKind = Utils.getNodeQName(children.item(j));
  +                if (complexContentKind != null &&
  +                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
  +                    if (complexContentKind.getLocalPart().equals("complexContent") )
  +                        complexContent = children.item(j);
  +                    else if (complexContentKind.getLocalPart().equals("simpleContent"))
  +                        simpleContent = children.item(j);
  +                }
  +            }
  +            if (complexContent != null) {
  +                return false;
  +            }
  +            if (simpleContent != null) {
  +                return true;
  +            }
  +        }
  +        return false;
  +    }
  +
  +    /**
  +     * If the specified node represents a supported JAX-RPC complexType/element
  +     * which extends another complexType.  The Type of the base is returned.
  +     */
  +    public static TypeEntry getComplexElementExtensionBase(Node node, SymbolTable symbolTable) {
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node complexNode = null;
  +            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  +                QName complexKind = Utils.getNodeQName(children.item(j));
  +                if (complexKind != null &&
  +                    complexKind.getLocalPart().equals("complexType") &&
  +                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  +                    complexNode = children.item(j);
  +                    node = complexNode;
  +                }
  +            }
  +        }
  +
  +        // Expecting a schema complexType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("complexType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the complexType there could be should be a complexContent &
  +            // extension elements if this is a derived type. 
  +            NodeList children = node.getChildNodes();
  +            Node content = null;
  +            Node extension = null;
  +            for (int j = 0; j < children.getLength() && content == null; j++) {
  +                QName contentKind = Utils.getNodeQName(children.item(j));
  +                if (contentKind != null &&
  +                    contentKind.getLocalPart().equals("complexContent") &&
  +                    Constants.isSchemaXSD(contentKind.getNamespaceURI()))
  +                    content = children.item(j);
  +                if (contentKind != null &&
  +                    contentKind.getLocalPart().equals("simpleContent") &&
  +                    Constants.isSchemaXSD(contentKind.getNamespaceURI()))
  +                    content = children.item(j);
  +            }
  +            if (content != null) {
  +                children = content.getChildNodes();
  +                for (int j = 0; j < children.getLength() && extension == null; j++) {
  +                    QName extensionKind = Utils.getNodeQName(children.item(j));
  +                    if (extensionKind != null &&
  +                        extensionKind.getLocalPart().equals("extension") &&
  +                        Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
  +                        extension = children.item(j);
  +                }
  +            }
  +            if (extension == null) {
  +                return null;  // No extension                               
  +            }
  +
  +            // Get the QName of the extension base
  +            QName extendsType = Utils.getNodeTypeRefQName(extension, "base");
  +            if (extendsType == null) {
  +                return null; // No extension base
  +            }
  +            // Return associated Type
  +            return (TypeEntry) symbolTable.getType(extendsType);
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * If the specified node represents a 'normal' non-enumeration simpleType,
  +     * the QName of the simpleType base is returned.
  +     */
  +    public static QName getSimpleTypeBase(Node node, SymbolTable symbolTable) {
  +        QName baseQName = null;
  +
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node simpleNode = null;
  +            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
  +                QName simpleKind = Utils.getNodeQName(children.item(j));
  +                if (simpleKind != null &&
  +                    simpleKind.getLocalPart().equals("simpleType") &&
  +                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
  +                    simpleNode = children.item(j);
  +                    node = simpleNode;
  +                }
  +            }
  +        }
  +        // Get the node kind, expecting a schema simpleType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("simpleType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the simpleType there should be a restriction.
  +            // (There may be other #text nodes, which we will ignore).
  +            NodeList children = node.getChildNodes();
  +            Node restrictionNode = null;
  +            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  +                QName restrictionKind = Utils.getNodeQName(children.item(j));
  +                if (restrictionKind != null &&
  +                    restrictionKind.getLocalPart().equals("restriction") &&
  +                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  +                    restrictionNode = children.item(j);
  +            }
  +
  +            // The restriction node indicates the type being restricted
  +            // (the base attribute contains this type).
  +            
  +            if (restrictionNode != null) {
  +                baseQName = Utils.getNodeTypeRefQName(restrictionNode, "base");
  +            }
  +            
  +            // Look for enumeration elements underneath the restriction node
  +            if (baseQName != null && restrictionNode != null) {
  +                NodeList enums = restrictionNode.getChildNodes();
  +                for (int i=0; i < enums.getLength(); i++) {
  +                    QName enumKind = Utils.getNodeQName(enums.item(i));
  +                    if (enumKind != null &&
  +                        enumKind.getLocalPart().equals("enumeration") &&
  +                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
  +                        
  +                        // Found an enumeration, this isn't a 
  +                        // 'normal' simple type.
  +                        return null;
  +                    }
  +                }
  +            }
  +        }
  +        return baseQName;
  +    }
  +
  +    /**
  +     * Returns the contained restriction or extension node underneath
  +     * the specified node.  Returns null if not found
  +     */
  +    public static Node getRestrictionOrExtensionNode(Node node) {
  +        Node re = null;
  +        if (node == null) {
  +            return re;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node node2 = null;
  +            for (int j = 0; j < children.getLength() && node2 == null; j++) {
  +                QName kind2 = Utils.getNodeQName(children.item(j));
  +                if (kind2 != null &&
  +                    (kind2.getLocalPart().equals("simpleType") ||
  +                     kind2.getLocalPart().equals("complexType") ||
  +                     kind2.getLocalPart().equals("simpleContent")) &&
  +                    Constants.isSchemaXSD(kind2.getNamespaceURI())) {
  +                    node2 = children.item(j);
  +                    node = node2;
  +                }
  +            }
  +        }
  +        // Get the node kind, expecting a schema simpleType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            (nodeKind.getLocalPart().equals("simpleType") ||
  +             nodeKind.getLocalPart().equals("complexType")) &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the complexType there could be a complexContent.
  +            NodeList children = node.getChildNodes();
  +            Node complexContent = null;
  +            if (nodeKind.getLocalPart().equals("complexType")) {
  +                for (int j = 0; j < children.getLength() && complexContent == null; j++) {
  +                    QName complexContentKind = Utils.getNodeQName(children.item(j));
  +                    if (complexContentKind != null &&
  +                        (complexContentKind.getLocalPart().equals("complexContent") ||
  +                         complexContentKind.getLocalPart().equals("simpleContent"))&&
  +                        Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
  +                        complexContent = children.item(j);
  +                }
  +                node = complexContent;
  +            }
  +            // Now get the extension or restriction node
  +            if (node != null) {
  +                children = node.getChildNodes();
  +                for (int j = 0; j < children.getLength() && re == null; j++) {
  +                    QName reKind = Utils.getNodeQName(children.item(j));
  +                    if (reKind != null &&
  +                        (reKind.getLocalPart().equals("extension") ||
  +                         reKind.getLocalPart().equals("restriction")) &&
  +                        Constants.isSchemaXSD(reKind.getNamespaceURI()))
  +                        re = children.item(j);
  +                }
  +            }
  +        }
  +            
  +        return re;
  +    }
  +
  +    /**
  +     * If the specified node represents an array encoding of one of the following
  +     * forms, then return the qname repesenting the element type of the array.
  +     * @param node is the node
  +     * @param dims is the output value that contains the number of dimensions if return is not null
  +     * @return QName or null
  +     */
  +    public static QName getArrayElementQName(Node node, IntHolder dims) {
  +        dims.value = 1;  // assume 1 dimension
  +        QName qName = getCollectionElementQName(node);
  +        if (qName == null) {
  +            qName = getArrayElementQName_JAXRPC(node, dims);
  +        }
  +        return qName;
  +    }
  +
  +    /**
  +     * If the specified node represents an element that refernces a collection
  +     * then return the qname repesenting the element type of the collection.
  +     *
  +     *  <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
  +     *
  +     */
  +    private static QName getCollectionElementQName(Node node) {
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        // If the node kind is an element, dive get its type.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Get the qName of just the type.
  +            // The compare it against the full type of the node, which
  +            // takes into account maxOccurs and could return a collection type.
  +            // If different, return just the type (which is the collection element type).
  +            QName justTypeQName = Utils.getNodeTypeRefQName(node, "type");
  +            if (justTypeQName != null) {
  +                QName fullTypeQName = Utils.getNodeTypeRefQName(node, new BooleanHolder());
  +                if (justTypeQName != fullTypeQName)
  +                    return justTypeQName;
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * If the specified node represents an array encoding of one of the following
  +     * forms, then return the qname repesenting the element type of the array.
  +     *
  +     * @param node is the node
  +     * @param dims is the output value that contains the number of dimensions if return is not null
  +     * @return QName or null
  +     *
  +     * JAX-RPC Style 2:
  +     *<xsd:complexType name="hobbyArray">
  +     *  <xsd:complexContent>
  +     *    <xsd:restriction base="soapenc:Array">
  +     *      <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
  +     *    </xsd:restriction>
  +     *  </xsd:complexContent>
  +     *</xsd:complexType>
  +     *
  +     * JAX-RPC Style 3:
  +     *<xsd:complexType name="petArray">
  +     *  <xsd:complexContent>
  +     *    <xsd:restriction base="soapenc:Array">
  +     *      <xsd:sequence>
  +     *        <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
  +     *      </xsd:sequence>
  +     *    </xsd:restriction>
  +     *  </xsd:complexContent>
  +     *</xsd:complexType>
  +     *
  +     */
  +    private static QName getArrayElementQName_JAXRPC(Node node, IntHolder dims) {
  +        dims.value = 0;  // Assume 0
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node complexNode = null;
  +            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  +                QName complexKind = Utils.getNodeQName(children.item(j));
  +                if (complexKind != null &&
  +                    complexKind.getLocalPart().equals("complexType") &&
  +                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  +                    complexNode = children.item(j);
  +                    node = complexNode;
  +                }
  +            }
  +        }
  +        // Get the node kind, expecting a schema complexType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("complexType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the complexType there should be a complexContent.
  +            // (There may be other #text nodes, which we will ignore).
  +            NodeList children = node.getChildNodes();
  +            Node complexContentNode = null;
  +            for (int j = 0; j < children.getLength() && complexContentNode == null; j++) {
  +                QName complexContentKind = Utils.getNodeQName(children.item(j));
  +                if (complexContentKind != null &&
  +                    (complexContentKind.getLocalPart().equals("complexContent") ||
  +                    complexContentKind.getLocalPart().equals("simpleContent")) &&
  +                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
  +                    complexContentNode = children.item(j);
  +            }
  +
  +            // Under the complexContent there should be a restriction.
  +            // (There may be other #text nodes, which we will ignore).
  +            Node restrictionNode = null;
  +            if (complexContentNode != null) {
  +                children = complexContentNode.getChildNodes();
  +                for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  +                    QName restrictionKind = Utils.getNodeQName(children.item(j));
  +                    if (restrictionKind != null &&
  +                        restrictionKind.getLocalPart().equals("restriction") &&
  +                        Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  +                        restrictionNode = children.item(j);
  +                }
  +            }
  +
  +            // The restriction node must have a base of soapenc:Array.  
  +            QName baseType = null;
  +            if (restrictionNode != null) {
  +                baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
  +                if (baseType != null &&
  +                    baseType.getLocalPart().equals("Array") &&
  +                    Constants.isSOAP_ENC(baseType.getNamespaceURI()))
  +                    ; // Okay
  +                else
  +                    baseType = null;  // Did not find base=soapenc:Array
  +            }
  +
  +            
  +            // Under the restriction there should be an attribute OR a sequence/all group node.
  +            // (There may be other #text nodes, which we will ignore).
  +            Node groupNode = null;
  +            Node attributeNode = null;
  +            if (baseType != null) {
  +                children = restrictionNode.getChildNodes();
  +                for (int j = 0;
  +                     j < children.getLength() && groupNode == null && attributeNode == null;
  +                     j++) {
  +                    QName kind = Utils.getNodeQName(children.item(j));
  +                    if (kind != null &&
  +                        (kind.getLocalPart().equals("sequence") ||
  +                         kind.getLocalPart().equals("all")) &&
  +                        Constants.isSchemaXSD(kind.getNamespaceURI())) {
  +                        groupNode = children.item(j);
  +                    }
  +                    if (kind != null &&
  +                        kind.getLocalPart().equals("attribute") &&
  +                        Constants.isSchemaXSD(kind.getNamespaceURI())) {
  +                        // If the attribute node does not have ref="soapenc:arrayType"
  +                        // then keep looking.
  +                        QName refQName = Utils.getNodeTypeRefQName(children.item(j), "ref");
  +                        if (refQName != null &&
  +                            refQName.getLocalPart().equals("arrayType") &&
  +                            Constants.isSOAP_ENC(refQName.getNamespaceURI())) {
  +                            attributeNode = children.item(j);
  +                        }
  +                    }
  +                }
  +            }
  +
  +            // If there is an attribute node, look at wsdl:arrayType to get the element type
  +            if (attributeNode != null) {
  +                String wsdlArrayTypeValue = null;
  +                Vector attrs = Utils.getAttributesWithLocalName(attributeNode, "arrayType");
  +                for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
  +                    Node attrNode = (Node) attrs.elementAt(i);
  +                    String attrName = attrNode.getNodeName();
  +                    QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
  +                    if (Constants.isWSDL(attrQName.getNamespaceURI())) {
  +                        wsdlArrayTypeValue = attrNode.getNodeValue();
  +                    }
  +                }
  +
  +                // The value could have any number of [] or [,] on the end
  +                // Strip these off to get the prefixed name.
  +                // The convert the prefixed name into a qname.
  +                // Count the number of [ and , to get the dim information.
  +                if (wsdlArrayTypeValue != null) {
  +                    int i = wsdlArrayTypeValue.indexOf('[');
  +                    if (i > 0) {
  +                        String prefixedName = wsdlArrayTypeValue.substring(0,i);
  +                        String mangledString = wsdlArrayTypeValue.replace(',', '[');
  +                        dims.value = 0;
  +                        int index = mangledString.indexOf('[');
  +                        while (index > 0) {
  +                            dims.value++;
  +                            index = mangledString.indexOf('[',index+1);
  +                        }
  +                        
  +                        return Utils.getQNameFromPrefixedName(restrictionNode, prefixedName);
  +                    }
  +                }
  +            } else if (groupNode != null) {
  +
  +                // Get the first element node under the group node.       
  +                NodeList elements = groupNode.getChildNodes();
  +                Node elementNode = null;
  +                for (int i=0; i < elements.getLength() && elementNode == null; i++) {
  +                    QName elementKind = Utils.getNodeQName(elements.item(i));
  +                    if (elementKind != null &&
  +                        elementKind.getLocalPart().equals("element") &&
  +                        Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
  +                        elementNode = elements.item(i);
  +                    }
  +                }
  +                 
  +                // The element node should have maxOccurs="unbounded" and
  +                // a type
  +                if (elementNode != null) {
  +                    String maxOccursValue = Utils.getAttribute(elementNode, "maxOccurs");
  +                    if (maxOccursValue != null &&
  +                        maxOccursValue.equalsIgnoreCase("unbounded")) {
  +                        // Get the QName of just the type
  +                        dims.value = 1;
  +                        return Utils.getNodeTypeRefQName(elementNode, "type");
  +                    }
  +                }
  +            }
  +            
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Return the attribute names and types if any in the node
  +     * The even indices are the element types (TypeEntry) and
  +     * the odd indices are the corresponding names (Strings).
  +     * 
  +     * Example:
  +     * <complexType name="Person">
  +     *   <sequence>
  +     *     <element minOccurs="1" maxOccurs="1" name="Age" type="double" />
  +     *     <element minOccurs="1" maxOccurs="1" name="ID" type="xsd:float" />
  +     *   </sequence>
  +     *   <attribute name="Name" type="string" />
  +     *   <attribute name="Male" type="boolean" />
  +     * </complexType>
  +     * 
  +     */ 
  +    public static Vector getContainedAttributeTypes(Node node, 
  +                                                    SymbolTable symbolTable) 
  +    {
  +        Vector v = null;    // return value
  +        
  +        if (node == null) {
  +            return null;
  +        }
  +        // Check for SimpleContent
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node complexNode = null;
  +            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
  +                QName complexKind = Utils.getNodeQName(children.item(j));
  +                if (complexKind != null &&
  +                    complexKind.getLocalPart().equals("complexType") &&
  +                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
  +                    complexNode = children.item(j);
  +                    node = complexNode;
  +                }
  +            }
  +        }
  +
  +        // Expecting a schema complexType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("complexType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the complexType there could be complexContent/simpleContent
  +            // and extension elements if this is a derived type.  Skip over these.
  +            NodeList children = node.getChildNodes();
  +            Node content = null;
  +            Node extension = null;
  +            for (int j = 0; j < children.getLength() && content == null; j++) {
  +                QName complexContentKind = Utils.getNodeQName(children.item(j));
  +                if (complexContentKind != null &&
  +                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
  +                    if (complexContentKind.getLocalPart().equals("complexContent") ||
  +                        complexContentKind.getLocalPart().equals("simpleContent")) {
  +                        content = children.item(j);
  +                    }
  +                }
  +            }
  +            // Check for extensions
  +            if (content != null) {
  +                children = content.getChildNodes();
  +                for (int j = 0; j < children.getLength(); j++) {
  +                    QName extensionKind = Utils.getNodeQName(children.item(j));
  +                    if (extensionKind != null &&
  +                            extensionKind.getLocalPart().equals("extension") &&
  +                            Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
  +                        extension = children.item(j);
  +                        break;
  +                    }
  +                }
  +            }
  +            
  +            if (extension != null) {
  +                node = extension;
  +            }
  +            
  +            // examine children of the node for <attribute> elements
  +            children = node.getChildNodes();
  +            for (int i = 0; i < children.getLength(); i++) {
  +                Node child = children.item(i);
  +                nodeKind = Utils.getNodeQName(child);
  +                if (nodeKind == null ||
  +                        ! nodeKind.getLocalPart().equals("attribute"))
  +                    continue;
  +                
  +                // we have an attribute node
  +                if (v == null)
  +                    v = new Vector();
  +                
  +                // type
  +                QName typeAttr = Utils.getNodeTypeRefQName(child, "type");
  +                if (typeAttr == null) {
  +                    // Could be defined as an anonymous type
  +                    typeAttr = getAttributeAnonQName(child);
  +                }
  +
  +                // Get the corresponding TypeEntry
  +                TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
  +
  +                // Need to add code here to get the qualified or unqualified
  +                // name.  Similar to the code around line 350 for elenments.
  +                // Rich Scheuerle
  +
  +                // Now get the name.
  +                QName name = Utils.getNodeNameQName(child);
  +                // add type and name to vector, skip it if we couldn't parse it
  +                // XXX - this may need to be revisited.
  +                if (type != null && name != null) {
  +                    v.add(type);
  +                    v.add(name.getLocalPart());
  +                }
  +            }
  +        }            
  +        return v;
  +    }
  +
  +}
  
  
  
  1.5       +597 -600  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Utils.java	30 May 2002 03:06:12 -0000	1.4
  +++ Utils.java	30 May 2002 23:46:02 -0000	1.5
  @@ -1,600 +1,597 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.wsdl.symbolTable;
  -
  -import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.Vector;
  -
  -import javax.wsdl.QName;
  -
  -import javax.xml.rpc.holders.BooleanHolder;
  -import javax.xml.rpc.holders.IntHolder;
  -
  -import org.apache.axis.Constants;
  -
  -import org.w3c.dom.NamedNodeMap;
  -
  -import org.w3c.dom.Node;
  -
  -/**
  - * This class contains static utility methods for the emitter.
  - *
  - * @author Rich Scheuerle  (scheu@us.ibm.com)
  - * @author Tom Jordahl (tomj@macromedia.com)
  - */
  -public class Utils {
  -
  -    /**
  -     * getNillableQName returns the QName to use if the nillable=true
  -     * attribute is used.                             
  -     * For example, in JAX-RPC:
  -     *   The QName "xsd:int" maps to a java int.
  -     *   However if an element with a type="xsd:int" also has the 
  -     *   "nillable=true" attribute, the type should be an Integer (not an int).
  -     *   So in these circumstances, this routine is called with xsd:int to 
  -     *   get a suitable qname (soapenc:int) which maps to Integer.
  -     * @param QName
  -     */
  -    public static QName getNillableQName(QName qName) {
  -        QName rc = new QName(qName.getNamespaceURI(), qName.getLocalPart());
  -        if (Constants.isSchemaXSD(rc.getNamespaceURI())) {
  -            String localName = rc.getLocalPart();
  -            if (localName.equals("int") ||
  -                localName.equals("long") ||
  -                localName.equals("short") ||
  -                localName.equals("float") ||
  -                localName.equals("double") ||
  -                localName.equals("boolean") ||
  -                localName.equals("byte")) {
  -                rc.setNamespaceURI(Constants.NS_URI_CURRENT_SOAP_ENC);
  -            }
  -            else if (localName.equals("base64Binary") ||
  -                     localName.equals("hexBinary")) {
  -                rc.setNamespaceURI(Constants.NS_URI_CURRENT_SOAP_ENC);
  -                rc.setLocalPart("base64");
  -            }
  -        }
  -       return rc;
  -    }
  -    /**
  -     * Given a node, return the value of the given attribute.
  -     * If the attribute does not exist, searching continues through ancestor nodes until found.
  -     * This method is useful for finding attributes that pertain to a group of contained
  -     * nodes (i.e. xlmns, xmlns:tns, targetNamespace, name)
  -     */
  -    public static String getScopedAttribute(Node node, String attr) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        if (node.getAttributes() == null)
  -            return getScopedAttribute(node.getParentNode(), attr);
  -
  -        Node attrNode = node.getAttributes().getNamedItem(attr);
  -        if (attrNode != null) {
  -            return attrNode.getNodeValue();
  -        }
  -        else {
  -            return getScopedAttribute(node.getParentNode(), attr);
  -        }
  -    }
  -
  -    /**
  -     * Given a node, return the value of the given attribute.
  -     * Returns null if the attribute is not found
  -     */
  -    public static String getAttribute(Node node, String attr) {
  -        if (node == null || node.getAttributes() == null) {
  -            return null;
  -        }
  -
  -        Node attrNode = node.getAttributes().getNamedItem(attr);
  -        if (attrNode != null) {
  -            return attrNode.getNodeValue();
  -        }
  -        else {
  -            return null;
  -        }
  -    }
  -
  -    /**
  -     * Given a node, return the attributes that have the specified local name.
  -     * Returns null if the attribute is not found
  -     */
  -    public static Vector getAttributesWithLocalName(Node node, String localName) {
  -        Vector v = new Vector();
  -        if (node == null) {
  -            return v;
  -        }
  -
  -        NamedNodeMap map = node.getAttributes();
  -        if (map != null) {
  -            for (int i=0; i < map.getLength(); i++) {
  -                Node attrNode =  map.item(i);
  -                if (attrNode != null &&
  -                    attrNode.getLocalName().equals(localName)) {
  -                    v.add(attrNode);
  -                }
  -            }
  -        }
  -        return v;    
  -    }
  -
  -    /**
  -     * An xml element may have a name.
  -     * For example &lt.element name="foo" type="b:bar"&gt.
  -     * has the name "element".  This routine gets the full QName of the element.
  -     */
  -    public static QName getNodeQName(Node node) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        String localName = node.getLocalName();
  -        if (localName == null) {
  -            return null;
  -        }
  -        String namespace = node.getNamespaceURI();
  -
  -        return (new QName(namespace, localName));
  -    }
  -
  -    /**
  -     * XML nodes may have a name attribute.
  -     * For example &lt.element name="foo" type="b:bar"&gt.
  -     * has the name attribute value "foo".  This routine gets the QName of the name attribute value.
  -     */
  -    public static QName getNodeNameQName(Node node) {
  -        if (node == null) {
  -            return null;
  -        }
  -        String localName = null;
  -        String namespace = null;
  -
  -        // First try to get the name directly
  -        localName = getAttribute(node, "name");
  -        
  -        // If this fails and the node has a ref, use the ref name.
  -        if (localName == null) {
  -            QName ref = getNodeTypeRefQName(node, "ref");
  -            if (ref != null) {
  -                localName = ref.getLocalPart();
  -                namespace = ref.getNamespaceURI();
  -            }
  -        }
  -        
  -        // This routine may be called for complexType elements.  In some cases,
  -        // the complexType may be anonymous, which is why the getScopedAttribute
  -        // method is used.
  -        if (localName == null) {
  -            localName = "";
  -            Node search = node.getParentNode();
  -            while(search != null) {
  -                QName kind = getNodeQName(search);
  -                if (kind.getLocalPart().equals("schema")) {
  -                    search = null;
  -                } else if (kind.getLocalPart().equals("element") ||
  -                           kind.getLocalPart().equals("attribute")) {
  -                    localName = SymbolTable.ANON_TOKEN +
  -                        getNodeNameQName(search).getLocalPart();
  -                    search = search.getParentNode();
  -                } else if (kind.getLocalPart().equals("complexType") ||
  -                           kind.getLocalPart().equals("simpleType")) {
  -                    localName = getNodeNameQName(search).getLocalPart() + localName;
  -                    search = null;
  -                } else {
  -                    search = search.getParentNode();
  -                }
  -            }            
  -        }
  -        if (localName == null)
  -            return null;
  -
  -        // Build and return the QName
  -        if (namespace == null) {
  -            namespace = getScopedAttribute(node, "targetNamespace");
  -        }
  -        return (new QName(namespace, localName));
  -    }
  -
  -    /**
  -     * XML nodes may have a type/ref attribute.
  -     * For example &lt.element name="foo" type="b:bar"&gt.
  -     * has the type attribute value "b:bar". 
  -     * This routine gets the QName of the type/ref attribute value.
  -     *
  -     * Note: If the "minOccurs" and "maxOccurs" are set such that the 
  -     * type is a collection of "types", then an artificial qname is
  -     * returned to represent the collection.
  -     * 
  -     * If you want the QName for just the "type" without analyzing 
  -     * minOccurs/maxOccurs then use:
  -     *    getNodeTypeRefQName(node, "type")
  -     *
  -     * Note 2: The getNodeTypeRefQName routines also inspect the 
  -     *         "nillable" attribute and may return an alternate QName
  -     *         if nillable is true.  
  -     * 
  -     * @param node of the reference
  -     * @param forElement output parameter is set to true if QName is for an element
  -     *                   (i.e. ref= or element= attribute was used).
  -     * @param QName of type or element (depending on forElement setting)
  -     */
  -    public static QName getNodeTypeRefQName(Node node, BooleanHolder forElement) {
  -        if (node == null) return null;
  -        forElement.value = false; // Assume QName returned is for a type
  -
  -        // If the node has "type" and "maxOccurs" then the type is really
  -        // a collection.  There is no qname in the wsdl which we can use to represent
  -        // the collection, so we need to invent one.
  -        // The local part of the qname is changed to <local>[minOccurs, maxOccurs]
  -        // The namespace uri is changed to the targetNamespace of this node
  -        QName qName= getNodeTypeRefQName(node, "type");
  -        if (qName != null) {
  -            String maxOccursValue = getAttribute(node, "maxOccurs");
  -            String minOccursValue = getAttribute(node, "minOccurs");
  -            if (maxOccursValue == null) {
  -                maxOccursValue = "1";
  -            }
  -            if (minOccursValue == null) {
  -                minOccursValue = "1";
  -            }
  -            if (minOccursValue.equals("0") && maxOccursValue.equals("1")) {
  -                // If we have a minoccurs="0"/maxoccurs="1", this is just
  -                // like a nillable single value, so treat it as such.
  -                qName = getNillableQName(qName);
  -            } else if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
  -                String localPart = qName.getLocalPart();
  -//                localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
  -//                qName.setLocalPart(localPart);
  -//                String namespace = getScopedAttribute(node, "targetNamespace");
  -//                if (namespace != null)
  -//                    qName.setNamespaceURI(namespace);
  -                localPart += "[" + maxOccursValue + "]";
  -                qName.setLocalPart(localPart);
  -            }
  -        }
  -
  -        // Both "ref" and "element" reference elements
  -        if (qName == null) {
  -            forElement.value = true;
  -            qName = getNodeTypeRefQName(node, "ref");
  -        }
  -        // A WSDL Part uses the element attribute instead of the ref attribute
  -        if (qName == null) {
  -            forElement.value = true;
  -            qName = getNodeTypeRefQName(node, "element");
  -        }
  -
  -        // "base" references a "type"
  -        if (qName == null) {
  -            forElement.value = false;
  -            qName = getNodeTypeRefQName(node, "base");
  -        }
  -        return qName;
  -    }
  -
  -    /**
  -     * Obtain the QName of the type/ref using the indicated attribute name.
  -     * For example, the "type" attribute in an XML enumeration struct is the 
  -     * "base" attribute. 
  -     * If the "type" attribute is requested, the "nillable" attribute is 
  -     * also inspected to see if an alternate qname should be returned.
  -     *
  -     * @param node in the dom
  -     * @param typeAttrName (type, base, element, ref)
  -     */
  -    public static QName getNodeTypeRefQName(Node node, String typeAttrName) {
  -        if (node == null) {
  -            return null;
  -        }
  -        String prefixedName = getAttribute(node, typeAttrName);
  -
  -        // The type attribute defaults to xsd:anyType if there
  -        // are no other conflicting attributes and no anonymous type.
  -        if (prefixedName == null &&
  -            typeAttrName.equals("type")) {
  -            if (getAttribute(node, "ref") == null &&
  -                getAttribute(node, "base") == null && 
  -                getAttribute(node, "element") == null &&
  -                SchemaUtils.getElementAnonQName(node) == null &&
  -                SchemaUtils.getAttributeAnonQName(node) == null) {
  -                QName nodeName = getNodeQName(node);
  -                if (nodeName != null &&
  -                    Constants.isSchemaXSD(nodeName.getNamespaceURI()) &&
  -                    (nodeName.getLocalPart().equals("element") ||
  -                     nodeName.getLocalPart().equals("attribute"))) {
  -                    return getWSDLQName(Constants.XSD_ANYTYPE);
  -                }
  -            }              
  -        }
  -         
  -        // Return null if not found
  -        if (prefixedName == null) {
  -            return null;
  -        }
  -        // Change the prefixed name into a full qname
  -        QName qName = getQNameFromPrefixedName(node,prefixedName);
  -
  -        // An alternate qname is returned if nillable
  -        if (typeAttrName.equals("type")) {
  -            String nillable = getAttribute(node, "nillable");
  -            if (nillable != null && nillable.equalsIgnoreCase("true")) {
  -                qName = getNillableQName(qName);
  -            }
  -        }
  -        return qName;
  -    }
  -
  -    /**
  -     * Convert a prefixed name into a qname
  -     */
  -    public static QName getQNameFromPrefixedName(Node node, String prefixedName) {
  - 
  -        String localName = prefixedName.substring(prefixedName.lastIndexOf(":")+1);
  -        String namespace = null;
  -        // Associate the namespace prefix with a namespace
  -        if (prefixedName.length() == localName.length()) {
  -           namespace = getScopedAttribute(node, "xmlns");  // Get namespace for unqualified reference
  -        }
  -        else {
  -           namespace = getScopedAttribute(node, "xmlns:" + prefixedName.substring(0, prefixedName.lastIndexOf(":")));
  -        }
  -        return (new QName(namespace, localName));
  -    }
  -
  -    /**
  -     * This method returns a set of all types that are derived
  -     * from this type via an extension of a complexType
  -     */
  -    public static HashSet getDerivedTypes(TypeEntry type, SymbolTable symbolTable) {
  -        HashSet types = new HashSet();
  -        if (type != null && type.getNode() != null) {
  -            getDerivedTypes(type, types, symbolTable);
  -        } else if (Constants.isSchemaXSD(type.getQName().getNamespaceURI()) &&
  -                   type.getQName().getLocalPart().equals("anyType")) {
  -            // All types are derived from anyType
  -            types.addAll(symbolTable.getTypes());
  -        }
  -        return types;
  -    } // getNestedTypes
  -
  -    private static void getDerivedTypes(
  -            TypeEntry type, HashSet types, SymbolTable symbolTable) {
  -
  -        // If all types are in the set, return
  -        if (types.size() == symbolTable.getTypes().size()) {
  -            return;
  -        }
  -
  -        // Search the dictionary for derived types of type
  -        Vector allTypes = symbolTable.getTypes();
  -        Iterator it = allTypes.iterator();
  -        while(it.hasNext()) {
  -            TypeEntry derivedType = (TypeEntry) it.next();
  -            if (derivedType instanceof DefinedType &&
  -                derivedType.getNode() != null &&
  -                !types.contains(derivedType) &&
  -                SchemaUtils.getComplexElementExtensionBase(
  -                   derivedType.getNode(),
  -                   symbolTable) == type) {
  -                types.add(derivedType);
  -                getDerivedTypes(derivedType, types, symbolTable);
  -            }
  -        }
  -    } // getDerivedTypes
  -
  -    /**
  -     * This method returns a set of all the nested types.
  -     * Nested types are types declared within this TypeEntry (or descendents)
  -     * plus any extended types and the extended type nested types
  -     * The elements of the returned HashSet are Types.
  -     * @param type is the type entry to consider
  -     * @param symbolTable is the symbolTable
  -     * @param derivedFlag should be set if all dependendent derived types should also be 
  -     * returned.
  -     */
  -    public static HashSet getNestedTypes(TypeEntry type, SymbolTable symbolTable, 
  -                                         boolean derivedFlag) {
  -        HashSet types = new HashSet();
  -        getNestedTypes(type, types, symbolTable, derivedFlag);
  -        return types;
  -    } // getNestedTypes
  -
  -    private static void getNestedTypes(
  -            TypeEntry type, HashSet types, SymbolTable symbolTable, 
  -            boolean derivedFlag) {
  -
  -        if (type == null) {
  -            return;
  -        }
  -        
  -        // If all types are in the set, return
  -        if (types.size() == symbolTable.getTypes().size()) {
  -            return;
  -        }
  -        
  -        // Process types derived from this type
  -        if (derivedFlag) {
  -            HashSet derivedTypes = getDerivedTypes(type, symbolTable);
  -            Iterator it = derivedTypes.iterator();
  -            while(it.hasNext()) {
  -                TypeEntry derivedType = (TypeEntry) it.next();
  -                if (!types.contains(derivedType)) {
  -                    types.add(derivedType);
  -                    getNestedTypes(derivedType, types, symbolTable, derivedFlag);
  -                }
  -            }
  -        }
  -        
  -        // Continue only if the node exists
  -        if(type.getNode() == null) {
  -            return;
  -        }
  -        Node node = type.getNode();
  -
  -        // Process types declared in this type
  -        Vector v = SchemaUtils.getContainedElementDeclarations(node, symbolTable);
  -        if (v != null) {
  -            for (int i = 0; i < v.size(); i++) {
  -                ElementDecl elem = (ElementDecl)v.get(i);
  -                if (!types.contains(elem.getType())) {
  -                    types.add(elem.getType());
  -                    getNestedTypes(elem.getType(), 
  -                                   types, 
  -                                   symbolTable, derivedFlag);
  -                }
  -            }
  -        }
  -
  -        // Process attributes declared in this type
  -        v = SchemaUtils.getContainedAttributeTypes(node, symbolTable);
  -        if (v != null) {
  -            for (int i = 0; i < v.size(); i+=2) {
  -                if (!types.contains(v.get(i))) {
  -                    types.add(v.get(i));
  -                    getNestedTypes(
  -                            ((TypeEntry) v.get(i)), types, symbolTable, derivedFlag);
  -                }
  -            }
  -        }
  -        
  -        // Get the anonymous type of the element
  -        QName anonQName = SchemaUtils.getElementAnonQName(node);
  -        if (anonQName != null) {
  -            TypeEntry anonType = symbolTable.getType(anonQName);
  -            if (anonType != null && !types.contains(anonType)) {
  -                types.add(anonType);
  -            }
  -        }
  -
  -        // Get the anonymous type of an attribute
  -        anonQName = SchemaUtils.getAttributeAnonQName(node);
  -        if (anonQName != null) {
  -            TypeEntry anonType = symbolTable.getType(anonQName);
  -            if (anonType != null && !types.contains(anonType)) {
  -                types.add(anonType);
  -            }
  -        }
  -        // Process extended types
  -        TypeEntry extendType = SchemaUtils.getComplexElementExtensionBase(node, symbolTable);
  -        if (extendType != null) {
  -            if (!types.contains(extendType)) {
  -                types.add(extendType);
  -                getNestedTypes(extendType, types, symbolTable, derivedFlag);
  -            }
  -        }
  -
  -        // Process array element types
  -        QName elementQName = SchemaUtils.getArrayElementQName(node, new IntHolder(0));
  -        TypeEntry elementType = symbolTable.getType(elementQName);
  -        if (elementType != null) {
  -            if (!types.contains(elementType)) {
  -                types.add(elementType);
  -                getNestedTypes(elementType, types, symbolTable, derivedFlag);
  -            }
  -        }
  -    } // getNestedTypes
  -
  -    /**
  -     * Common code for generating a QName in emitted code.  Note that there's
  -     * no semicolon at the end, so we can use this in a variety of contexts.
  -     */ 
  -    public static String getNewQName(javax.xml.rpc.namespace.QName qname)
  -    {
  -        return "new javax.xml.rpc.namespace.QName(\"" +
  -                qname.getNamespaceURI() + "\", \"" +
  -                qname.getLocalPart() + "\")";
  -    }
  -    
  -    public static javax.xml.rpc.namespace.QName getAxisQName(QName qname)
  -    {
  -        if (qname == null) {
  -            return null;
  -        }
  -        return new javax.xml.rpc.namespace.QName(qname.getNamespaceURI(),
  -                                                 qname.getLocalPart());
  -    }
  -    
  -    public static QName getWSDLQName(javax.xml.rpc.namespace.QName qname)
  -    {
  -        if (qname == null) {
  -            return null;
  -        }
  -        return new QName(qname.getNamespaceURI(), qname.getLocalPart());
  -    }
  -    
  -    /**
  -     * Generate an XML prefixed attribute value with a corresponding xmlns 
  -     * declaration for the prefix.  If there is no namespace, 
  -     * don't prefix the name or emit the xmlns attribute.
  -     * 
  -     * Caller should provide the enclosing quotes.
  -     * 
  -     * Usage:  println("name=\"" + genXMLQNameString(qname, "foo") + "\""
  -     */ 
  -    public static String genQNameAttributeString(QName qname, String prefix) {
  -        if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals(""))
  -            return qname.getLocalPart();
  -        
  -        return prefix + ":" + qname.getLocalPart() + "\" xmlns:" + prefix +
  -                "=\"" + qname.getNamespaceURI();
  -    }
  -}
  -
  -
  -
  -
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.wsdl.symbolTable;
  +
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.Vector;
  +
  +import javax.wsdl.QName;
  +
  +import javax.xml.rpc.holders.BooleanHolder;
  +import javax.xml.rpc.holders.IntHolder;
  +
  +import org.apache.axis.Constants;
  +
  +import org.w3c.dom.NamedNodeMap;
  +
  +import org.w3c.dom.Node;
  +
  +/**
  + * This class contains static utility methods for the emitter.
  + *
  + * @author Rich Scheuerle  (scheu@us.ibm.com)
  + * @author Tom Jordahl (tomj@macromedia.com)
  + */
  +public class Utils {
  +
  +    /**
  +     * getNillableQName returns the QName to use if the nillable=true
  +     * attribute is used.                             
  +     * For example, in JAX-RPC:
  +     *   The QName "xsd:int" maps to a java int.
  +     *   However if an element with a type="xsd:int" also has the 
  +     *   "nillable=true" attribute, the type should be an Integer (not an int).
  +     *   So in these circumstances, this routine is called with xsd:int to 
  +     *   get a suitable qname (soapenc:int) which maps to Integer.
  +     * @param QName
  +     */
  +    public static QName getNillableQName(QName qName) {
  +        QName rc = new QName(qName.getNamespaceURI(), qName.getLocalPart());
  +        if (Constants.isSchemaXSD(rc.getNamespaceURI())) {
  +            String localName = rc.getLocalPart();
  +            if (localName.equals("int") ||
  +                localName.equals("long") ||
  +                localName.equals("short") ||
  +                localName.equals("float") ||
  +                localName.equals("double") ||
  +                localName.equals("boolean") ||
  +                localName.equals("byte")) {
  +                rc.setNamespaceURI(Constants.NS_URI_CURRENT_SOAP_ENC);
  +            }
  +            else if (localName.equals("base64Binary") ||
  +                     localName.equals("hexBinary")) {
  +                rc.setNamespaceURI(Constants.NS_URI_CURRENT_SOAP_ENC);
  +                rc.setLocalPart("base64");
  +            }
  +        }
  +       return rc;
  +    }
  +    /**
  +     * Given a node, return the value of the given attribute.
  +     * If the attribute does not exist, searching continues through ancestor nodes until found.
  +     * This method is useful for finding attributes that pertain to a group of contained
  +     * nodes (i.e. xlmns, xmlns:tns, targetNamespace, name)
  +     */
  +    public static String getScopedAttribute(Node node, String attr) {
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        if (node.getAttributes() == null)
  +            return getScopedAttribute(node.getParentNode(), attr);
  +
  +        Node attrNode = node.getAttributes().getNamedItem(attr);
  +        if (attrNode != null) {
  +            return attrNode.getNodeValue();
  +        }
  +        else {
  +            return getScopedAttribute(node.getParentNode(), attr);
  +        }
  +    }
  +
  +    /**
  +     * Given a node, return the value of the given attribute.
  +     * Returns null if the attribute is not found
  +     */
  +    public static String getAttribute(Node node, String attr) {
  +        if (node == null || node.getAttributes() == null) {
  +            return null;
  +        }
  +
  +        Node attrNode = node.getAttributes().getNamedItem(attr);
  +        if (attrNode != null) {
  +            return attrNode.getNodeValue();
  +        }
  +        else {
  +            return null;
  +        }
  +    }
  +
  +    /**
  +     * Given a node, return the attributes that have the specified local name.
  +     * Returns null if the attribute is not found
  +     */
  +    public static Vector getAttributesWithLocalName(Node node, String localName) {
  +        Vector v = new Vector();
  +        if (node == null) {
  +            return v;
  +        }
  +
  +        NamedNodeMap map = node.getAttributes();
  +        if (map != null) {
  +            for (int i=0; i < map.getLength(); i++) {
  +                Node attrNode =  map.item(i);
  +                if (attrNode != null &&
  +                    attrNode.getLocalName().equals(localName)) {
  +                    v.add(attrNode);
  +                }
  +            }
  +        }
  +        return v;    
  +    }
  +
  +    /**
  +     * An xml element may have a name.
  +     * For example &lt.element name="foo" type="b:bar"&gt.
  +     * has the name "element".  This routine gets the full QName of the element.
  +     */
  +    public static QName getNodeQName(Node node) {
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        String localName = node.getLocalName();
  +        if (localName == null) {
  +            return null;
  +        }
  +        String namespace = node.getNamespaceURI();
  +
  +        return (new QName(namespace, localName));
  +    }
  +
  +    /**
  +     * XML nodes may have a name attribute.
  +     * For example &lt.element name="foo" type="b:bar"&gt.
  +     * has the name attribute value "foo".  This routine gets the QName of the name attribute value.
  +     */
  +    public static QName getNodeNameQName(Node node) {
  +        if (node == null) {
  +            return null;
  +        }
  +        String localName = null;
  +        String namespace = null;
  +
  +        // First try to get the name directly
  +        localName = getAttribute(node, "name");
  +        
  +        // If this fails and the node has a ref, use the ref name.
  +        if (localName == null) {
  +            QName ref = getNodeTypeRefQName(node, "ref");
  +            if (ref != null) {
  +                localName = ref.getLocalPart();
  +                namespace = ref.getNamespaceURI();
  +            }
  +        }
  +        
  +        // This routine may be called for complexType elements.  In some cases,
  +        // the complexType may be anonymous, which is why the getScopedAttribute
  +        // method is used.
  +        if (localName == null) {
  +            localName = "";
  +            Node search = node.getParentNode();
  +            while(search != null) {
  +                QName kind = getNodeQName(search);
  +                if (kind.getLocalPart().equals("schema")) {
  +                    search = null;
  +                } else if (kind.getLocalPart().equals("element") ||
  +                           kind.getLocalPart().equals("attribute")) {
  +                    localName = SymbolTable.ANON_TOKEN +
  +                        getNodeNameQName(search).getLocalPart();
  +                    search = search.getParentNode();
  +                } else if (kind.getLocalPart().equals("complexType") ||
  +                           kind.getLocalPart().equals("simpleType")) {
  +                    localName = getNodeNameQName(search).getLocalPart() + localName;
  +                    search = null;
  +                } else {
  +                    search = search.getParentNode();
  +                }
  +            }            
  +        }
  +        if (localName == null)
  +            return null;
  +
  +        // Build and return the QName
  +        if (namespace == null) {
  +            namespace = getScopedAttribute(node, "targetNamespace");
  +        }
  +        return (new QName(namespace, localName));
  +    }
  +
  +    /**
  +     * XML nodes may have a type/ref attribute.
  +     * For example &lt.element name="foo" type="b:bar"&gt.
  +     * has the type attribute value "b:bar". 
  +     * This routine gets the QName of the type/ref attribute value.
  +     *
  +     * Note: If the "minOccurs" and "maxOccurs" are set such that the 
  +     * type is a collection of "types", then an artificial qname is
  +     * returned to represent the collection.
  +     * 
  +     * If you want the QName for just the "type" without analyzing 
  +     * minOccurs/maxOccurs then use:
  +     *    getNodeTypeRefQName(node, "type")
  +     *
  +     * Note 2: The getNodeTypeRefQName routines also inspect the 
  +     *         "nillable" attribute and may return an alternate QName
  +     *         if nillable is true.  
  +     * 
  +     * @param node of the reference
  +     * @param forElement output parameter is set to true if QName is for an element
  +     *                   (i.e. ref= or element= attribute was used).
  +     * @param QName of type or element (depending on forElement setting)
  +     */
  +    public static QName getNodeTypeRefQName(Node node, BooleanHolder forElement) {
  +        if (node == null) return null;
  +        forElement.value = false; // Assume QName returned is for a type
  +
  +        // If the node has "type" and "maxOccurs" then the type is really
  +        // a collection.  There is no qname in the wsdl which we can use to represent
  +        // the collection, so we need to invent one.
  +        // The local part of the qname is changed to <local>[minOccurs, maxOccurs]
  +        // The namespace uri is changed to the targetNamespace of this node
  +        QName qName= getNodeTypeRefQName(node, "type");
  +        if (qName != null) {
  +            String maxOccursValue = getAttribute(node, "maxOccurs");
  +            String minOccursValue = getAttribute(node, "minOccurs");
  +            if (maxOccursValue == null) {
  +                maxOccursValue = "1";
  +            }
  +            if (minOccursValue == null) {
  +                minOccursValue = "1";
  +            }
  +            if (minOccursValue.equals("0") && maxOccursValue.equals("1")) {
  +                // If we have a minoccurs="0"/maxoccurs="1", this is just
  +                // like a nillable single value, so treat it as such.
  +                qName = getNillableQName(qName);
  +            } else if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
  +                String localPart = qName.getLocalPart();
  +//                localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
  +//                qName.setLocalPart(localPart);
  +//                String namespace = getScopedAttribute(node, "targetNamespace");
  +//                if (namespace != null)
  +//                    qName.setNamespaceURI(namespace);
  +                localPart += "[" + maxOccursValue + "]";
  +                qName.setLocalPart(localPart);
  +            }
  +        }
  +
  +        // Both "ref" and "element" reference elements
  +        if (qName == null) {
  +            forElement.value = true;
  +            qName = getNodeTypeRefQName(node, "ref");
  +        }
  +        // A WSDL Part uses the element attribute instead of the ref attribute
  +        if (qName == null) {
  +            forElement.value = true;
  +            qName = getNodeTypeRefQName(node, "element");
  +        }
  +
  +        // "base" references a "type"
  +        if (qName == null) {
  +            forElement.value = false;
  +            qName = getNodeTypeRefQName(node, "base");
  +        }
  +        return qName;
  +    }
  +
  +    /**
  +     * Obtain the QName of the type/ref using the indicated attribute name.
  +     * For example, the "type" attribute in an XML enumeration struct is the 
  +     * "base" attribute. 
  +     * If the "type" attribute is requested, the "nillable" attribute is 
  +     * also inspected to see if an alternate qname should be returned.
  +     *
  +     * @param node in the dom
  +     * @param typeAttrName (type, base, element, ref)
  +     */
  +    public static QName getNodeTypeRefQName(Node node, String typeAttrName) {
  +        if (node == null) {
  +            return null;
  +        }
  +        String prefixedName = getAttribute(node, typeAttrName);
  +
  +        // The type attribute defaults to xsd:anyType if there
  +        // are no other conflicting attributes and no anonymous type.
  +        if (prefixedName == null &&
  +            typeAttrName.equals("type")) {
  +            if (getAttribute(node, "ref") == null &&
  +                getAttribute(node, "base") == null && 
  +                getAttribute(node, "element") == null &&
  +                SchemaUtils.getElementAnonQName(node) == null &&
  +                SchemaUtils.getAttributeAnonQName(node) == null) {
  +                QName nodeName = getNodeQName(node);
  +                if (nodeName != null &&
  +                    Constants.isSchemaXSD(nodeName.getNamespaceURI()) &&
  +                    (nodeName.getLocalPart().equals("element") ||
  +                     nodeName.getLocalPart().equals("attribute"))) {
  +                    return getWSDLQName(Constants.XSD_ANYTYPE);
  +                }
  +            }              
  +        }
  +         
  +        // Return null if not found
  +        if (prefixedName == null) {
  +            return null;
  +        }
  +        // Change the prefixed name into a full qname
  +        QName qName = getQNameFromPrefixedName(node,prefixedName);
  +
  +        // An alternate qname is returned if nillable
  +        if (typeAttrName.equals("type")) {
  +            String nillable = getAttribute(node, "nillable");
  +            if (nillable != null && nillable.equalsIgnoreCase("true")) {
  +                qName = getNillableQName(qName);
  +            }
  +        }
  +        return qName;
  +    }
  +
  +    /**
  +     * Convert a prefixed name into a qname
  +     */
  +    public static QName getQNameFromPrefixedName(Node node, String prefixedName) {
  + 
  +        String localName = prefixedName.substring(prefixedName.lastIndexOf(":")+1);
  +        String namespace = null;
  +        // Associate the namespace prefix with a namespace
  +        if (prefixedName.length() == localName.length()) {
  +           namespace = getScopedAttribute(node, "xmlns");  // Get namespace for unqualified reference
  +        }
  +        else {
  +           namespace = getScopedAttribute(node, "xmlns:" + prefixedName.substring(0, prefixedName.lastIndexOf(":")));
  +        }
  +        return (new QName(namespace, localName));
  +    }
  +
  +    /**
  +     * This method returns a set of all types that are derived
  +     * from this type via an extension of a complexType
  +     */
  +    public static HashSet getDerivedTypes(TypeEntry type, SymbolTable symbolTable) {
  +        HashSet types = new HashSet();
  +        if (type != null && type.getNode() != null) {
  +            getDerivedTypes(type, types, symbolTable);
  +        } else if (Constants.isSchemaXSD(type.getQName().getNamespaceURI()) &&
  +                   type.getQName().getLocalPart().equals("anyType")) {
  +            // All types are derived from anyType
  +            types.addAll(symbolTable.getTypes());
  +        }
  +        return types;
  +    } // getNestedTypes
  +
  +    private static void getDerivedTypes(
  +            TypeEntry type, HashSet types, SymbolTable symbolTable) {
  +
  +        // If all types are in the set, return
  +        if (types.size() == symbolTable.getTypes().size()) {
  +            return;
  +        }
  +
  +        // Search the dictionary for derived types of type
  +        Vector allTypes = symbolTable.getTypes();
  +        Iterator it = allTypes.iterator();
  +        while(it.hasNext()) {
  +            TypeEntry derivedType = (TypeEntry) it.next();
  +            if (derivedType instanceof DefinedType &&
  +                derivedType.getNode() != null &&
  +                !types.contains(derivedType) &&
  +                SchemaUtils.getComplexElementExtensionBase(
  +                   derivedType.getNode(),
  +                   symbolTable) == type) {
  +                types.add(derivedType);
  +                getDerivedTypes(derivedType, types, symbolTable);
  +            }
  +        }
  +    } // getDerivedTypes
  +
  +    /**
  +     * This method returns a set of all the nested types.
  +     * Nested types are types declared within this TypeEntry (or descendents)
  +     * plus any extended types and the extended type nested types
  +     * The elements of the returned HashSet are Types.
  +     * @param type is the type entry to consider
  +     * @param symbolTable is the symbolTable
  +     * @param derivedFlag should be set if all dependendent derived types should also be 
  +     * returned.
  +     */
  +    public static HashSet getNestedTypes(TypeEntry type, SymbolTable symbolTable, 
  +                                         boolean derivedFlag) {
  +        HashSet types = new HashSet();
  +        getNestedTypes(type, types, symbolTable, derivedFlag);
  +        return types;
  +    } // getNestedTypes
  +
  +    private static void getNestedTypes(
  +            TypeEntry type, HashSet types, SymbolTable symbolTable, 
  +            boolean derivedFlag) {
  +
  +        if (type == null) {
  +            return;
  +        }
  +        
  +        // If all types are in the set, return
  +        if (types.size() == symbolTable.getTypes().size()) {
  +            return;
  +        }
  +        
  +        // Process types derived from this type
  +        if (derivedFlag) {
  +            HashSet derivedTypes = getDerivedTypes(type, symbolTable);
  +            Iterator it = derivedTypes.iterator();
  +            while(it.hasNext()) {
  +                TypeEntry derivedType = (TypeEntry) it.next();
  +                if (!types.contains(derivedType)) {
  +                    types.add(derivedType);
  +                    getNestedTypes(derivedType, types, symbolTable, derivedFlag);
  +                }
  +            }
  +        }
  +        
  +        // Continue only if the node exists
  +        if(type.getNode() == null) {
  +            return;
  +        }
  +        Node node = type.getNode();
  +
  +        // Process types declared in this type
  +        Vector v = SchemaUtils.getContainedElementDeclarations(node, symbolTable);
  +        if (v != null) {
  +            for (int i = 0; i < v.size(); i++) {
  +                ElementDecl elem = (ElementDecl)v.get(i);
  +                if (!types.contains(elem.getType())) {
  +                    types.add(elem.getType());
  +                    getNestedTypes(elem.getType(), 
  +                                   types, 
  +                                   symbolTable, derivedFlag);
  +                }
  +            }
  +        }
  +
  +        // Process attributes declared in this type
  +        v = SchemaUtils.getContainedAttributeTypes(node, symbolTable);
  +        if (v != null) {
  +            for (int i = 0; i < v.size(); i+=2) {
  +                if (!types.contains(v.get(i))) {
  +                    types.add(v.get(i));
  +                    getNestedTypes(
  +                            ((TypeEntry) v.get(i)), types, symbolTable, derivedFlag);
  +                }
  +            }
  +        }
  +        
  +        // Get the anonymous type of the element
  +        QName anonQName = SchemaUtils.getElementAnonQName(node);
  +        if (anonQName != null) {
  +            TypeEntry anonType = symbolTable.getType(anonQName);
  +            if (anonType != null && !types.contains(anonType)) {
  +                types.add(anonType);
  +            }
  +        }
  +
  +        // Get the anonymous type of an attribute
  +        anonQName = SchemaUtils.getAttributeAnonQName(node);
  +        if (anonQName != null) {
  +            TypeEntry anonType = symbolTable.getType(anonQName);
  +            if (anonType != null && !types.contains(anonType)) {
  +                types.add(anonType);
  +            }
  +        }
  +        // Process extended types
  +        TypeEntry extendType = SchemaUtils.getComplexElementExtensionBase(node, symbolTable);
  +        if (extendType != null) {
  +            if (!types.contains(extendType)) {
  +                types.add(extendType);
  +                getNestedTypes(extendType, types, symbolTable, derivedFlag);
  +            }
  +        }
  +
  +        // Process array element types
  +        QName elementQName = SchemaUtils.getArrayElementQName(node, new IntHolder(0));
  +        TypeEntry elementType = symbolTable.getType(elementQName);
  +        if (elementType != null) {
  +            if (!types.contains(elementType)) {
  +                types.add(elementType);
  +                getNestedTypes(elementType, types, symbolTable, derivedFlag);
  +            }
  +        }
  +    } // getNestedTypes
  +
  +    /**
  +     * Common code for generating a QName in emitted code.  Note that there's
  +     * no semicolon at the end, so we can use this in a variety of contexts.
  +     */ 
  +    public static String getNewQName(javax.xml.rpc.namespace.QName qname)
  +    {
  +        return "new javax.xml.rpc.namespace.QName(\"" +
  +                qname.getNamespaceURI() + "\", \"" +
  +                qname.getLocalPart() + "\")";
  +    }
  +    
  +    public static javax.xml.rpc.namespace.QName getAxisQName(QName qname)
  +    {
  +        if (qname == null) {
  +            return null;
  +        }
  +        return new javax.xml.rpc.namespace.QName(qname.getNamespaceURI(),
  +                                                 qname.getLocalPart());
  +    }
  +    
  +    public static QName getWSDLQName(javax.xml.rpc.namespace.QName qname)
  +    {
  +        if (qname == null) {
  +            return null;
  +        }
  +        return new QName(qname.getNamespaceURI(), qname.getLocalPart());
  +    }
  +    
  +    /**
  +     * Generate an XML prefixed attribute value with a corresponding xmlns 
  +     * declaration for the prefix.  If there is no namespace, 
  +     * don't prefix the name or emit the xmlns attribute.
  +     * 
  +     * Caller should provide the enclosing quotes.
  +     * 
  +     * Usage:  println("name=\"" + genXMLQNameString(qname, "foo") + "\""
  +     */ 
  +    public static String genQNameAttributeString(QName qname, String prefix) {
  +        if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals(""))
  +            return qname.getLocalPart();
  +        
  +        return prefix + ":" + qname.getLocalPart() + "\" xmlns:" + prefix +
  +                "=\"" + qname.getNamespaceURI();
  +    }
  +}
  +
  
  
  
  1.34      +449 -449  xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Utils.java	30 May 2002 03:06:13 -0000	1.33
  +++ Utils.java	30 May 2002 23:46:02 -0000	1.34
  @@ -1,449 +1,449 @@
  -/*
  - * 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/>.
  - */
  -package org.apache.axis.wsdl.toJava;
  -
  -import java.io.File;
  -import java.io.IOException;
  -
  -import java.net.MalformedURLException;
  -import java.net.URL;
  -
  -import java.util.HashMap;
  -import java.util.StringTokenizer;
  -import java.util.Vector;
  -
  -import javax.wsdl.Fault;
  -import javax.wsdl.Message;
  -import javax.wsdl.QName;
  -
  -import org.apache.axis.Constants;
  -
  -import org.apache.axis.utils.JavaUtils;
  -
  -import org.apache.axis.wsdl.symbolTable.SymbolTable;
  -import org.apache.axis.wsdl.symbolTable.TypeEntry;
  -import org.apache.axis.wsdl.symbolTable.MessageEntry;
  -
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  -
  -public class Utils extends org.apache.axis.wsdl.symbolTable.Utils {
  -    /**
  -     * Given a type, return the Java mapping of that type's holder.
  -     */
  -    public static String holder(TypeEntry type, Emitter emitter) {
  -        String typeValue = type.getName();
  -
  -        // byte[] has a reserved holders
  -        if (typeValue.equals("byte[]")) {
  -            return "javax.xml.rpc.holders.ByteArrayHolder";
  -        }
  -        // Anything else with [] gets its holder from the qname
  -        else if (typeValue.endsWith("[]")) {
  -            String name = emitter.getJavaName(type.getQName());
  -            // This could be a special QName for a indexed property.
  -            // If so, change the [] to Array.
  -            name = JavaUtils.replace(name, "[]", "Array");
  -            return name + "Holder";
  -        }
  -        // String also has a reserved holder
  -        else if (typeValue.equals("String")) {
  -            return "javax.xml.rpc.holders.StringHolder";
  -        }
  -        else if (typeValue.equals("java.lang.String")) {
  -            return "javax.xml.rpc.holders.StringHolder";
  -        }
  -        // Object also has a reserved holder
  -        else if (typeValue.equals("Object")) {
  -            return "javax.xml.rpc.holders.ObjectHolder";
  -        }
  -        else if (typeValue.equals("java.lang.Object")) {
  -            return "javax.xml.rpc.holders.ObjectHolder";
  -        }
  -        // Java primitive types have reserved holders
  -        else if (typeValue.equals("int")
  -                 || typeValue.equals("long")
  -                 || typeValue.equals("short")
  -                 || typeValue.equals("float")
  -                 || typeValue.equals("double")
  -                 || typeValue.equals("boolean")
  -                 || typeValue.equals("byte")) {
  -            return "javax.xml.rpc.holders." + capitalizeFirstChar(typeValue) + "Holder";
  -        }
  -        // Java language classes have reserved holders (with ClassHolder)
  -        else if (typeValue.startsWith("java.lang.")) {
  -            return "javax.xml.rpc.holders" + 
  -                typeValue.substring(typeValue.lastIndexOf(".")) +
  -                "WrapperHolder";
  -        }
  -        else if (typeValue.indexOf(".") < 0) {
  -            return "javax.xml.rpc.holders" + 
  -                typeValue +
  -                "WrapperHolder";
  -        }
  -        // The classes have reserved holders because they 
  -        // represent schema/soap encoding primitives
  -        else if (typeValue.equals("java.math.BigDecimal")) {
  -            return "javax.xml.rpc.holders.BigDecimalHolder";
  -        }
  -        else if (typeValue.equals("java.math.BigInteger")) {
  -            return "javax.xml.rpc.holders.BigIntegerHolder";
  -        }
  -        else if  (typeValue.equals("java.util.Date")) {
  -            return "javax.xml.rpc.holders.DateHolder";
  -        }
  -        else if (typeValue.equals("java.util.Calendar")) {
  -            return "javax.xml.rpc.holders.CalendarHolder";
  -        }
  -        else if (typeValue.equals("javax.xml.rpc.namespace.QName")) {
  -            return "javax.xml.rpc.holders.QNameHolder";
  -        }
  -        // For everything else simply append Holder
  -        else
  -            return typeValue + "Holder";
  -    } // holder
  -
  -    /**
  -     * Given a fault, return the fully qualified Java class name
  -     * of the exception to be generated from this fault
  -     * 
  -     * @param fault - The WSDL fault object
  -     * @param symbolTable - the symbol table
  -     * @return A Java class name for the fault
  -     */ 
  -    public static String getFullExceptionName(
  -            Fault fault, Emitter emitter) {
  -
  -        // Get the Message referenced in the message attribute of the
  -        // fault.
  -        Message faultMessage = fault.getMessage();
  -        MessageEntry me = emitter.getSymbolTable().getMessageEntry(
  -            faultMessage.getQName()); 
  -        return (String) me.getDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME);
  -    } // getFullExceptionName
  -
  -    /**
  -     * If the specified node represents a supported JAX-RPC enumeration,
  -     * a Vector is returned which contains the base type and the enumeration values.
  -     * The first element in the vector is the base type (an TypeEntry).
  -     * Subsequent elements are values (Strings).
  -     * If this is not an enumeration, null is returned.
  -     */
  -    public static Vector getEnumerationBaseAndValues(Node node, SymbolTable symbolTable) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        // If the node kind is an element, dive into it.
  -        QName nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("element") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -            NodeList children = node.getChildNodes();
  -            Node simpleNode = null;
  -            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
  -                QName simpleKind = Utils.getNodeQName(children.item(j));
  -                if (simpleKind != null &&
  -                    simpleKind.getLocalPart().equals("simpleType") &&
  -                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
  -                    simpleNode = children.item(j);
  -                    node = simpleNode;
  -                }
  -            }
  -        }
  -        // Get the node kind, expecting a schema simpleType
  -        nodeKind = Utils.getNodeQName(node);
  -        if (nodeKind != null &&
  -            nodeKind.getLocalPart().equals("simpleType") &&
  -            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  -
  -            // Under the simpleType there should be a restriction.
  -            // (There may be other #text nodes, which we will ignore).
  -            NodeList children = node.getChildNodes();
  -            Node restrictionNode = null;
  -            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  -                QName restrictionKind = Utils.getNodeQName(children.item(j));
  -                if (restrictionKind != null &&
  -                    restrictionKind.getLocalPart().equals("restriction") &&
  -                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  -                    restrictionNode = children.item(j);
  -            }
  -
  -            // The restriction node indicates the type being restricted
  -            // (the base attribute contains this type).
  -            // The base type must be a built-in type, and not boolean
  -            TypeEntry baseEType = null;
  -            if (restrictionNode != null) {
  -                QName baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
  -                baseEType = symbolTable.getType(baseType);
  -                if (baseEType != null) {
  -                    String javaName = baseEType.getName();
  -                    if (javaName.equals("java.lang.String") ||
  -                        javaName.equals("int") ||
  -                        javaName.equals("long") ||
  -                        javaName.equals("short") ||
  -                        javaName.equals("float") ||
  -                        javaName.equals("double") ||
  -                        javaName.equals("byte"))
  -                        ; // Okay Type
  -                    else
  -                        baseEType = null;
  -                }
  -            }
  -
  -            // Process the enumeration elements underneath the restriction node
  -            if (baseEType != null && restrictionNode != null) {
  -
  -                Vector v = new Vector();                
  -                NodeList enums = restrictionNode.getChildNodes();
  -                for (int i=0; i < enums.getLength(); i++) {
  -                    QName enumKind = Utils.getNodeQName(enums.item(i));
  -                    if (enumKind != null &&
  -                        enumKind.getLocalPart().equals("enumeration") &&
  -                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
  -
  -                        // Put the enum value in the vector.
  -                        Node enumNode = enums.item(i);
  -                        String value = Utils.getAttribute(enumNode, "value");
  -                        if (value != null) {
  -                            v.add(value);
  -                        }
  -                    }
  -                }
  -                
  -                // is this really an enumeration?
  -                if(v.isEmpty()) return null;
  -                
  -                // The first element in the vector is the base type (an TypeEntry).
  -                v.add(0,baseEType);
  -                return v;
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Capitalize the first character of the name.
  -     */
  -    public static String capitalizeFirstChar(String name) {
  -        if (name == null || name.equals(""))
  -            return name;
  -        
  -        char start = name.charAt(0);
  -
  -        if (Character.isLowerCase(start)) {
  -            start = Character.toUpperCase(start);
  -            return start + name.substring(1);
  -        }
  -        return name;
  -    } // capitalizeFirstChar
  -
  -    /**
  -     * Map an XML name to a valid Java identifier
  -     */
  -    public static String xmlNameToJava(String name)
  -    {
  -        // NOTE:  This method should really go away and all callers should call
  -        // JavaUtils.xmlNameToJava directly.  But there are a lot of them and I wanted
  -        // to keep the changes to a minimum.  Besides, these are static methods so the should
  -        // be inlined.
  -        return JavaUtils.xmlNameToJava(name);
  -    }
  -
  -    /**
  -     * Map an XML name to a valid Java identifier w/ capitolized first letter 
  -     */ 
  -    public static String xmlNameToJavaClass(String name)
  -    {
  -        return capitalizeFirstChar(xmlNameToJava(name));
  -    }
  -
  -    public static String makePackageName(String namespace)
  -    {
  -        String hostname = null;
  -
  -        // get the target namespace of the document
  -        try {
  -            hostname = new URL(namespace).getHost();
  -        }
  -        catch (MalformedURLException e) {
  -            if (namespace.indexOf(":") > -1) {
  -                hostname = namespace.substring(namespace.indexOf(":") + 1);
  -                if (hostname.indexOf("/") > -1)
  -                    hostname = hostname.substring(0, hostname.indexOf("/") );
  -            }
  -            else {
  -                hostname = namespace;
  -            }
  -        }
  -
  -        // if we didn't file a hostname, bail
  -        if (hostname == null) {
  -            return null;
  -        }
  -
  -        //convert illegal java identifier
  -        hostname = hostname.replace('-', '_');
  -
  -        // tokenize the hostname and reverse it
  -        StringTokenizer st = new StringTokenizer( hostname, "." );
  -        String[] words = new String[ st.countTokens() ];
  -        for(int i = 0; i < words.length; ++i)
  -            words[i] = st.nextToken();
  -
  -        StringBuffer sb = new StringBuffer(80);
  -        for(int i = words.length-1; i >= 0; --i) {
  -            String word = words[i];
  -            if (JavaUtils.isJavaKeyword(word)) {
  -                word = JavaUtils.makeNonJavaKeyword(word);
  -            }
  -            // seperate with dot
  -            if( i != words.length-1 )
  -                sb.append('.');
  -
  -            // convert digits to underscores
  -            if( Character.isDigit(word.charAt(0)) )
  -                sb.append('_');
  -            sb.append( word );
  -        }
  -        return sb.toString();
  -    }
  -
  -    /**
  -     * Query Java Local Name
  -     */
  -    public static String getJavaLocalName(String fullName) {
  -        return fullName.substring(fullName.lastIndexOf('.') + 1);
  -    } // getJavaLocalName
  -
  -    /**
  -     * Query Java Package Name
  -     */
  -    public static String getJavaPackageName(String fullName) {
  -        if (fullName.lastIndexOf('.') > 0) {
  -            return fullName.substring(0, fullName.lastIndexOf('.'));
  -        }
  -        else {
  -            return "";
  -        }
  -    } // getJavaPackageName
  -
  -    /**
  -     * Does the given file already exist in the given namespace?
  -     */
  -    public static boolean fileExists(String name, String namespace,
  -            Namespaces namespaces) throws IOException
  -    {
  -        String packageName = namespaces.getAsDir(namespace);
  -        String fullName = packageName + name;
  -        return new File (fullName).exists();
  -    } // fileExists
  -
  -    /**
  -     * A simple map of the primitive types and their holder objects
  -     */
  -    private static HashMap TYPES = new HashMap(7);
  -
  -    static {
  -        TYPES.put("int", "Integer");
  -        TYPES.put("float", "Float");
  -        TYPES.put("boolean", "Boolean");
  -        TYPES.put("double", "Double");
  -        TYPES.put("byte", "Byte");
  -        TYPES.put("short", "Short");
  -        TYPES.put("long", "Long");
  -    }
  -
  -    /**
  -     * Return a string with "var" wrapped as an Object type if needed
  -     */
  -    public static String wrapPrimitiveType(TypeEntry type, String var) {
  -        String objType = type == null ? null : (String) TYPES.get(type.getName());
  -        if (objType != null) {
  -            return "new " + objType + "(" + var + ")";
  -        } else if (type != null && 
  -                   type.getName().equals("byte[]") &&
  -                   type.getQName().getLocalPart().equals("hexBinary")) {
  -            // Need to wrap byte[] in special Hex object to get the correct serialization
  -            return "new org.apache.axis.encoding.Hex(" + var + ")";
  -        } else {
  -            return var;
  -        }
  -    } // wrapPrimitiveType
  -
  -    /**
  -     * Return the Object variable 'var' cast to the appropriate type
  -     * doing the right thing for the primitive types.
  -     */
  -    public static String getResponseString(TypeEntry type, String var) {
  -        if (type == null) {
  -            return ";";
  -        }
  -        else {
  -            String objType = (String) TYPES.get(type.getName());
  -            if (objType != null) {
  -                return "((" + objType + ") " + var + ")." + type.getName() + "Value();";
  -            }
  -            else {
  -                return "(" + type.getName() + ") " + var + ";";
  -            }
  -        }
  -    } // getResponseString
  -
  -    public static boolean isPrimitiveType(TypeEntry type) {
  -        return TYPES.get(type.getName()) != null;
  -    } // isPrimitiveType
  -
  -} // class Utils
  +/*
  + * 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/>.
  + */
  +package org.apache.axis.wsdl.toJava;
  +
  +import java.io.File;
  +import java.io.IOException;
  +
  +import java.net.MalformedURLException;
  +import java.net.URL;
  +
  +import java.util.HashMap;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
  +
  +import javax.wsdl.Fault;
  +import javax.wsdl.Message;
  +import javax.wsdl.QName;
  +
  +import org.apache.axis.Constants;
  +
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +import org.apache.axis.wsdl.symbolTable.MessageEntry;
  +
  +import org.w3c.dom.Node;
  +import org.w3c.dom.NodeList;
  +
  +public class Utils extends org.apache.axis.wsdl.symbolTable.Utils {
  +    /**
  +     * Given a type, return the Java mapping of that type's holder.
  +     */
  +    public static String holder(TypeEntry type, Emitter emitter) {
  +        String typeValue = type.getName();
  +
  +        // byte[] has a reserved holders
  +        if (typeValue.equals("byte[]")) {
  +            return "javax.xml.rpc.holders.ByteArrayHolder";
  +        }
  +        // Anything else with [] gets its holder from the qname
  +        else if (typeValue.endsWith("[]")) {
  +            String name = emitter.getJavaName(type.getQName());
  +            // This could be a special QName for a indexed property.
  +            // If so, change the [] to Array.
  +            name = JavaUtils.replace(name, "[]", "Array");
  +            return name + "Holder";
  +        }
  +        // String also has a reserved holder
  +        else if (typeValue.equals("String")) {
  +            return "javax.xml.rpc.holders.StringHolder";
  +        }
  +        else if (typeValue.equals("java.lang.String")) {
  +            return "javax.xml.rpc.holders.StringHolder";
  +        }
  +        // Object also has a reserved holder
  +        else if (typeValue.equals("Object")) {
  +            return "javax.xml.rpc.holders.ObjectHolder";
  +        }
  +        else if (typeValue.equals("java.lang.Object")) {
  +            return "javax.xml.rpc.holders.ObjectHolder";
  +        }
  +        // Java primitive types have reserved holders
  +        else if (typeValue.equals("int")
  +                 || typeValue.equals("long")
  +                 || typeValue.equals("short")
  +                 || typeValue.equals("float")
  +                 || typeValue.equals("double")
  +                 || typeValue.equals("boolean")
  +                 || typeValue.equals("byte")) {
  +            return "javax.xml.rpc.holders." + capitalizeFirstChar(typeValue) + "Holder";
  +        }
  +        // Java language classes have reserved holders (with ClassHolder)
  +        else if (typeValue.startsWith("java.lang.")) {
  +            return "javax.xml.rpc.holders" + 
  +                typeValue.substring(typeValue.lastIndexOf(".")) +
  +                "WrapperHolder";
  +        }
  +        else if (typeValue.indexOf(".") < 0) {
  +            return "javax.xml.rpc.holders" + 
  +                typeValue +
  +                "WrapperHolder";
  +        }
  +        // The classes have reserved holders because they 
  +        // represent schema/soap encoding primitives
  +        else if (typeValue.equals("java.math.BigDecimal")) {
  +            return "javax.xml.rpc.holders.BigDecimalHolder";
  +        }
  +        else if (typeValue.equals("java.math.BigInteger")) {
  +            return "javax.xml.rpc.holders.BigIntegerHolder";
  +        }
  +        else if  (typeValue.equals("java.util.Date")) {
  +            return "javax.xml.rpc.holders.DateHolder";
  +        }
  +        else if (typeValue.equals("java.util.Calendar")) {
  +            return "javax.xml.rpc.holders.CalendarHolder";
  +        }
  +        else if (typeValue.equals("javax.xml.rpc.namespace.QName")) {
  +            return "javax.xml.rpc.holders.QNameHolder";
  +        }
  +        // For everything else simply append Holder
  +        else
  +            return typeValue + "Holder";
  +    } // holder
  +
  +    /**
  +     * Given a fault, return the fully qualified Java class name
  +     * of the exception to be generated from this fault
  +     * 
  +     * @param fault - The WSDL fault object
  +     * @param symbolTable - the symbol table
  +     * @return A Java class name for the fault
  +     */ 
  +    public static String getFullExceptionName(
  +            Fault fault, Emitter emitter) {
  +
  +        // Get the Message referenced in the message attribute of the
  +        // fault.
  +        Message faultMessage = fault.getMessage();
  +        MessageEntry me = emitter.getSymbolTable().getMessageEntry(
  +            faultMessage.getQName()); 
  +        return (String) me.getDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME);
  +    } // getFullExceptionName
  +
  +    /**
  +     * If the specified node represents a supported JAX-RPC enumeration,
  +     * a Vector is returned which contains the base type and the enumeration values.
  +     * The first element in the vector is the base type (an TypeEntry).
  +     * Subsequent elements are values (Strings).
  +     * If this is not an enumeration, null is returned.
  +     */
  +    public static Vector getEnumerationBaseAndValues(Node node, SymbolTable symbolTable) {
  +        if (node == null) {
  +            return null;
  +        }
  +
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node simpleNode = null;
  +            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
  +                QName simpleKind = Utils.getNodeQName(children.item(j));
  +                if (simpleKind != null &&
  +                    simpleKind.getLocalPart().equals("simpleType") &&
  +                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
  +                    simpleNode = children.item(j);
  +                    node = simpleNode;
  +                }
  +            }
  +        }
  +        // Get the node kind, expecting a schema simpleType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("simpleType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the simpleType there should be a restriction.
  +            // (There may be other #text nodes, which we will ignore).
  +            NodeList children = node.getChildNodes();
  +            Node restrictionNode = null;
  +            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  +                QName restrictionKind = Utils.getNodeQName(children.item(j));
  +                if (restrictionKind != null &&
  +                    restrictionKind.getLocalPart().equals("restriction") &&
  +                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  +                    restrictionNode = children.item(j);
  +            }
  +
  +            // The restriction node indicates the type being restricted
  +            // (the base attribute contains this type).
  +            // The base type must be a built-in type, and not boolean
  +            TypeEntry baseEType = null;
  +            if (restrictionNode != null) {
  +                QName baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
  +                baseEType = symbolTable.getType(baseType);
  +                if (baseEType != null) {
  +                    String javaName = baseEType.getName();
  +                    if (javaName.equals("java.lang.String") ||
  +                        javaName.equals("int") ||
  +                        javaName.equals("long") ||
  +                        javaName.equals("short") ||
  +                        javaName.equals("float") ||
  +                        javaName.equals("double") ||
  +                        javaName.equals("byte"))
  +                        ; // Okay Type
  +                    else
  +                        baseEType = null;
  +                }
  +            }
  +
  +            // Process the enumeration elements underneath the restriction node
  +            if (baseEType != null && restrictionNode != null) {
  +
  +                Vector v = new Vector();                
  +                NodeList enums = restrictionNode.getChildNodes();
  +                for (int i=0; i < enums.getLength(); i++) {
  +                    QName enumKind = Utils.getNodeQName(enums.item(i));
  +                    if (enumKind != null &&
  +                        enumKind.getLocalPart().equals("enumeration") &&
  +                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
  +
  +                        // Put the enum value in the vector.
  +                        Node enumNode = enums.item(i);
  +                        String value = Utils.getAttribute(enumNode, "value");
  +                        if (value != null) {
  +                            v.add(value);
  +                        }
  +                    }
  +                }
  +                
  +                // is this really an enumeration?
  +                if(v.isEmpty()) return null;
  +                
  +                // The first element in the vector is the base type (an TypeEntry).
  +                v.add(0,baseEType);
  +                return v;
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
  +     * Capitalize the first character of the name.
  +     */
  +    public static String capitalizeFirstChar(String name) {
  +        if (name == null || name.equals(""))
  +            return name;
  +        
  +        char start = name.charAt(0);
  +
  +        if (Character.isLowerCase(start)) {
  +            start = Character.toUpperCase(start);
  +            return start + name.substring(1);
  +        }
  +        return name;
  +    } // capitalizeFirstChar
  +
  +    /**
  +     * Map an XML name to a valid Java identifier
  +     */
  +    public static String xmlNameToJava(String name)
  +    {
  +        // NOTE:  This method should really go away and all callers should call
  +        // JavaUtils.xmlNameToJava directly.  But there are a lot of them and I wanted
  +        // to keep the changes to a minimum.  Besides, these are static methods so the should
  +        // be inlined.
  +        return JavaUtils.xmlNameToJava(name);
  +    }
  +
  +    /**
  +     * Map an XML name to a valid Java identifier w/ capitolized first letter 
  +     */ 
  +    public static String xmlNameToJavaClass(String name)
  +    {
  +        return capitalizeFirstChar(xmlNameToJava(name));
  +    }
  +
  +    public static String makePackageName(String namespace)
  +    {
  +        String hostname = null;
  +
  +        // get the target namespace of the document
  +        try {
  +            hostname = new URL(namespace).getHost();
  +        }
  +        catch (MalformedURLException e) {
  +            if (namespace.indexOf(":") > -1) {
  +                hostname = namespace.substring(namespace.indexOf(":") + 1);
  +                if (hostname.indexOf("/") > -1)
  +                    hostname = hostname.substring(0, hostname.indexOf("/") );
  +            }
  +            else {
  +                hostname = namespace;
  +            }
  +        }
  +
  +        // if we didn't file a hostname, bail
  +        if (hostname == null) {
  +            return null;
  +        }
  +
  +        //convert illegal java identifier
  +        hostname = hostname.replace('-', '_');
  +
  +        // tokenize the hostname and reverse it
  +        StringTokenizer st = new StringTokenizer( hostname, "." );
  +        String[] words = new String[ st.countTokens() ];
  +        for(int i = 0; i < words.length; ++i)
  +            words[i] = st.nextToken();
  +
  +        StringBuffer sb = new StringBuffer(80);
  +        for(int i = words.length-1; i >= 0; --i) {
  +            String word = words[i];
  +            if (JavaUtils.isJavaKeyword(word)) {
  +                word = JavaUtils.makeNonJavaKeyword(word);
  +            }
  +            // seperate with dot
  +            if( i != words.length-1 )
  +                sb.append('.');
  +
  +            // convert digits to underscores
  +            if( Character.isDigit(word.charAt(0)) )
  +                sb.append('_');
  +            sb.append( word );
  +        }
  +        return sb.toString();
  +    }
  +
  +    /**
  +     * Query Java Local Name
  +     */
  +    public static String getJavaLocalName(String fullName) {
  +        return fullName.substring(fullName.lastIndexOf('.') + 1);
  +    } // getJavaLocalName
  +
  +    /**
  +     * Query Java Package Name
  +     */
  +    public static String getJavaPackageName(String fullName) {
  +        if (fullName.lastIndexOf('.') > 0) {
  +            return fullName.substring(0, fullName.lastIndexOf('.'));
  +        }
  +        else {
  +            return "";
  +        }
  +    } // getJavaPackageName
  +
  +    /**
  +     * Does the given file already exist in the given namespace?
  +     */
  +    public static boolean fileExists(String name, String namespace,
  +            Namespaces namespaces) throws IOException
  +    {
  +        String packageName = namespaces.getAsDir(namespace);
  +        String fullName = packageName + name;
  +        return new File (fullName).exists();
  +    } // fileExists
  +
  +    /**
  +     * A simple map of the primitive types and their holder objects
  +     */
  +    private static HashMap TYPES = new HashMap(7);
  +
  +    static {
  +        TYPES.put("int", "Integer");
  +        TYPES.put("float", "Float");
  +        TYPES.put("boolean", "Boolean");
  +        TYPES.put("double", "Double");
  +        TYPES.put("byte", "Byte");
  +        TYPES.put("short", "Short");
  +        TYPES.put("long", "Long");
  +    }
  +
  +    /**
  +     * Return a string with "var" wrapped as an Object type if needed
  +     */
  +    public static String wrapPrimitiveType(TypeEntry type, String var) {
  +        String objType = type == null ? null : (String) TYPES.get(type.getName());
  +        if (objType != null) {
  +            return "new " + objType + "(" + var + ")";
  +        } else if (type != null && 
  +                   type.getName().equals("byte[]") &&
  +                   type.getQName().getLocalPart().equals("hexBinary")) {
  +            // Need to wrap byte[] in special Hex object to get the correct serialization
  +            return "new org.apache.axis.encoding.Hex(" + var + ")";
  +        } else {
  +            return var;
  +        }
  +    } // wrapPrimitiveType
  +
  +    /**
  +     * Return the Object variable 'var' cast to the appropriate type
  +     * doing the right thing for the primitive types.
  +     */
  +    public static String getResponseString(TypeEntry type, String var) {
  +        if (type == null) {
  +            return ";";
  +        }
  +        else {
  +            String objType = (String) TYPES.get(type.getName());
  +            if (objType != null) {
  +                return "((" + objType + ") " + var + ")." + type.getName() + "Value();";
  +            }
  +            else {
  +                return "(" + type.getName() + ") " + var + ";";
  +            }
  +        }
  +    } // getResponseString
  +
  +    public static boolean isPrimitiveType(TypeEntry type) {
  +        return TYPES.get(type.getName()) != null;
  +    } // isPrimitiveType
  +
  +} // class Utils
  
  
  
  1.5       +64 -64    xml-axis/java/test/encoding/DataDeser.java
  
  Index: DataDeser.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataDeser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DataDeser.java	30 May 2002 03:06:13 -0000	1.4
  +++ DataDeser.java	30 May 2002 23:46:03 -0000	1.5
  @@ -1,64 +1,64 @@
  -package test.encoding;
  -
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerImpl;
  -import org.apache.axis.encoding.FieldTarget;
  -import org.apache.axis.Constants;
  -import org.apache.axis.message.SOAPHandler;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.util.Hashtable;
  -
  -public class DataDeser extends DeserializerImpl
  -{
  -    public static final String STRINGMEMBER = "stringMember";
  -    public static final String FLOATMEMBER = "floatMember";
  -    
  -    private Hashtable typesByMemberName = new Hashtable();  
  -    
  -    public DataDeser()
  -    {
  -        typesByMemberName.put(STRINGMEMBER, Constants.XSD_STRING);
  -        typesByMemberName.put(FLOATMEMBER, Constants.XSD_FLOAT);
  -        value = new Data();
  -    }
  -    
  -    /** DESERIALIZER STUFF - event handlers
  -     */
  -
  -    /**
  -     * This method is invoked when an element start tag is encountered.
  -     * @param namespace is the namespace of the element
  -     * @param localName is the name of the element
  -     * @param prefix is the prefix of the element
  -     * @param attributes are the attributes on the element...used to get the type
  -     * @param context is the DeserializationContext
  -     */
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        QName typeQName = (QName)typesByMemberName.get(localName);
  -        if (typeQName == null)
  -            throw new SAXException("Invalid element in Data struct - " + localName);
  -        
  -        // These can come in either order.
  -        Deserializer dSer = context.getDeserializerForType(typeQName);
  -        try {
  -            dSer.registerValueTarget(new FieldTarget(value, localName));
  -        } catch (NoSuchFieldException e) {
  -            throw new SAXException(e);
  -        }
  -        
  -        if (dSer == null)
  -            throw new SAXException("No deserializer for a " + typeQName + "???");
  -        
  -        return (SOAPHandler)dSer;
  -    }
  -}
  +package test.encoding;
  +
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerImpl;
  +import org.apache.axis.encoding.FieldTarget;
  +import org.apache.axis.Constants;
  +import org.apache.axis.message.SOAPHandler;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.util.Hashtable;
  +
  +public class DataDeser extends DeserializerImpl
  +{
  +    public static final String STRINGMEMBER = "stringMember";
  +    public static final String FLOATMEMBER = "floatMember";
  +    
  +    private Hashtable typesByMemberName = new Hashtable();  
  +    
  +    public DataDeser()
  +    {
  +        typesByMemberName.put(STRINGMEMBER, Constants.XSD_STRING);
  +        typesByMemberName.put(FLOATMEMBER, Constants.XSD_FLOAT);
  +        value = new Data();
  +    }
  +    
  +    /** DESERIALIZER STUFF - event handlers
  +     */
  +
  +    /**
  +     * This method is invoked when an element start tag is encountered.
  +     * @param namespace is the namespace of the element
  +     * @param localName is the name of the element
  +     * @param prefix is the prefix of the element
  +     * @param attributes are the attributes on the element...used to get the type
  +     * @param context is the DeserializationContext
  +     */
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    String prefix,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
  +        throws SAXException
  +    {
  +        QName typeQName = (QName)typesByMemberName.get(localName);
  +        if (typeQName == null)
  +            throw new SAXException("Invalid element in Data struct - " + localName);
  +        
  +        // These can come in either order.
  +        Deserializer dSer = context.getDeserializerForType(typeQName);
  +        try {
  +            dSer.registerValueTarget(new FieldTarget(value, localName));
  +        } catch (NoSuchFieldException e) {
  +            throw new SAXException(e);
  +        }
  +        
  +        if (dSer == null)
  +            throw new SAXException("No deserializer for a " + typeQName + "???");
  +        
  +        return (SOAPHandler)dSer;
  +    }
  +}
  
  
  
  1.4       +96 -96    xml-axis/java/test/encoding/DataDeserFactory.java
  
  Index: DataDeserFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataDeserFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DataDeserFactory.java	30 May 2002 03:06:13 -0000	1.3
  +++ DataDeserFactory.java	30 May 2002 23:46:03 -0000	1.4
  @@ -1,96 +1,96 @@
  -/*
  - * 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/>.
  - */
  -
  -package test.encoding;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.Constants;
  -
  -import java.util.Iterator;
  -import java.util.Vector;
  -
  -/**
  - * DeserializerFactory for DataDeser
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public class DataDeserFactory implements DeserializerFactory {
  -    private Vector mechanisms;
  -
  -    public DataDeserFactory() {
  -    }
  -    public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
  -        return new DataDeser();
  -    }
  -    public Iterator getSupportedMechanismTypes() {
  -        if (mechanisms == null) {
  -            mechanisms = new Vector();
  -            mechanisms.add(Constants.AXIS_SAX);
  -        }
  -        return mechanisms.iterator();
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package test.encoding;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.Constants;
  +
  +import java.util.Iterator;
  +import java.util.Vector;
  +
  +/**
  + * DeserializerFactory for DataDeser
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public class DataDeserFactory implements DeserializerFactory {
  +    private Vector mechanisms;
  +
  +    public DataDeserFactory() {
  +    }
  +    public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
  +        return new DataDeser();
  +    }
  +    public Iterator getSupportedMechanismTypes() {
  +        if (mechanisms == null) {
  +            mechanisms = new Vector();
  +            mechanisms.add(Constants.AXIS_SAX);
  +        }
  +        return mechanisms.iterator();
  +    }
  +}
  
  
  
  1.4       +96 -96    xml-axis/java/test/encoding/DataSerFactory.java
  
  Index: DataSerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataSerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DataSerFactory.java	30 May 2002 03:06:13 -0000	1.3
  +++ DataSerFactory.java	30 May 2002 23:46:03 -0000	1.4
  @@ -1,96 +1,96 @@
  -/*
  - * 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/>.
  - */
  -
  -package test.encoding;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.Constants;
  -
  -import java.util.Iterator;
  -import java.util.Vector;
  -
  -/**
  - * SerializerFactory for DataSer
  - *
  - * @author Rich Scheuerle <scheu@us.ibm.com>
  - */
  -public class DataSerFactory implements SerializerFactory {
  -    private Vector mechanisms;
  -
  -    public DataSerFactory() {
  -    }
  -    public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
  -        return new DataSer();
  -    }
  -    public Iterator getSupportedMechanismTypes() {
  -        if (mechanisms == null) {
  -            mechanisms = new Vector();
  -            mechanisms.add(Constants.AXIS_SAX);
  -        }
  -        return mechanisms.iterator();
  -    }
  -}
  +/*
  + * 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/>.
  + */
  +
  +package test.encoding;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.SAXException;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.IOException;
  +
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.Constants;
  +
  +import java.util.Iterator;
  +import java.util.Vector;
  +
  +/**
  + * SerializerFactory for DataSer
  + *
  + * @author Rich Scheuerle <scheu@us.ibm.com>
  + */
  +public class DataSerFactory implements SerializerFactory {
  +    private Vector mechanisms;
  +
  +    public DataSerFactory() {
  +    }
  +    public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
  +        return new DataSer();
  +    }
  +    public Iterator getSupportedMechanismTypes() {
  +        if (mechanisms == null) {
  +            mechanisms = new Vector();
  +            mechanisms.add(Constants.AXIS_SAX);
  +        }
  +        return mechanisms.iterator();
  +    }
  +}
  
  
  
  1.4       +14 -14    xml-axis/java/test/encoding/TestDeser1999.java
  
  Index: TestDeser1999.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser1999.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestDeser1999.java	30 May 2002 03:06:13 -0000	1.3
  +++ TestDeser1999.java	30 May 2002 23:46:03 -0000	1.4
  @@ -1,14 +1,14 @@
  -package test.encoding;
  -
  -import org.apache.axis.Constants;
  -
  -/** 
  - * Test deserialization of SOAP responses
  - */
  -public class TestDeser1999 extends TestDeser {
  -
  -    public TestDeser1999(String name) {
  -        super(name, Constants.NS_URI_1999_SCHEMA_XSI, 
  -                    Constants.NS_URI_1999_SCHEMA_XSD);
  -    }
  -}
  +package test.encoding;
  +
  +import org.apache.axis.Constants;
  +
  +/** 
  + * Test deserialization of SOAP responses
  + */
  +public class TestDeser1999 extends TestDeser {
  +
  +    public TestDeser1999(String name) {
  +        super(name, Constants.NS_URI_1999_SCHEMA_XSI, 
  +                    Constants.NS_URI_1999_SCHEMA_XSD);
  +    }
  +}
  
  
  
  1.26      +117 -117  xml-axis/java/test/encoding/TestSer.java
  
  Index: TestSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestSer.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- TestSer.java	30 May 2002 03:06:14 -0000	1.25
  +++ TestSer.java	30 May 2002 23:46:03 -0000	1.26
  @@ -1,117 +1,117 @@
  -package test.encoding;
  -
  -import junit.framework.TestCase;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.DeserializationContextImpl;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.SerializationContextImpl;
  -import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.Constants;
  -import org.apache.axis.message.RPCElement;
  -import org.apache.axis.message.RPCParam;
  -import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.server.AxisServer;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.xml.sax.InputSource;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.StringReader;
  -import java.io.StringWriter;
  -import java.io.Writer;
  -
  -/** Little serialization test with a struct.
  - */
  -public class TestSer extends TestCase {
  -    static Log log =
  -            LogFactory.getLog(TestSer.class.getName());
  -
  -    public static final String myNS = "urn:myNS";
  -    
  -    public TestSer(String name) {
  -        super(name);
  -    }
  -    
  -    public void testDataNoHrefs () throws Exception {
  -        doTestData(false);
  -    }
  -        
  -    public void testDataWithHrefs () throws Exception {
  -        doTestData(true);
  -    }        
  -
  -    public void doTestData (boolean multiref) throws Exception {
  -        MessageContext msgContext = new MessageContext(new AxisServer());
  -        SOAPEnvelope msg = new SOAPEnvelope();
  -        RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", "this is a string");
  -        
  -        Data data = new Data();
  -        data.stringMember = "String member";
  -        data.floatMember = new Float("4.54");
  -        
  -        RPCParam arg2 = new RPCParam("", "struct", data);
  -        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[]{ arg1, arg2 });
  -        msg.addBodyElement(body);
  -        
  -        Writer stringWriter = new StringWriter();
  -        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
  -        context.setDoMultiRefs(multiref);
  -        
  -        // Create a TypeMapping and register the specialized Type Mapping
  -        TypeMappingRegistry reg = context.getTypeMappingRegistry();
  -        TypeMapping tm = (TypeMapping) reg.createTypeMapping();
  -        tm.setSupportedEncodings(new String[] {Constants.NS_URI_CURRENT_SOAP_ENC});
  -        reg.register(Constants.NS_URI_CURRENT_SOAP_ENC, tm);
  -
  -        QName dataQName = new QName("typeNS", "Data");
  -        tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());
  -
  -        msg.output(context);
  -        
  -        String msgString = stringWriter.toString();
  -        
  -        log.debug("---");
  -        log.debug(msgString);
  -        log.debug("---");
  -        
  -        StringReader reader = new StringReader(msgString);
  -        
  -        DeserializationContext dser = new DeserializationContextImpl(
  -            new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
  -        dser.parse();
  -        
  -        SOAPEnvelope env = dser.getEnvelope();
  -        RPCElement rpcElem = (RPCElement)env.getFirstBody();
  -        RPCParam struct = rpcElem.getParam("struct");
  -        assertNotNull("No <struct> param", struct);
  -        
  -        Data val = (Data)struct.getValue();
  -        assertNotNull("No value for struct param", val);
  -        
  -        assertEquals("Data and Val string members are not equal", data.stringMember, val.stringMember);
  -        assertEquals("Data and Val float members are not equal",data.floatMember.floatValue(), 
  -                     val.floatMember.floatValue(), 0.00001F);
  -    }
  -
  -    /**
  -     * Test RPC element serialization when we have no MessageContext
  -     */
  -    public void testRPCElement()
  -    {
  -        try {
  -            SOAPEnvelope env = new SOAPEnvelope();
  -            RPCElement method = new RPCElement("ns",
  -                                               "method",
  -                                               new Object [] { "argument" });
  -            env.addBodyElement(method);
  -            String soapStr = env.toString();
  -        } catch (Exception e) {
  -            fail(e.getMessage());
  -        }
  -
  -        // If there was no exception, we succeeded in serializing it.
  -    }
  -
  -}
  +package test.encoding;
  +
  +import junit.framework.TestCase;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.DeserializationContextImpl;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializationContextImpl;
  +import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.Constants;
  +import org.apache.axis.message.RPCElement;
  +import org.apache.axis.message.RPCParam;
  +import org.apache.axis.message.SOAPEnvelope;
  +import org.apache.axis.server.AxisServer;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.xml.sax.InputSource;
  +
  +import javax.xml.rpc.namespace.QName;
  +import java.io.StringReader;
  +import java.io.StringWriter;
  +import java.io.Writer;
  +
  +/** Little serialization test with a struct.
  + */
  +public class TestSer extends TestCase {
  +    static Log log =
  +            LogFactory.getLog(TestSer.class.getName());
  +
  +    public static final String myNS = "urn:myNS";
  +    
  +    public TestSer(String name) {
  +        super(name);
  +    }
  +    
  +    public void testDataNoHrefs () throws Exception {
  +        doTestData(false);
  +    }
  +        
  +    public void testDataWithHrefs () throws Exception {
  +        doTestData(true);
  +    }        
  +
  +    public void doTestData (boolean multiref) throws Exception {
  +        MessageContext msgContext = new MessageContext(new AxisServer());
  +        SOAPEnvelope msg = new SOAPEnvelope();
  +        RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", "this is a string");
  +        
  +        Data data = new Data();
  +        data.stringMember = "String member";
  +        data.floatMember = new Float("4.54");
  +        
  +        RPCParam arg2 = new RPCParam("", "struct", data);
  +        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[]{ arg1, arg2 });
  +        msg.addBodyElement(body);
  +        
  +        Writer stringWriter = new StringWriter();
  +        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
  +        context.setDoMultiRefs(multiref);
  +        
  +        // Create a TypeMapping and register the specialized Type Mapping
  +        TypeMappingRegistry reg = context.getTypeMappingRegistry();
  +        TypeMapping tm = (TypeMapping) reg.createTypeMapping();
  +        tm.setSupportedEncodings(new String[] {Constants.NS_URI_CURRENT_SOAP_ENC});
  +        reg.register(Constants.NS_URI_CURRENT_SOAP_ENC, tm);
  +
  +        QName dataQName = new QName("typeNS", "Data");
  +        tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());
  +
  +        msg.output(context);
  +        
  +        String msgString = stringWriter.toString();
  +        
  +        log.debug("---");
  +        log.debug(msgString);
  +        log.debug("---");
  +        
  +        StringReader reader = new StringReader(msgString);
  +        
  +        DeserializationContext dser = new DeserializationContextImpl(
  +            new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
  +        dser.parse();
  +        
  +        SOAPEnvelope env = dser.getEnvelope();
  +        RPCElement rpcElem = (RPCElement)env.getFirstBody();
  +        RPCParam struct = rpcElem.getParam("struct");
  +        assertNotNull("No <struct> param", struct);
  +        
  +        Data val = (Data)struct.getValue();
  +        assertNotNull("No value for struct param", val);
  +        
  +        assertEquals("Data and Val string members are not equal", data.stringMember, val.stringMember);
  +        assertEquals("Data and Val float members are not equal",data.floatMember.floatValue(), 
  +                     val.floatMember.floatValue(), 0.00001F);
  +    }
  +
  +    /**
  +     * Test RPC element serialization when we have no MessageContext
  +     */
  +    public void testRPCElement()
  +    {
  +        try {
  +            SOAPEnvelope env = new SOAPEnvelope();
  +            RPCElement method = new RPCElement("ns",
  +                                               "method",
  +                                               new Object [] { "argument" });
  +            env.addBodyElement(method);
  +            String soapStr = env.toString();
  +        } catch (Exception e) {
  +            fail(e.getMessage());
  +        }
  +
  +        // If there was no exception, we succeeded in serializing it.
  +    }
  +
  +}
  
  
  
  1.4       +83 -83    xml-axis/java/test/message/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/message/PackageTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PackageTests.java	30 May 2002 03:06:14 -0000	1.3
  +++ PackageTests.java	30 May 2002 23:46:03 -0000	1.4
  @@ -1,83 +1,83 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2002 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/>.
  - */
  -
  -package test.message;
  -
  -import junit.framework.Test;
  -import junit.framework.TestCase;
  -import junit.framework.TestSuite;
  -
  -/**
  - * Test org.apache.axis.Message subsystem.
  - *
  - * @author Glyn Normington (glyn@apache.org)
  - */
  -public class PackageTests extends TestCase
  -{
  -    public PackageTests(String name)
  -    {
  -        super(name);
  -    }
  -
  -    public static Test suite() throws Exception
  -    {
  -        TestSuite suite = new TestSuite();
  -        
  -        suite.addTestSuite(TestMessageElement.class);
  -        suite.addTestSuite(TestSOAPEnvelope.class);
  - 
  -        return suite;
  -    }
  -}
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2002 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/>.
  + */
  +
  +package test.message;
  +
  +import junit.framework.Test;
  +import junit.framework.TestCase;
  +import junit.framework.TestSuite;
  +
  +/**
  + * Test org.apache.axis.Message subsystem.
  + *
  + * @author Glyn Normington (glyn@apache.org)
  + */
  +public class PackageTests extends TestCase
  +{
  +    public PackageTests(String name)
  +    {
  +        super(name);
  +    }
  +
  +    public static Test suite() throws Exception
  +    {
  +        TestSuite suite = new TestSuite();
  +        
  +        suite.addTestSuite(TestMessageElement.class);
  +        suite.addTestSuite(TestSOAPEnvelope.class);
  + 
  +        return suite;
  +    }
  +}
  
  
  
  1.8       +113 -113  xml-axis/java/test/wsdl/arrays/PersonalInfoBookServiceTestCase.java
  
  Index: PersonalInfoBookServiceTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/arrays/PersonalInfoBookServiceTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PersonalInfoBookServiceTestCase.java	30 May 2002 03:06:15 -0000	1.7
  +++ PersonalInfoBookServiceTestCase.java	30 May 2002 23:46:03 -0000	1.8
  @@ -1,113 +1,113 @@
  -/**
  - * PersonalInfoBookServiceTestCase.java
  - *
  - * This file was auto-generated from WSDL
  - * by the Apache Axis Wsdl2java emitter.
  - */
  -
  -package test.wsdl.arrays;
  -
  -import java.util.Vector;
  -
  -public class PersonalInfoBookServiceTestCase extends junit.framework.TestCase {
  -    public PersonalInfoBookServiceTestCase(String name) {
  -        super(name);
  -    }
  -
  -
  -
  -    public void testPersonalInfoBook() {
  -
  -        // Set up some testcase values
  -        String name = "Joe Geek";
  -        String[] movies = new String[] { "Star Trek", "A.I." };
  -        String[] hobbies= new String[] { "programming", "reading about programming" };
  -        Vector pets = new Vector();
  -        pets.add(new String("Byte"));
  -        pets.add(new String("Nibbles"));
  -        //String[] pets   = new String[] { "Byte", "Nibbles" };
  -        int[]    id     = new int[]    { 0, 0, 7 };
  -        int id2         = 123;
  -        String[] foods  = new String[] { "Cheeze Whiz", "Jolt Cola" };
  -        byte[]   nickName = new byte[] { (byte)'g', (byte)'e',
  -                                         (byte)'e', (byte)'k'};
  -        PersonalInfo pi = new PersonalInfo();
  -        pi.setName(name);
  -        pi.setFavoriteMovies(movies);
  -        pi.setHobbies(hobbies);
  -        pi.setPets(pets);
  -        pi.setId(id);
  -        pi.setId2(id2);
  -        pi.setFoods(foods);
  -        pi.setNickName(nickName);
  -
  -        // Get the stub and set Session
  -        test.wsdl.arrays.PersonalInfoBook binding;
  -        try {
  -            binding = new PersonalInfoBookServiceLocator().getPersonalInfoBook();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre );
  -        }
  -        assertTrue("binding is null", binding != null);
  -        ((PersonalInfoBookSOAPBindingStub) binding).setMaintainSession (true);
  -
  -        // Add the name and personal info for Joe Geek
  -        try {
  -            binding.addEntry(name, pi);
  -        } catch (java.rmi.RemoteException re) {
  -            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  -        }
  -
  -        // Now get the personal info and check validity
  -        try {
  -            test.wsdl.arrays.PersonalInfo value = null;
  -            value = binding.getPersonalInfoFromName(name);
  -            assertTrue("Name is corrupted " + value, 
  -                       value.getName().equals(pi.getName()));
  -            assertTrue("Movies are corrupted " + value, 
  -                       value.getFavoriteMovies()[1].equals(pi.getFavoriteMovies()[1]));
  -            assertTrue("Hobbies are corrupted " + value, 
  -                       value.getHobbies()[1].equals(pi.getHobbies()[1]));
  -            assertTrue("Pets are corrupted " + value, 
  -                       value.getPets().elementAt(1).equals(pi.getPets().elementAt(1)));
  -            assertTrue("Id is corrupted " + value, 
  -                       value.getId()[0] == 0 && value.getId()[1] == 0 && value.getId()[2] == 7);
  -            assertTrue("Id2 is corrupted " + value, 
  -                       value.getId2() == pi.getId2());
  -            assertTrue("Food are corrupted " + value, 
  -                       value.getFoods(1).equals(pi.getFoods(1)));
  -            assertTrue("Nickname is corrupted " + value, 
  -                       value.getNickName()[1] == pi.getNickName()[1]);
  -            
  -        } catch (java.rmi.RemoteException re) {
  -            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  -        }
  -
  -        try {
  -            Vector value = null;
  -            value = binding.getPetsFromName(name);
  -            assertTrue("PetsFromName is broken " + value, 
  -                       value.elementAt(1).equals(pi.getPets().elementAt(1)));
  -        } catch (java.rmi.RemoteException re) {
  -            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  -        }
  -        try {
  -            int[] value = null;
  -            value = binding.getIDFromName(name);
  -            assertTrue("getIDFromName is brokent " + value, 
  -                       value[0] == 0 && value[1] == 0 && value[2] == 7);
  -        } catch (java.rmi.RemoteException re) {
  -            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  -        }
  -        try {
  -            int value = -3;
  -            value = binding.getID2FromName(name);
  -            assertTrue("getID2FromName is brokent " + value, 
  -                       value == pi.getId2());
  -        } catch (java.rmi.RemoteException re) {
  -            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  -        }
  -    }
  -}
  -
  +/**
  + * PersonalInfoBookServiceTestCase.java
  + *
  + * This file was auto-generated from WSDL
  + * by the Apache Axis Wsdl2java emitter.
  + */
  +
  +package test.wsdl.arrays;
  +
  +import java.util.Vector;
  +
  +public class PersonalInfoBookServiceTestCase extends junit.framework.TestCase {
  +    public PersonalInfoBookServiceTestCase(String name) {
  +        super(name);
  +    }
  +
  +
  +
  +    public void testPersonalInfoBook() {
  +
  +        // Set up some testcase values
  +        String name = "Joe Geek";
  +        String[] movies = new String[] { "Star Trek", "A.I." };
  +        String[] hobbies= new String[] { "programming", "reading about programming" };
  +        Vector pets = new Vector();
  +        pets.add(new String("Byte"));
  +        pets.add(new String("Nibbles"));
  +        //String[] pets   = new String[] { "Byte", "Nibbles" };
  +        int[]    id     = new int[]    { 0, 0, 7 };
  +        int id2         = 123;
  +        String[] foods  = new String[] { "Cheeze Whiz", "Jolt Cola" };
  +        byte[]   nickName = new byte[] { (byte)'g', (byte)'e',
  +                                         (byte)'e', (byte)'k'};
  +        PersonalInfo pi = new PersonalInfo();
  +        pi.setName(name);
  +        pi.setFavoriteMovies(movies);
  +        pi.setHobbies(hobbies);
  +        pi.setPets(pets);
  +        pi.setId(id);
  +        pi.setId2(id2);
  +        pi.setFoods(foods);
  +        pi.setNickName(nickName);
  +
  +        // Get the stub and set Session
  +        test.wsdl.arrays.PersonalInfoBook binding;
  +        try {
  +            binding = new PersonalInfoBookServiceLocator().getPersonalInfoBook();
  +        }
  +        catch (javax.xml.rpc.ServiceException jre) {
  +            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre );
  +        }
  +        assertTrue("binding is null", binding != null);
  +        ((PersonalInfoBookSOAPBindingStub) binding).setMaintainSession (true);
  +
  +        // Add the name and personal info for Joe Geek
  +        try {
  +            binding.addEntry(name, pi);
  +        } catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  +        }
  +
  +        // Now get the personal info and check validity
  +        try {
  +            test.wsdl.arrays.PersonalInfo value = null;
  +            value = binding.getPersonalInfoFromName(name);
  +            assertTrue("Name is corrupted " + value, 
  +                       value.getName().equals(pi.getName()));
  +            assertTrue("Movies are corrupted " + value, 
  +                       value.getFavoriteMovies()[1].equals(pi.getFavoriteMovies()[1]));
  +            assertTrue("Hobbies are corrupted " + value, 
  +                       value.getHobbies()[1].equals(pi.getHobbies()[1]));
  +            assertTrue("Pets are corrupted " + value, 
  +                       value.getPets().elementAt(1).equals(pi.getPets().elementAt(1)));
  +            assertTrue("Id is corrupted " + value, 
  +                       value.getId()[0] == 0 && value.getId()[1] == 0 && value.getId()[2] == 7);
  +            assertTrue("Id2 is corrupted " + value, 
  +                       value.getId2() == pi.getId2());
  +            assertTrue("Food are corrupted " + value, 
  +                       value.getFoods(1).equals(pi.getFoods(1)));
  +            assertTrue("Nickname is corrupted " + value, 
  +                       value.getNickName()[1] == pi.getNickName()[1]);
  +            
  +        } catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  +        }
  +
  +        try {
  +            Vector value = null;
  +            value = binding.getPetsFromName(name);
  +            assertTrue("PetsFromName is broken " + value, 
  +                       value.elementAt(1).equals(pi.getPets().elementAt(1)));
  +        } catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  +        }
  +        try {
  +            int[] value = null;
  +            value = binding.getIDFromName(name);
  +            assertTrue("getIDFromName is brokent " + value, 
  +                       value[0] == 0 && value[1] == 0 && value[2] == 7);
  +        } catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  +        }
  +        try {
  +            int value = -3;
  +            value = binding.getID2FromName(name);
  +            assertTrue("getID2FromName is brokent " + value, 
  +                       value == pi.getId2());
  +        } catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
  +        }
  +    }
  +}
  +
  
  
  
  1.4       +19 -19    xml-axis/java/test/wsdl/interop3/compound1/SoapInteropCompound1BindingImpl.java
  
  Index: SoapInteropCompound1BindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/compound1/SoapInteropCompound1BindingImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SoapInteropCompound1BindingImpl.java	30 May 2002 03:06:15 -0000	1.3
  +++ SoapInteropCompound1BindingImpl.java	30 May 2002 23:46:03 -0000	1.4
  @@ -1,19 +1,19 @@
  -/**
  - * SoapInteropCompound1BindingImpl.java
  - *
  - * This file was auto-generated from WSDL
  - * by the Apache Axis Wsdl2java emitter.
  - */
  -
  -package test.wsdl.interop3.compound1;
  -
  -public class SoapInteropCompound1BindingImpl implements test.wsdl.interop3.compound1.SoapInteropCompound1PortType {
  -    public test.wsdl.interop3.compound1.xsd.Person echoPerson(test.wsdl.interop3.compound1.xsd.Person xPerson) throws java.rmi.RemoteException {
  -        return xPerson;
  -    }
  -
  -    public test.wsdl.interop3.compound1.xsd.Document echoDocument(test.wsdl.interop3.compound1.xsd.Document xDocument) throws java.rmi.RemoteException {
  -        return xDocument;
  -    }
  -
  -}
  +/**
  + * SoapInteropCompound1BindingImpl.java
  + *
  + * This file was auto-generated from WSDL
  + * by the Apache Axis Wsdl2java emitter.
  + */
  +
  +package test.wsdl.interop3.compound1;
  +
  +public class SoapInteropCompound1BindingImpl implements test.wsdl.interop3.compound1.SoapInteropCompound1PortType {
  +    public test.wsdl.interop3.compound1.xsd.Person echoPerson(test.wsdl.interop3.compound1.xsd.Person xPerson) throws java.rmi.RemoteException {
  +        return xPerson;
  +    }
  +
  +    public test.wsdl.interop3.compound1.xsd.Document echoDocument(test.wsdl.interop3.compound1.xsd.Document xDocument) throws java.rmi.RemoteException {
  +        return xDocument;
  +    }
  +
  +}
  
  
  
  1.10      +39 -39    xml-axis/java/test/wsdl/interop3/compound1/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/compound1/build.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- build.xml	30 May 2002 03:06:15 -0000	1.9
  +++ build.xml	30 May 2002 23:46:03 -0000	1.10
  @@ -1,39 +1,39 @@
  -<project name="Round3" default="main">
  -  <property name="root.dir" value="../../../.."/>
  -
  -  <path id="test-classpath">
  -    <pathelement location="${build.dest}" />
  -    <pathelement path="${java.class.path}" />
  -    <pathelement location="${java.home}/../lib/tools.jar"/>
  -    <fileset dir="${root.dir}/lib">
  -      <include name="*.jar"/>
  -    </fileset>
  -  </path>
  -
  -  <taskdef name="wsdl2java" classname="test.wsdl.Wsdl2javaAntTask">
  -      <classpath refid="test-classpath"/>
  -  </taskdef>
  -
  -  <target name="main">
  -    <property name="testname" value="compound1"/>
  -
  -    <!-- generate skeletons -->
  -    <wsdl2java url="http://www.whitemesa.net/wsdl/r3/${testname}.wsdl"
  -               output="${root.dir}/build/work" skeletonDeploy="yes"
  -               serverSide="yes"/>
  -
  -    <copy file="SoapInteropCompound1BindingImpl.java" overwrite="true"
  -          todir="${root.dir}/build/work/test/wsdl/interop3/${testname}"/>
  -
  -    <copy file="Compound1TestCase.java"
  -          todir="${root.dir}/build/work/test/wsdl/interop3/${testname}"/>
  -
  -    <!-- compile the skeletons -->
  -    <javac srcdir="${build.dir}/work" 
  -      destdir="${build.dest}" debug="on">
  -      <classpath refid="test-classpath" />
  -      <include name="test/wsdl/interop3/${testname}/*.java" />
  -    </javac>
  -  </target>
  -
  -</project>
  +<project name="Round3" default="main">
  +  <property name="root.dir" value="../../../.."/>
  +
  +  <path id="test-classpath">
  +    <pathelement location="${build.dest}" />
  +    <pathelement path="${java.class.path}" />
  +    <pathelement location="${java.home}/../lib/tools.jar"/>
  +    <fileset dir="${root.dir}/lib">
  +      <include name="*.jar"/>
  +    </fileset>
  +  </path>
  +
  +  <taskdef name="wsdl2java" classname="test.wsdl.Wsdl2javaAntTask">
  +      <classpath refid="test-classpath"/>
  +  </taskdef>
  +
  +  <target name="main">
  +    <property name="testname" value="compound1"/>
  +
  +    <!-- generate skeletons -->
  +    <wsdl2java url="http://www.whitemesa.net/wsdl/r3/${testname}.wsdl"
  +               output="${root.dir}/build/work" skeletonDeploy="yes"
  +               serverSide="yes"/>
  +
  +    <copy file="SoapInteropCompound1BindingImpl.java" overwrite="true"
  +          todir="${root.dir}/build/work/test/wsdl/interop3/${testname}"/>
  +
  +    <copy file="Compound1TestCase.java"
  +          todir="${root.dir}/build/work/test/wsdl/interop3/${testname}"/>
  +
  +    <!-- compile the skeletons -->
  +    <javac srcdir="${build.dir}/work" 
  +      destdir="${build.dest}" debug="on">
  +      <classpath refid="test-classpath" />
  +      <include name="test/wsdl/interop3/${testname}/*.java" />
  +    </javac>
  +  </target>
  +
  +</project>
  
  
  
  1.4       +87 -87    xml-axis/java/test/wsdl/interop3/compound2/Compound2TestCase.java
  
  Index: Compound2TestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/compound2/Compound2TestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Compound2TestCase.java	30 May 2002 03:06:15 -0000	1.3
  +++ Compound2TestCase.java	30 May 2002 23:46:03 -0000	1.4
  @@ -1,87 +1,87 @@
  -package test.wsdl.interop3.compound2;
  -
  -
  -import java.net.URL;
  -
  -import test.wsdl.interop3.compound2.xsd.Employee;
  -import test.wsdl.interop3.compound2.xsd.Person;
  -import test.wsdl.interop3.compound2.Compound2Locator;
  -import test.wsdl.interop3.compound2.SoapInteropCompound2PortType;
  -
  -/*
  -    <!-- SOAP Builder's round III web services          -->
  -    <!-- interoperability testing:  import1             -->
  -    <!-- (see http://www.whitemesa.net/r3/plan.html)    -->
  -    <!-- Step 1.  Start with predefined WSDL            -->
  -    <!-- Step 2.  Generate client from predefined WSDL  -->
  -    <!-- Step 3.  Test generated client against         -->
  -    <!--          pre-built server                      -->
  -    <!-- Step 4.  Generate server from predefined WSDL  -->
  -    <!-- Step 5.  Test generated client against         -->
  -    <!--          generated server                      -->
  -    <!-- Step 6.  Generate second client from           -->
  -    <!--          generated server's WSDL (some clients -->
  -    <!--          can do this dynamically)              -->
  -    <!-- Step 7.  Test second generated client against  -->
  -    <!--          generated server                      -->
  -    <!-- Step 8.  Test second generated client against  -->
  -    <!--          pre-built server                      -->
  -*/
  -
  -public class Compound2TestCase extends junit.framework.TestCase {
  -    static URL url;
  -
  -    public Compound2TestCase(String name) {
  -        super(name);
  -    }
  -
  -    protected void setUp() throws Exception {
  -    }
  -
  -    public void testStep3() {
  -        SoapInteropCompound2PortType binding;
  -        try {
  -            if (url != null) {
  -                binding = new Compound2Locator().getSoapInteropCompound2Port(url);
  -            } else {
  -                binding = new Compound2Locator().getSoapInteropCompound2Port();
  -            }
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
  -        }
  -        assertTrue("binding is null", binding != null);
  -
  -        try {
  -            Employee emp = new Employee();
  -            Person person = new Person();
  -            person.setMale(true);
  -            person.setName("Joe Blow");
  -            emp.setPerson(person);
  -            emp.setID(314159);
  -            emp.setSalary(100000.50);
  -            
  -            Employee result = binding.echoEmployee(emp);
  -
  -            assertTrue("Results did not match", result.equals(emp));
  -
  -        }
  -        catch (java.rmi.RemoteException re) {
  -            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
  -        }
  -    }
  -
  -
  -
  -    public static void main(String[] args) {
  -        if (args.length == 1) {
  -            try {
  -                url = new URL(args[0]);
  -            } catch (Exception e) {
  -            }
  -        }
  -
  -        junit.textui.TestRunner.run(new junit.framework.TestSuite(Compound2TestCase.class));
  -    } // main
  -}
  -
  +package test.wsdl.interop3.compound2;
  +
  +
  +import java.net.URL;
  +
  +import test.wsdl.interop3.compound2.xsd.Employee;
  +import test.wsdl.interop3.compound2.xsd.Person;
  +import test.wsdl.interop3.compound2.Compound2Locator;
  +import test.wsdl.interop3.compound2.SoapInteropCompound2PortType;
  +
  +/*
  +    <!-- SOAP Builder's round III web services          -->
  +    <!-- interoperability testing:  import1             -->
  +    <!-- (see http://www.whitemesa.net/r3/plan.html)    -->
  +    <!-- Step 1.  Start with predefined WSDL            -->
  +    <!-- Step 2.  Generate client from predefined WSDL  -->
  +    <!-- Step 3.  Test generated client against         -->
  +    <!--          pre-built server                      -->
  +    <!-- Step 4.  Generate server from predefined WSDL  -->
  +    <!-- Step 5.  Test generated client against         -->
  +    <!--          generated server                      -->
  +    <!-- Step 6.  Generate second client from           -->
  +    <!--          generated server's WSDL (some clients -->
  +    <!--          can do this dynamically)              -->
  +    <!-- Step 7.  Test second generated client against  -->
  +    <!--          generated server                      -->
  +    <!-- Step 8.  Test second generated client against  -->
  +    <!--          pre-built server                      -->
  +*/
  +
  +public class Compound2TestCase extends junit.framework.TestCase {
  +    static URL url;
  +
  +    public Compound2TestCase(String name) {
  +        super(name);
  +    }
  +
  +    protected void setUp() throws Exception {
  +    }
  +
  +    public void testStep3() {
  +        SoapInteropCompound2PortType binding;
  +        try {
  +            if (url != null) {
  +                binding = new Compound2Locator().getSoapInteropCompound2Port(url);
  +            } else {
  +                binding = new Compound2Locator().getSoapInteropCompound2Port();
  +            }
  +        }
  +        catch (javax.xml.rpc.ServiceException jre) {
  +            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
  +        }
  +        assertTrue("binding is null", binding != null);
  +
  +        try {
  +            Employee emp = new Employee();
  +            Person person = new Person();
  +            person.setMale(true);
  +            person.setName("Joe Blow");
  +            emp.setPerson(person);
  +            emp.setID(314159);
  +            emp.setSalary(100000.50);
  +            
  +            Employee result = binding.echoEmployee(emp);
  +
  +            assertTrue("Results did not match", result.equals(emp));
  +
  +        }
  +        catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
  +        }
  +    }
  +
  +
  +
  +    public static void main(String[] args) {
  +        if (args.length == 1) {
  +            try {
  +                url = new URL(args[0]);
  +            } catch (Exception e) {
  +            }
  +        }
  +
  +        junit.textui.TestRunner.run(new junit.framework.TestSuite(Compound2TestCase.class));
  +    } // main
  +}
  +
  
  
  
  1.6       +16 -16    xml-axis/java/test/wsdl/interop3/compound2/SoapInteropCompound2BindingImpl.java
  
  Index: SoapInteropCompound2BindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/compound2/SoapInteropCompound2BindingImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SoapInteropCompound2BindingImpl.java	30 May 2002 03:06:15 -0000	1.5
  +++ SoapInteropCompound2BindingImpl.java	30 May 2002 23:46:03 -0000	1.6
  @@ -1,16 +1,16 @@
  -/**
  - * SoapInteropCompound2BindingImpl.java
  - *
  - * This file was auto-generated from WSDL
  - * by the Apache Axis Wsdl2java emitter.
  - */
  -
  -package test.wsdl.interop3.compound2;
  -
  -
  -public class SoapInteropCompound2BindingImpl implements test.wsdl.interop3.compound2.SoapInteropCompound2PortType {
  -    public test.wsdl.interop3.compound2.xsd.Employee echoEmployee(test.wsdl.interop3.compound2.xsd.Employee xEmployee) throws java.rmi.RemoteException {
  -        return xEmployee;
  -    }
  -
  -}
  +/**
  + * SoapInteropCompound2BindingImpl.java
  + *
  + * This file was auto-generated from WSDL
  + * by the Apache Axis Wsdl2java emitter.
  + */
  +
  +package test.wsdl.interop3.compound2;
  +
  +
  +public class SoapInteropCompound2BindingImpl implements test.wsdl.interop3.compound2.SoapInteropCompound2PortType {
  +    public test.wsdl.interop3.compound2.xsd.Employee echoEmployee(test.wsdl.interop3.compound2.xsd.Employee xEmployee) throws java.rmi.RemoteException {
  +        return xEmployee;
  +    }
  +
  +}
  
  
  
  1.12      +39 -39    xml-axis/java/test/wsdl/interop3/compound2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/compound2/build.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- build.xml	30 May 2002 03:06:15 -0000	1.11
  +++ build.xml	30 May 2002 23:46:03 -0000	1.12
  @@ -1,39 +1,39 @@