axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robins...@apache.org
Subject svn commit: r584248 [3/4] - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/ kernel/conf/ kernel/src/org/apache/axis2/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/deployment/repository/util/ k...
Date Fri, 12 Oct 2007 19:55:02 GMT
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java?rev=584248&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java Fri Oct 12 12:53:43 2007
@@ -0,0 +1,1636 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl.util;
+
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.util.Counter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * There are cases where a WSDL definition is kept in memory
+ * in case it needs to be accessed during runtime.  In situations where 
+ * there are lots of WSDL definitions or big WSDLs, the memory footprint can be 
+ * huge.
+ *
+ * This class provides support for processing a WSDL4J definition
+ * with a lower memory footprint.  This is useful for certain
+ * environments.
+ *
+ * This class makes the decision on which implementation to use
+ * to reduce memory footprint.  This allows other implementations
+ * to be used for specific environments without adding lots of extra
+ * overhead to every environment.
+ *
+ */
+public class WSDLWrapperSaveImpl implements WSDLWrapperImpl {
+
+    private static final Log log = LogFactory.getLog(WSDLWrapperSaveImpl.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+    private static final String myClassName = "WSDLWrapperSaveImpl";
+
+    // javax.wsdl.Definition implements java.io.Serializable
+    static final long serialVersionUID = -2788807375814097409L;
+
+    // the wsdl4j wsdl definition object that is being wrapped
+    private Definition wsdlDefinition = null;
+
+    // the location of the base document used in the wsdl4j definition
+    private URL wsdlURL = null;
+    private String wsdlExplicitURI = null;
+    private String wsdlDocumentBaseURI = null;
+
+    // an object that maintains a synchronized counter
+    private Counter accessCount = null;
+
+    // serialization-related information ---------------------------
+    //
+    //   'safeToSerialize' indicates whether the wrapped WSDL definition object is
+    //                     safe to serialize.  This is set to false if the underlying
+    //                     WSDL4J's WSDL definition had an error when we tried to 
+    //                     serialize it.
+    // 
+    //   'hasBeenSaved'    indicates whether the wrapped WSDL definition object
+    //                     has been successfully saved
+    // 
+    //   'hasBeenUpdatedSinceSaving'  indicates whether the wrapped WSDL definition
+    //                     object has been updated since the last saved/serialziation
+    // 
+    // 
+    private boolean safeToSerialize = true;
+    private boolean hasBeenSaved = false;
+    private boolean hasBeenUpdatedSinceSaving = false;
+
+    private File savedDefinitionFile = null;
+    private String savedFilename = null;
+
+
+    /**
+     * Constructor
+     * 
+     * @param def    The WSDL Definition
+     */
+    public WSDLWrapperSaveImpl(Definition def) {
+        prepare(def, null);
+    }
+
+
+    /**
+     * Constructor
+     * 
+     * @param def    The WSDL Definition
+     * @param wURL   The URL for the wsdl
+     */
+    public WSDLWrapperSaveImpl(Definition def, URL wURL) {
+        prepare(def, wURL);
+    }
+
+
+
+    /**
+     * Initialize the wsdl definition wrapper
+     * 
+     * @param def    The WSDL4J definition
+     * @param wURL   The URL where the WSDL is obtained
+     */
+    private void prepare(Definition def, URL wURL) {
+        
+        wsdlDefinition = def;
+        wsdlURL = wURL;
+
+        accessCount = new Counter();
+
+        releaseResources();
+    }
+
+
+    //-------------------------------------------------------------------------
+    // public WSDLDefinitionWrapper methods
+    //-------------------------------------------------------------------------
+
+    /*
+     * Returns the WSDL4J Definition object that is being wrapped
+     */
+    public Definition getUnwrappedDefinition() {
+
+        getWrappedDefinitionForUse();
+
+        Definition def;
+
+        if ((wsdlDefinition != null) &&
+            (wsdlDefinition instanceof WSDLDefinitionWrapper)) {
+            def = ((WSDLDefinitionWrapper) wsdlDefinition).getUnwrappedDefinition();
+        } else {
+            def = wsdlDefinition;
+        }
+
+        return def;
+    }
+
+
+
+    /**
+     * Sets the WSDL4J Definition object that is being wrapped
+     *
+     * @param d  the WSDL4J Definition object
+     */
+    public void setDefinitionToWrap(Definition d) {
+        wsdlDefinition = d;
+    }
+
+
+    /**
+     * Sets the location for the WSDL4J Definition object that is being wrapped
+     */
+    public void setWSDLLocation(String uriLocation) {
+        if (uriLocation != null) {
+            try {
+                wsdlURL = new URL(uriLocation);
+            }
+            catch (Exception e) {
+                // todo
+            }
+        }
+    }
+
+
+    /**
+     * Gets the location for the WSDL4J Definition object that is being wrapped
+     */
+    public String getWSDLLocation() {
+        if (wsdlURL != null) {
+            return wsdlURL.toString();
+        }
+        else {
+            return null;
+        }
+    }
+
+
+    /**
+     * Closes the use of the wrapper implementation and allows 
+     * internal resources to be released.
+     */
+    public void close() {
+        // TODO release temporary files
+    }
+
+
+
+    //-------------------------------------------------------------------------
+    // javax.wsdl.Defintion interface methods
+    //-------------------------------------------------------------------------
+
+    public void setDocumentBaseURI(String d) {
+
+        // Set the URI of the base document for the Definition.
+        // This identifies the origin of the Definition.
+        // Note that this is the URI of the base document, not the imports.
+
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setDocumentBaseURI(" + d + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setDocumentBaseURI(d);
+        }
+
+        doneUsingWrappedDefinition();
+    }
+
+    public String getDocumentBaseURI() {
+
+        // Get the URI of the base document for the Definition.
+        // This identifies the origin of the Definition.
+        // Note that this is the URI of the base document, not the imports.
+
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getDocumentBaseURI()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        String results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getDocumentBaseURI();
+        }
+
+        doneUsingWrappedDefinition();
+
+        return results;
+    }
+
+    public void setQName(QName n) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setQName(" + n + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setQName(n);
+        }
+
+        doneUsingWrappedDefinition();
+    }
+
+    public QName getQName() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getQName()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        QName results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getQName();
+        }
+
+        doneUsingWrappedDefinition();
+
+        return results;
+    }
+
+    public void setTargetNamespace(String t) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setTargetNamespace(" + t + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setTargetNamespace(t);
+        }
+
+        doneUsingWrappedDefinition();
+    }
+
+    public String getTargetNamespace() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getTargetNamespace()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        String results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getTargetNamespace();
+        }
+
+        doneUsingWrappedDefinition();
+
+        return results;
+    }
+
+    public void addNamespace(String prefix, String namespaceURI) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addNamespace(" + prefix + ", " + namespaceURI + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addNamespace(prefix, namespaceURI);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public String removeNamespace(String prefix) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removeNamespace(" + prefix + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        String results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removeNamespace(prefix);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public String getNamespace(String prefix) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getNamespace(" + prefix + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        String results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getNamespace(prefix);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public String getPrefix(String namespaceURI) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getPrefix(" + namespaceURI + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        String results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getPrefix(namespaceURI);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getNamespaces() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getNamespaces()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getNamespaces();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public List getNativeAttributeNames() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getNativeAttributeNames()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        List results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getNativeAttributeNames();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void setTypes(Types types) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setTypes()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setTypes(types);
+        } 
+        doneUsingWrappedDefinition();
+    }
+
+
+    public Types getTypes() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getTypes()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Types results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getTypes();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void addImport(Import importDef) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addImport(" + importDef + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addImport(importDef);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public Import removeImport(Import importDef) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removeImport(" + importDef + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Import results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removeImport(importDef);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public List getImports(String namespaceURI) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getImports(" + namespaceURI + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        List results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getImports(namespaceURI);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getImports() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getImports()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getImports();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void addMessage(Message message) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addMessage(" + message + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addMessage(message);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public Message getMessage(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getMessage(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Message results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getMessage(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Message removeMessage(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removeMessage(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Message results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removeMessage(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getMessages() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getMessages()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getMessages();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void addBinding(Binding binding) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addBinding(" + binding + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addBinding(binding);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public Binding getBinding(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getBinding(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Binding results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getBinding(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Binding removeBinding(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removeBinding(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Binding results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removeBinding(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getBindings() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getBindings()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getBindings();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getAllBindings() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getAllBindings()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getAllBindings();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void addPortType(PortType portType) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addPortType(" + portType + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addPortType(portType);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public PortType getPortType(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getPortType(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        PortType results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getPortType(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public PortType removePortType(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removePortType(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        PortType results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removePortType(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getPortTypes() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getPortTypes()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getPortTypes();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getAllPortTypes() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getAllPortTypes()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getAllPortTypes();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void addService(Service service) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addService(" + service + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addService(service);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public Service getService(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getService(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Service results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getService(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Service removeService(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removeService(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Service results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removeService(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getServices() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getServices()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getServices();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getAllServices() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getAllServices()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getAllServices();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void setDocumentationElement(org.w3c.dom.Element docEl) {
+
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setDocumentationElement()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setDocumentationElement(docEl);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public org.w3c.dom.Element getDocumentationElement() {
+
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getDocumentationElement()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        org.w3c.dom.Element results = null;
+
+        if (wsdlDefinition != null) {
+            return  wsdlDefinition.getDocumentationElement();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void addExtensibilityElement(ExtensibilityElement extElement) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".addExtensibilityElement(" + extElement + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.addExtensibilityElement(extElement);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public List getExtensibilityElements() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getExtensibilityElements()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        List results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getExtensibilityElements();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Binding createBinding() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createBinding()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Binding results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createBinding();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public BindingFault createBindingFault() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createBindingFault()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        BindingFault results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createBindingFault();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public BindingInput createBindingInput() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createBindingInput()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        BindingInput results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createBindingInput();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public BindingOperation createBindingOperation() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createBindingOperation()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        BindingOperation results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createBindingOperation();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public BindingOutput createBindingOutput() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createBindingOutput()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        BindingOutput results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createBindingOutput();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Fault createFault() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createFault()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Fault results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createFault();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Import createImport() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createImport()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Import results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createImport();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Input createInput() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createInput()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Input results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createInput();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Message createMessage() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createMessage()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Message results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createMessage();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Operation createOperation() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createOperation()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Operation results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createOperation();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Output createOutput() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createOutput()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Output results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createOutput();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Part createPart() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createPart()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Part results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createPart();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Port createPort() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createPort()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Port results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createPort();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public PortType createPortType() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createPortType()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        PortType results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createPortType();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Service createService() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createService()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Service results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createService();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Types createTypes() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".createTypes()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Types results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.createTypes();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void setExtensionRegistry(ExtensionRegistry extReg) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setExtensionRegistry(" + extReg + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setExtensionRegistry(extReg);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    public ExtensionRegistry getExtensionRegistry() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getExtensionRegistry()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        ExtensionRegistry results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getExtensionRegistry();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public String toString() {
+        getWrappedDefinitionForUse();
+        String results = "";
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.toString();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    //-------------------------------------------------------------------------
+    // other AbstractWSDLElement methods
+    //-------------------------------------------------------------------------
+
+    public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".removeExtensibilityElement(" + extElement + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        ExtensibilityElement results = null;
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            results = wsdlDefinition.removeExtensibilityElement(extElement);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+
+    }
+
+    public java.lang.Object getExtensionAttribute(QName name) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getExtensionAttribute(" + name + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        java.lang.Object results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getExtensionAttribute(name);
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public Map getExtensionAttributes() {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".getExtensionAttributes()");
+        }
+
+        getWrappedDefinitionForUse();
+
+        Map results = null;
+
+        if (wsdlDefinition != null) {
+            results = wsdlDefinition.getExtensionAttributes();
+        }
+        doneUsingWrappedDefinition();
+        return results;
+    }
+
+    public void setExtensionAttribute(QName name, java.lang.Object value) {
+        if (isDebugEnabled) {
+            log.debug(myClassName + ".setExtensionAttribute(" + name + ",  " + value + ")");
+        }
+
+        getWrappedDefinitionForUse();
+
+        if (wsdlDefinition != null) {
+            if (hasBeenSaved) {
+                hasBeenUpdatedSinceSaving = true;
+            }
+            wsdlDefinition.setExtensionAttribute(name, value);
+        }
+        doneUsingWrappedDefinition();
+    }
+
+    //-------------------------------------------------------------------------
+    // private utility methods
+    //-------------------------------------------------------------------------
+
+
+    /**
+     * This is an internal utility to ensure that the
+     * WSDL definition being wrapped is available for 
+     * use.  
+     * <P>
+     * For example, if the WSDL4J WSDL definition object
+     * had been saved, this will reload it.
+     */
+    private void getWrappedDefinitionForUse() {
+        if (wsdlDefinition == null) {
+            loadResources();
+        }
+        if (wsdlDefinition != null) {
+            accessCount.incrementAndGet();
+        }
+    }
+
+
+    /**
+     * This is an internal utility to indicate that the
+     * use of WSDL definition has completed. 
+     */
+    private void doneUsingWrappedDefinition() {
+
+        long assessors = accessCount.decrementAndGet();
+
+        if (assessors == 0) {
+            releaseResources();
+        }
+    }
+
+
+    /*
+     * Reduces memory footprint of the in-memory caching of the WSDL definition
+     * based on the configuration settings
+     *
+     */
+    public void releaseResources() {
+
+        boolean saved = save();
+
+        if (saved) {
+            // release the in-memory copy of the WSDL4J 
+            wsdlDefinition = null;
+        }
+    }
+
+    /*
+     * Loads the the WSDL definition back into memory
+     */
+    public void loadResources() {
+
+        if (wsdlDefinition == null) {
+            wsdlDefinition = restore();
+        }
+    }
+
+
+    /**
+     * Saves the current WSDL definition object that this wrapper contains.
+     * This method has a number of checks to determine how to proceed with
+     * the saving of the WSDL definition object, so the caller should not
+     * need to make checks on whether to save or not.
+     * <P>
+     * The caller is responsible for handling the wrapped WSDL
+     * definition object, for example, deciding when to release
+     * it or reload it.
+     * 
+     * @return True - if the save succeeded
+     *         False - if the save failed
+     */
+    private boolean save() {
+
+        // if the wsdl definiton failed to serialize from a previous attempt
+        // to save it, then don't try to save it
+        if (safeToSerialize == false) {
+            // exit quickly
+            return false;
+        }
+
+        // at this point, we think it is safe to proceed with saving the 
+        // wsdl definition
+
+        // make sure there is a file to use for saving the wsdl definition
+        if (savedDefinitionFile == null) {
+            try {
+                savedDefinitionFile = File.createTempFile("wsdlDef_", null);
+                savedFilename = savedDefinitionFile.getName();
+                log.debug(myClassName + ".save(): temp file = [" + savedFilename + "]");
+            }
+            catch (Exception ex) {
+                log.debug(myClassName + ".save(): error creating temp file = [" + ex.getMessage() + "]");
+                savedDefinitionFile = null;
+                savedFilename = null;
+
+                // can't save the wsdl definition at this time
+                // might be able to do so later
+                hasBeenSaved = false;
+                return false;
+            }
+        }
+
+        if (savedDefinitionFile != null) {
+
+            // the File object exists, check to see if the wsdl definition has
+            // been previously saved
+
+            if (hasBeenSaved && !hasBeenUpdatedSinceSaving) {
+                // no need to save because we saved it already
+                // and there were no updates to the wsdl definition object
+                // since the previous save
+                return true;
+            }
+
+
+            // ---------------------------------------------------------
+            // save to the file
+            // ---------------------------------------------------------
+            FileOutputStream outStream = null;
+            ObjectOutputStream outObjStream = null;
+
+            try {
+                // setup an output stream to a physical file
+                outStream = new FileOutputStream(savedDefinitionFile);
+
+                // attach a stream capable of writing objects to the 
+                // stream connected to the file
+                outObjStream = new ObjectOutputStream(outStream);
+
+                // try to save the wsdl object
+                log.debug(myClassName + ".save(): saving the wsdl definition.....");
+                outObjStream.writeObject(wsdlDefinition);
+
+                // close out the streams
+                outObjStream.flush();
+                outObjStream.close();
+                outStream.flush();
+                outStream.close();
+
+                hasBeenSaved = true;
+                hasBeenUpdatedSinceSaving = false;
+
+                log.debug(myClassName + ".save(): ....saved the wsdl definition.....");
+
+                long filesize = savedDefinitionFile.length();
+                log.debug(myClassName + ".save(): file size after save [" + filesize +
+                        "]   temp file = [" + savedFilename + "]");
+
+                log.debug(myClassName + ".save(): end - - - - - - - - - - - - - - - -");
+                return true;
+
+            }
+            catch (Exception ex2) {
+                
+                // disable future tries at saving this WSDL definition object
+                safeToSerialize = false;
+
+                // indicate that the file cannot be used to restore from
+                hasBeenSaved = false;
+
+                log.debug(myClassName + ".save(): error with saving the wsdl definition = [" +
+                        ex2.getClass().getName() + " : " + ex2.getMessage() + "]", ex2);
+
+
+                if (savedDefinitionFile != null) {
+                    try {
+                        savedDefinitionFile.delete();
+                        savedDefinitionFile = null;
+                        savedFilename = null;
+                    }
+                    catch (Exception e) {
+                        // just absorb it
+                    }
+                }
+
+                if (outObjStream != null) {
+                    try {
+                        outObjStream.close();
+                    }
+                    catch (Exception e) {
+                        // just absorb it
+                    }
+                }
+
+                if (outStream != null) {
+                    try {
+                        outStream.close();
+                    }
+                    catch (Exception e) {
+                        // just absorb it
+                    }
+                }
+
+                log.debug(myClassName + ".save(): error exit - - - - - - - - - - - - - - - -");
+                return false;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Restores the WSDL definition from a previously saved copy.
+     * <P>
+     * The caller is responsible for handling the wrapped WSDL
+     * definition object, for example, deciding when to release
+     * it or reload it.
+     * 
+     * @return The restored WSDL definition object, or NULL
+     */
+    private Definition restore() {
+
+        if (!hasBeenSaved) {
+            // the wsdl defintion has not been saved, or the previous saved version
+            // should not be used for some reason
+            return null;
+        }
+
+        if (savedDefinitionFile == null) {
+            // no file to restore from
+            return null;
+        }
+
+        // ---------------------------------------------------------
+        // restore from the temporary file
+        // ---------------------------------------------------------
+        Definition restoredDefinition = null;
+        FileInputStream inStream = null;
+        ObjectInputStream inObjStream = null;
+
+        try {
+            // setup an input stream to the file
+            inStream = new FileInputStream(savedDefinitionFile);
+
+            // attach a stream capable of reading objects from the 
+            // stream connected to the file
+            inObjStream = new ObjectInputStream(inStream);
+
+            // try to restore the wrapped wsdl definition
+            log.debug(myClassName + ".restore(): restoring the WSDL definition .....");
+
+            restoredDefinition = (Definition) inObjStream.readObject();
+            inObjStream.close();
+            inStream.close();
+
+            log.debug(myClassName + ".restore(): ....restored the WSDL definition .....");
+
+        }
+        catch (Exception ex2) {
+            log.debug(myClassName + ".restore(): error with restoring the WSDL definition = [" +
+                    ex2.getClass().getName() + " : " + ex2.getMessage() + "]", ex2);
+
+            if (inObjStream != null) {
+                try {
+                    inObjStream.close();
+                }
+                catch (Exception e) {
+                    // just absorb it
+                }
+
+            }
+
+            if (inStream != null) {
+                try {
+                    inStream.close();
+                }
+                catch (Exception e) {
+                    // just absorb it
+                }
+            }
+        }
+
+
+        log.debug(myClassName + ".restore(): end - - - - - - - - - - - - - - - -");
+        return restoredDefinition;
+
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/axis2_a.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/axis2_a.xml?rev=584248&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/axis2_a.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/axis2_a.xml Fri Oct 12 12:53:43 2007
@@ -0,0 +1,231 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<axisconfig name="AxisJava2.0">
+    <parameter name="hotdeployment">true</parameter>
+    <parameter name="hotupdate">false</parameter>
+    <parameter name="enableMTOM">false</parameter>
+    <parameter name="enableSwA">false</parameter>
+
+    <!--Uncomment if you want to enable the reduction of the in-memory cache of WSDL definitions -->
+    <!--In some server environments, the available memory heap is limited and can fill up under load -->
+    <!--Since in-memory copies of WSDL definitions can be large, some steps can be taken-->
+    <!--to reduce the memory needed for the cached WSDL definitions. -->
+    <parameter name="reduceWSDLMemoryCache">true</parameter>
+    <parameter name="reduceWSDLMemoryType">1</parameter>
+                                                       
+    <!--This will give out the timout of the configuration contexts, in milliseconds-->
+    <parameter name="ConfigContextTimeoutInterval">30000</parameter>
+
+    <!--During a fault, stack trace can be sent with the fault message. The following flag will control -->
+    <!--that behavior.-->
+    <parameter name="sendStacktraceDetailsWithFaults">false</parameter>
+
+    <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
+    <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+    <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+    <!--is set, then Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+    <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
+
+    <parameter name="userName">admin</parameter>
+    <parameter name="password">axis2</parameter>
+
+    <!-- Following parameter will completely disable REST handling in Axis2-->
+    <parameter name="disableREST" locked="true">false</parameter>
+
+    <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
+    <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+    <deployer extension=".jsa" directory="rmiservices" class="org.apache.axis2.rmi.deploy.RMIServiceDeployer"/>
+    
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!--This is the deafult MessageReceiver for the system , if you want to have MessageReceivers for -->
+    <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+    <!--any operation -->
+    <!--Note : You can ovrride this for a particular service by adding the same element with your requirement-->
+     <messageReceivers>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </messageReceivers>
+
+    <!-- ================================================= -->
+    <!-- Message Formatter -->
+    <!-- ================================================= -->
+    <!--Following content type to message formatter mapping can be used to implement support for different message -->
+    <!--format  serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
+    <messageFormatters>
+        <messageFormatter contentType="application/x-www-form-urlencoded"
+                         class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+        <messageFormatter contentType="multipart/form-data"
+                         class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+        <messageFormatter contentType="application/xml"
+                         class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+    </messageFormatters>
+
+    <!-- ================================================= -->
+    <!-- Message Builders -->
+    <!-- ================================================= -->
+    <!--Following content type to builder mapping can be used to implement support for different message -->
+    <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
+    <messageBuilders>
+        <messageBuilder contentType="application/xml"
+                         class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+        <messageBuilder contentType="application/x-www-form-urlencoded"
+                         class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+        <messageBuilder contentType="multipart/form-data"
+                         class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
+    </messageBuilders>
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http"
+                       class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port">8080</parameter>
+        <!-- Here is the complete list of supported parameters (see example settings further below):
+            port: the port to listen on (default 6060)
+            hostname:  if non-null, url prefix used in reply-to endpoint references                                 (default null)
+            originServer:  value of http Server header in outgoing messages                                         (default "Simple-Server/1.1")
+            requestTimeout:  value in millis of time that requests can wait for data                                (default 20000)
+            requestTcpNoDelay:  true to maximize performance and minimize latency                                   (default true)
+                                false to minimize bandwidth consumption by combining segments
+            requestCoreThreadPoolSize:  number of threads available for request processing (unless queue fills up)  (default 25)
+            requestMaxThreadPoolSize:  number of threads available for request processing if queue fills up         (default 150)
+                                       note that default queue never fills up:  see HttpFactory
+            threadKeepAliveTime:  time to keep threads in excess of core size alive while inactive                  (default 180)
+                                  note that no such threads can exist with default unbounded request queue
+            threadKeepAliveTimeUnit:  TimeUnit of value in threadKeepAliveTime (default SECONDS)                    (default SECONDS)
+        -->
+        <!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
+        <!-- <parameter name="originServer">My-Server/1.1</parameter>           -->
+        <!-- <parameter name="requestTimeout">10000</parameter>                   -->
+        <!-- <parameter name="requestTcpNoDelay">false</parameter>                   -->
+        <!-- <parameter name="requestCoreThreadPoolSize">50</parameter>                      -->
+        <!-- <parameter name="RequestMaxThreadPoolSize">100</parameter>                     -->
+        <!-- <parameter name="threadKeepAliveTime">240000</parameter>                  -->
+        <!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter>            -->
+    </transportReceiver>
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <transportSender name="http"
+                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding">chunked</parameter>
+
+        <!-- If following is set to 'true', optional action part of the Content-Type will not be added to the SOAP 1.2 messages -->
+        <!--  <parameter name="OmitSOAP12Action">true</parameter>  -->
+    </transportSender>
+
+    <!-- ================================================= -->
+    <!-- Non-blocking http/s Transport Sender  -->
+
+    <!-- the non-blocking http transport sender based on HttpCore + NIO extensions
+    <transportSender name="http"  class="org.apache.axis2.transport.nhttp.HttpCoreNIOSender">
+        <parameter name="non-blocking" locked="false">true</parameter>
+    </transportSender>-->
+
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System predefined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+        </phase>
+        <!--  System predefined phases       -->
+        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
+        <phase name="OperationInPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+             <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                 <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+        </phase>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+
+</axisconfig>
+

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java?rev=584248&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java Fri Oct 12 12:53:43 2007
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.description;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.AbstractTestCase;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.ServiceBuilder;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.ModuleConfiguration;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
+
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.Types;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+public class WSDLWrapperTest extends TestCase {
+
+    private static final String JAVAX_WSDL_VERBOSE_MODE_KEY = "javax.wsdl.verbose";
+
+    //private Definition wsdlDef = null;
+    private WSDLLocator customWSLD4JResolver = null;
+    private String baseUri = null;
+
+    private AxisConfiguration axisCfg = null;
+
+    private String axis2xml = AbstractTestCase.basedir +
+                      "/target/test-resources/deployment/axis2_a.xml";
+
+    private String wsdl1 = AbstractTestCase.basedir + 
+                      "/target/test-resources/wsdl/actionTests.wsdl"; 
+
+    private String wsdl2 = AbstractTestCase.basedir + 
+                      "/target/test-resources/wsdl/test1.wsdl"; 
+
+    private String wsdl3 = AbstractTestCase.basedir + 
+                      "/target/test-resources/wsdl/test2.wsdl"; 
+
+
+
+    public WSDLWrapperTest(String name) {
+		super(name);
+    }
+
+
+    public void testWsdlWrapper() {
+        try {
+
+            //----------------------------------------------------------------
+            // load the wsdl
+            //----------------------------------------------------------------
+
+            Definition def1 = null;
+
+            File testResourceFile1 = new File(wsdl1);
+
+            if (testResourceFile1.exists()) {
+                try {
+                    System.out.println("WSDL file 1: " + testResourceFile1.getName());
+                    def1 = readInTheWSDLFile(new FileInputStream(testResourceFile1)); 
+                } 
+                catch (Exception e1) {
+                    System.out.println("Error in WSDL : " + testResourceFile1.getName());
+                    System.out.println("Exception: " + e1.toString());
+                    throw e1;
+                }
+            }
+
+            //wsdlDef = def1;
+            //System.out.println("-------------------------------------------------");
+            //System.out.println("wsdlDef 1 = [");
+            //System.out.println(wsdlDef);
+            //System.out.println("]");
+            //System.out.println("-------------------------------------------------");
+
+
+            //----------------------------------------------------------------
+            // setup the wrapper
+            //----------------------------------------------------------------
+
+            axisCfg = ConfigurationContextFactory
+                      .createConfigurationContextFromFileSystem(null, axis2xml)
+                      .getAxisConfiguration();
+
+            WSDLDefinitionWrapper passthru = new WSDLDefinitionWrapper(def1, testResourceFile1.toURL(), false);
+
+            Definition def_passthru = passthru.getUnwrappedDefinition();
+            String def_passthru_str = def_passthru.toString();
+            QName def_passthru_qn = def_passthru.getQName();
+            String def_passthru_namespace = def_passthru.getTargetNamespace();
+            Types def_passthru_types = def_passthru.getTypes();
+
+            WSDLDefinitionWrapper serialize = new WSDLDefinitionWrapper(def1, testResourceFile1.toURL(), axisCfg); 
+
+            Definition def_serialize = serialize.getUnwrappedDefinition();
+            String def_serialize_str = def_serialize.toString();
+            QName def_serialize_qn = def_serialize.getQName();
+            String def_serialize_namespace = def_serialize.getTargetNamespace();
+            Types def_serialize_types = def_serialize.getTypes();
+
+            WSDLDefinitionWrapper reload = new WSDLDefinitionWrapper(def1, testResourceFile1.toURL(), 2); 
+
+            Definition def_reload = reload.getUnwrappedDefinition();
+            String def_reload_str = def_reload.toString();
+            QName def_reload_qn = def_reload.getQName();
+            String def_reload_namespace = def_reload.getTargetNamespace();
+            Types def_reload_types = def_reload.getTypes();
+
+        }
+        catch (Exception exx) {
+            fail("This can not fail with this Exception " + exx);
+        }
+    }
+
+
+    private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
+
+        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+
+        // switch off the verbose mode for all usecases
+        reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);
+
+        // if the custem resolver is present then use it
+        if (customWSLD4JResolver != null) {
+            return reader.readWSDL(customWSLD4JResolver);
+        } 
+        else {
+            Document doc;
+            try {
+                doc = newDocument(in);
+            } 
+            catch (ParserConfigurationException e) {
+                throw new WSDLException(WSDLException.PARSER_ERROR,
+                                        "Parser Configuration Error", e);
+            } 
+            catch (SAXException e) {
+                throw new WSDLException(WSDLException.PARSER_ERROR,
+                                        "Parser SAX Error", e);
+
+            } 
+            catch (IOException e) {
+                throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error",
+                                        e);
+            }
+            return reader.readWSDL(getBaseUri(), doc);
+        }
+    }
+
+
+    public String getBaseUri() {
+        return baseUri;
+    }
+
+    public void setBaseUri(String baseUri) {
+        this.baseUri = baseUri;
+    }
+
+
+    private Document newDocument(InputStream inp)
+            throws ParserConfigurationException, SAXException, IOException {
+
+        DocumentBuilderFactory dbf = getDOMFactory();
+        DocumentBuilder db;
+
+        synchronized (dbf) {
+            try {
+                db = dbf.newDocumentBuilder();
+            }
+            catch (Exception e){
+                // Under some peculiar conditions (classloader issues), just scrap the old dbf, create a new one and try again.
+                dbf = getDOMFactory();
+                db = dbf.newDocumentBuilder();
+            }
+        }
+        db.setEntityResolver(new DefaultEntityResolver());
+        db.setErrorHandler(new ParserErrorHandler());
+        return (db.parse(inp));
+    }
+
+    private DocumentBuilderFactory getDOMFactory() {
+        DocumentBuilderFactory dbf;
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+        }
+        catch (Exception e) {
+            //log.error(Messages.getMessage("exception00"), e );
+            dbf = null;
+        }
+        return (dbf);
+    }
+
+
+
+    //------------------------------------------------------------------------
+    // internal class: ParserErrorHandler
+    //------------------------------------------------------------------------
+
+    public class ParserErrorHandler implements ErrorHandler {
+        /**
+         * Returns a string describing parse exception details
+         */
+        private String getParseExceptionInfo(SAXParseException spe) {
+            String systemId = spe.getSystemId();
+            if (systemId == null) {
+                systemId = "null";
+            }
+            return "URI=" + systemId +
+                    " Line=" + spe.getLineNumber() +
+                    ": " + spe.getMessage();
+        }
+
+        // The following methods are standard SAX ErrorHandler methods.
+        // See SAX documentation for more info.
+
+        public void warning(SAXParseException spe) throws SAXException {
+        }
+
+        public void error(SAXParseException spe) throws SAXException {
+            String message = "Error: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+
+        public void fatalError(SAXParseException spe) throws SAXException {
+            String message = "Fatal Error: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+    }
+
+    //------------------------------------------------------------------------
+    // internal class: DefaultEntityResolver
+    //------------------------------------------------------------------------
+
+    public class DefaultEntityResolver implements org.xml.sax.EntityResolver {
+
+        private String empty = "";
+        private ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
+
+        public DefaultEntityResolver() {
+        }
+
+        public InputSource resolveEntity(String publicId, String systemId) {
+
+            return new InputSource(bais);
+        }
+
+    }
+}

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=584248&r1=584247&r2=584248&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Fri Oct 12 12:53:43 2007
@@ -22,6 +22,11 @@
  */
 package org.apache.axis2.jaxws.description.builder;
 
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
 import javax.wsdl.Definition;
 import java.net.URL;
 import java.util.ArrayList;
@@ -31,6 +36,9 @@
 import java.util.Map;
 
 public class DescriptionBuilderComposite implements TMAnnotationComposite, TMFAnnotationComposite {
+
+    private static final Log log = LogFactory.getLog(DescriptionBuilderComposite.class);
+
     /*
       * This structure contains the full reflected class, as well as, the
       * possible annotations found for this class...the class description
@@ -57,6 +65,7 @@
     //Note: a WSDL is not necessary
     private Definition wsdlDefinition = null;
     private URL wsdlURL = null;
+    private WSDL4JWrapper wsdlWrapper = null;
 
     // Class-level annotations
     private WebServiceAnnot webServiceAnnot;
@@ -177,6 +186,13 @@
 
     /** @return Returns the wsdlDefinition */
     public Definition getWsdlDefinition() {
+        if (wsdlDefinition != null) {
+            return wsdlDefinition;
+        } else if (wsdlWrapper != null) {
+            wsdlDefinition = wsdlWrapper.getDefinition();
+        } else {
+            wsdlDefinition = createWsdlDefinition(wsdlURL);
+        }
         return wsdlDefinition;
     }
 
@@ -346,9 +362,45 @@
         return genericAnnotationInstances;
     }
 
-    /** @param wsdlDefinition The wsdlDefinition to set. */
-    public void setWsdlDefinition(Definition wsdlDefinition) {
-        this.wsdlDefinition = wsdlDefinition;
+
+    /**
+     * @param wsdlDefinition The wsdlDefinition to set.
+     */
+    public void setWsdlDefinition(Definition wsdlDef) {
+
+        Definition def = null;
+
+        if (wsdlDef != null) {
+            if (wsdlDef instanceof WSDL4JWrapper) {
+                wsdlWrapper = (WSDL4JWrapper) wsdlDef;
+
+                def = wsdlWrapper.getDefinition();
+            } else {
+                try {
+                    wsdlWrapper = new WSDL4JWrapper(wsdlDef);
+                    def = wsdlWrapper.getDefinition();
+                } catch (Exception ex) {
+                    // absorb
+                }
+            }
+
+            if (def != null) {
+                String wsdlDefinitionBaseURI = def.getDocumentBaseURI();
+
+                if ((wsdlDefinitionBaseURI != null) && (wsdlURL == null)) {
+                    try {
+                        wsdlURL = new URL(wsdlDefinitionBaseURI);
+                    } catch (Exception e) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("DescriptionBuilderComposite:setWsdlDefinition(): "
+                                    +"Caught exception creating WSDL URL :" 
+                                    + wsdlDefinitionBaseURI + "; exception: " 
+                                    +e.toString(),e); 
+                        }
+                    }
+                }
+            }
+        }
     }
 
     /** @param wsdlURL The wsdlURL to set. */
@@ -515,5 +567,35 @@
 		}
 		return sb.toString();
 	}
-	
+
+
+    /**
+     * Create a wsdl definition from the supplied 
+     * location.
+     * 
+     * @param _wsdlURL The URL where the wsdl is located
+     * @return The WSDL Definition or NULL
+     */
+    private Definition createWsdlDefinition(URL _wsdlURL) {
+        if (_wsdlURL == null) {
+            return null;
+        }
+
+        Definition wsdlDef = null;
+        try {
+            wsdlWrapper = new WSDL4JWrapper(_wsdlURL);
+            if (wsdlWrapper != null) {
+                wsdlDef = wsdlWrapper.getDefinition();
+            }
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug("DescriptionBuilderComposite:createWsdlDefinition("
+                        + _wsdlURL.toString()
+                        + "): Caught exception trying to create WSDL Definition: "
+                        +e, e); 
+            }
+        }
+
+        return wsdlDef;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=584248&r1=584247&r2=584248&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Fri Oct 12 12:53:43 2007
@@ -19,6 +19,7 @@
 package org.apache.axis2.jaxws.description.impl;
 
 import java.io.InputStream;
+import java.net.URL;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -74,6 +75,7 @@
 import org.apache.axis2.jaxws.util.ClassLoaderUtils;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
 import org.apache.axis2.jaxws.util.WSDLWrapper;
+import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -380,12 +382,31 @@
                 //We have a wsdl composite, so set these values for the generated wsdl
                 wsdlCompositeParameter.setValue(wsdlComposite);
                 wsdlLocationParameter.setValue(wsdlComposite.getWsdlFileName());
-                wsdlDefParameter.setValue(
-                        getServiceDescriptionImpl().getGeneratedWsdlWrapper().getDefinition());
+
+                Definition def =
+                        getServiceDescriptionImpl().getGeneratedWsdlWrapper().getDefinition();
+                URL wsdlUrl = getServiceDescriptionImpl().getGeneratedWsdlWrapper().getWSDLLocation();
+                if (def instanceof WSDLDefinitionWrapper) {
+                    wsdlDefParameter.setValue(def);
+                } else {
+                    WSDLDefinitionWrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl);
+                    wsdlDefParameter.setValue(wrap);
+                }
+
             } else if (getServiceDescriptionImpl().getWSDLWrapper() != null) {
                 //No wsdl composite because wsdl already exists
+
                 wsdlLocationParameter.setValue(getAnnoWebServiceWSDLLocation());
-                wsdlDefParameter.setValue(getServiceDescriptionImpl().getWSDLWrapper().getDefinition());
+
+                Definition def = getServiceDescriptionImpl().getWSDLWrapper().getDefinition();
+                URL wsdlUrl = getServiceDescriptionImpl().getWSDLWrapper().getWSDLLocation();
+                if (def instanceof WSDLDefinitionWrapper) {
+                    wsdlDefParameter.setValue(def);
+                } else {
+                    WSDLDefinitionWrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl);
+                    wsdlDefParameter.setValue(wrap);
+                }
+
             } else {
                 //There is no wsdl composite and there is NOT a wsdl definition
                 wsdlLocationParameter.setValue(null);
@@ -412,8 +433,15 @@
             wsdlLocationParameter.setName(MDQConstants.WSDL_LOCATION);
             if (getServiceDescriptionImpl().getWSDLWrapper() != null) {
                 wsdlLocationParameter.setValue(getAnnoWebServiceWSDLLocation());
-                wsdlDefParameter.setValue(getServiceDescriptionImpl().getWSDLWrapper()
-                    .getDefinition());
+
+                Definition def = getServiceDescriptionImpl().getWSDLWrapper().getDefinition();
+                URL wsdlUrl = getServiceDescriptionImpl().getWSDLWrapper().getWSDLLocation();
+                if (def instanceof WSDLDefinitionWrapper) {
+                    wsdlDefParameter.setValue(def);
+                } else {
+                    WSDLDefinitionWrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl);
+                    wsdlDefParameter.setValue(wrap);
+                }
             }
             // No WSDL supplied and we do not generate for non-SOAP 1.1/HTTP
             // endpoints
@@ -790,15 +818,15 @@
             // Note that the axis service builder takes only the localpart of the port qname.
             // TODO:: This should check that the namespace of the definition matches the namespace of the portQName per JAXRPC spec
 
-            WSDLWrapper wrapper = getServiceDescriptionImpl().getWSDLWrapper();
+            Definition def = getServiceDescriptionImpl().getWSDLWrapper().getUnwrappedDefinition();
+
             WSDL11ToAxisServiceBuilder serviceBuilder =
-                    new WSDL11ToAxisServiceBuilder(
-                            wrapper.getDefinition(),
+                    new WSDL11ToAxisServiceBuilder(def,
                             getServiceDescription().getServiceQName(),
                             getPortQName().getLocalPart());
 
             //TODO: Temporary, please change the following log.info to log.debug
-            log.info("Building AxisService from wsdl: " + wrapper.getWSDLLocation());
+            log.info("Building AxisService from wsdl: " + getServiceDescriptionImpl().getWSDLWrapper().getWSDLLocation());
             
             if (getServiceDescriptionImpl().isDBCMap()) {
                 //this.class.getClass().getClassLoader();



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message