Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
 Sun Dec 17 22:34:08 2017
@@ -25,7 +25,6 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.classloader.JarFileClassLoader;
 import org.apache.axis2.Constants;
 import org.apache.axis2.jaxrs.JAXRSModel;
 import org.apache.axis2.context.ConfigurationContext;
@@ -152,27 +151,31 @@ public class Utils {
     }
 
     public static URL[] getURLsForAllJars(URL url, File tmpDir) {
-        FileInputStream fin = null;
         InputStream in = null;
         ZipInputStream zin = null;
         try {
-            ArrayList array = new ArrayList();
+            ArrayList<URL> array = new ArrayList<URL>();
             in = url.openStream();
-            String fileName = url.getFile();
-            int index = fileName.lastIndexOf('/');
-            if (index != -1) {
-                fileName = fileName.substring(index + 1);
+            if (url.getProtocol().equals("file")) {
+                array.add(url);
+            } else {
+                String fileName = url.getFile();
+                int index = fileName.lastIndexOf('/');
+                if (index != -1) {
+                    fileName = fileName.substring(index + 1);
+                }
+                final File f = createTempFile(fileName, in, tmpDir);
+                in.close();
+
+                in = org.apache.axis2.java.security.AccessController
+                        .doPrivileged(new 
PrivilegedExceptionAction<InputStream>() {
+                            public InputStream run() throws 
FileNotFoundException {
+                                return new FileInputStream(f);
+                            }
+                        });
+                array.add(f.toURI().toURL());
             }
-            final File f = createTempFile(fileName, in, tmpDir);
-
-            fin = 
(FileInputStream)org.apache.axis2.java.security.AccessController
-                    .doPrivileged(new PrivilegedExceptionAction() {
-                        public Object run() throws FileNotFoundException {
-                            return new FileInputStream(f);
-                        }
-                    });
-            array.add(f.toURI().toURL());
-            zin = new ZipInputStream(fin);
+            zin = new ZipInputStream(in);
 
             ZipEntry entry;
             String entryName;
@@ -190,17 +193,10 @@ public class Utils {
                     array.add(f2.toURI().toURL());
                 }
             }
-            return (URL[])array.toArray(new URL[array.size()]);
+            return array.toArray(new URL[array.size()]);
         } catch (Exception e) {
             throw new RuntimeException(e);
         } finally {
-            if (fin != null) {
-                try {
-                    fin.close();
-                } catch (IOException e) {
-                    //
-                }
-            }
             if (in != null) {
                 try {
                     in.close();
@@ -321,13 +317,11 @@ public class Utils {
      */
     public static ClassLoader getClassLoader(final ClassLoader parent, File 
file, final boolean isChildFirstClassLoading)
             throws DeploymentException {
-        URLClassLoader classLoader;
-
         if (file == null)
             return null; // Shouldn't this just return the parent?
 
         try {
-            ArrayList urls = new ArrayList();
+            ArrayList<URL> urls = new ArrayList<URL>();
             urls.add(file.toURI().toURL());
 
             // lower case directory name
@@ -340,51 +334,30 @@ public class Utils {
 
             final URL urllist[] = new URL[urls.size()];
             for (int i = 0; i < urls.size(); i++) {
-                urllist[i] = (URL)urls.get(i);
+                urllist[i] = urls.get(i);
             }
-            classLoader = (URLClassLoader)AccessController
-                    .doPrivileged(new PrivilegedAction() {
-                        public Object run() {
-                            if (useJarFileClassLoader()) {
-                                return new JarFileClassLoader(urllist, parent);
-                            } else {
-                                return new DeploymentClassLoader(urllist, 
null, parent, isChildFirstClassLoading);
-                            }
-                        }
-                    });
-            return classLoader;
+            if (log.isDebugEnabled()) {
+                log.debug("Creating class loader with the following libraries: 
" + Arrays.asList(urllist));
+            }
+            return createDeploymentClassLoader(urllist, parent, 
isChildFirstClassLoading);
         } catch (MalformedURLException e) {
             throw new DeploymentException(e);
         }
     }
 
-    private static boolean useJarFileClassLoader() {
-        // The JarFileClassLoader was created to address a locking problem 
seen only on Windows platforms.
-        // It carries with it a slight performance penalty that needs to be 
addressed.  Rather than make
-        // *nix OSes carry this burden we'll engage the JarFileClassLoader for 
Windows or if the user 
-        // specifically requests it.
-        boolean useJarFileClassLoader;
-        if 
(System.getProperty("org.apache.axis2.classloader.JarFileClassLoader") == null) 
{
-            useJarFileClassLoader = 
System.getProperty("os.name").startsWith("Windows");
-        } else {
-            useJarFileClassLoader = 
Boolean.getBoolean("org.apache.axis2.classloader.JarFileClassLoader");
-        }
-        return useJarFileClassLoader;
-    }
-
-    private static boolean addFiles(ArrayList urls, final File libfiles)
+    private static boolean addFiles(ArrayList<URL> urls, final File libfiles)
             throws MalformedURLException {
-        Boolean exists = 
(Boolean)org.apache.axis2.java.security.AccessController
-                .doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+        Boolean exists = org.apache.axis2.java.security.AccessController
+                .doPrivileged(new PrivilegedAction<Boolean>() {
+                    public Boolean run() {
                         return libfiles.exists();
                     }
                 });
         if (exists) {
             urls.add(libfiles.toURI().toURL());
-            File jarfiles[] = 
(File[])org.apache.axis2.java.security.AccessController
-                    .doPrivileged(new PrivilegedAction() {
-                        public Object run() {
+            File jarfiles[] = org.apache.axis2.java.security.AccessController
+                    .doPrivileged(new PrivilegedAction<File[]>() {
+                        public File[] run() {
                             return libfiles.listFiles();
                         }
                     });
@@ -744,38 +717,6 @@ public class Utils {
     }
 
     /**
-     * Get names of all *.jar files inside the lib/ directory of a given jar 
URL
-     *
-     * @param url base URL of a JAR to search
-     * @return a List containing file names (Strings) of all files matching 
"[lL]ib/*.jar"
-     */
-    public static List findLibJars(URL url) {
-        ArrayList embedded_jars = new ArrayList();
-        try {
-            ZipInputStream zin = new ZipInputStream(url.openStream());
-            ZipEntry entry;
-            String entryName;
-            while ((entry = zin.getNextEntry()) != null) {
-                entryName = entry.getName();
-                /**
-                 * if the entry name start with /lib and ends with .jar add it
-                 * to the the arraylist
-                 */
-                if (entryName != null
-                    && (entryName.startsWith("lib/") || entryName
-                        .startsWith("Lib/"))
-                    && entryName.endsWith(".jar")) {
-                    embedded_jars.add(entryName);
-                }
-            }
-            zin.close();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-        return embedded_jars;
-    }
-
-    /**
      * Add the Axis2 lifecycle / session methods to a pre-existing list of 
names that will be
      * excluded when generating schemas.
      *
@@ -799,35 +740,7 @@ public class Utils {
                             }
                         });
         return createDeploymentClassLoader(new 
URL[]{serviceFile.toURI().toURL()},
-                                           contextClassLoader, new 
ArrayList(), isChildFirstClassLoading);
-    }
-
-    public static ClassLoader createClassLoader(ArrayList urls,
-                                                ClassLoader serviceClassLoader,
-                                                boolean extractJars,
-                                                File tmpDir,
-                                                boolean 
isChildFirstClassLoading) {
-        URL url = (URL)urls.get(0);
-        if (extractJars) {
-            try {
-                URL[] urls1 = Utils.getURLsForAllJars(url, tmpDir);
-                urls.remove(0);
-                urls.addAll(0, Arrays.asList(urls1));
-                URL[] urls2 = (URL[])urls.toArray(new URL[urls.size()]);
-                return createDeploymentClassLoader(urls2, serviceClassLoader,
-                                                   null, 
isChildFirstClassLoading);
-            } catch (Exception e) {
-                log
-                        .warn("Exception extracting jars into temporary 
directory : "
-                              + e.getMessage()
-                              + " : switching to alternate class loading 
mechanism");
-                log.debug(e.getMessage(), e);
-            }
-        }
-        List embedded_jars = Utils.findLibJars(url);
-        URL[] urls2 = (URL[])urls.toArray(new URL[urls.size()]);
-        return createDeploymentClassLoader(urls2, serviceClassLoader,
-                                           embedded_jars, 
isChildFirstClassLoading);
+                                           contextClassLoader, 
isChildFirstClassLoading);
     }
 
     public static File toFile(URL url) throws UnsupportedEncodingException {
@@ -835,36 +748,26 @@ public class Utils {
         return new File(path.replace('/', File.separatorChar).replace('|', 
':'));
     }
 
-    public static ClassLoader createClassLoader(URL[] urls,
+    public static ClassLoader createClassLoader(URL archiveUrl, URL[] 
extraUrls,
                                                 ClassLoader serviceClassLoader,
-                                                boolean extractJars,
                                                 File tmpDir,
                                                 boolean 
isChildFirstClassLoading) {
-        if (extractJars) {
-            try {
-                URL[] urls1 = Utils.getURLsForAllJars(urls[0], tmpDir);
-                return createDeploymentClassLoader(urls1, serviceClassLoader,
-                                                   null, 
isChildFirstClassLoading);
-            } catch (Exception e) {
-                log
-                        .warn("Exception extracting jars into temporary 
directory : "
-                              + e.getMessage()
-                              + " : switching to alternate class loading 
mechanism");
-                log.debug(e.getMessage(), e);
-            }
+        List<URL> urls = new ArrayList<>();
+        urls.addAll(Arrays.asList(Utils.getURLsForAllJars(archiveUrl, 
tmpDir)));
+        if (extraUrls != null) {
+            urls.addAll(Arrays.asList(extraUrls));
         }
-        List embedded_jars = Utils.findLibJars(urls[0]);
-        return createDeploymentClassLoader(urls, serviceClassLoader,
-                                           embedded_jars, 
isChildFirstClassLoading);
+        return createDeploymentClassLoader(urls.toArray(new URL[urls.size()]), 
serviceClassLoader,
+                                           isChildFirstClassLoading);
     }
 
     private static DeploymentClassLoader createDeploymentClassLoader(
             final URL[] urls, final ClassLoader serviceClassLoader,
-            final List embeddedJars, final boolean isChildFirstClassLoading) {
-        return (DeploymentClassLoader)AccessController
-                .doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return new DeploymentClassLoader(urls, embeddedJars,
+            final boolean isChildFirstClassLoading) {
+        return AccessController
+                .doPrivileged(new PrivilegedAction<DeploymentClassLoader>() {
+                    public DeploymentClassLoader run() {
+                        return new DeploymentClassLoader(urls,
                                                          serviceClassLoader, 
isChildFirstClassLoading);
                     }
                 });
@@ -883,11 +786,11 @@ public class Utils {
         if (excludeBeanProperty != null) {
             OMElement parameterElement = excludeBeanProperty
                     .getParameterElement();
-            Iterator bneasItr = parameterElement.getChildrenWithName(new QName(
+            Iterator<OMElement> bneasItr = 
parameterElement.getChildrenWithName(new QName(
                     "bean"));
             ExcludeInfo excludeInfo = new ExcludeInfo();
             while (bneasItr.hasNext()) {
-                OMElement bean = (OMElement)bneasItr.next();
+                OMElement bean = bneasItr.next();
                 String clazz = bean.getAttributeValue(new QName(
                         DeploymentConstants.TAG_CLASS_NAME));
                 String excludePropertees = bean.getAttributeValue(new QName(
@@ -1269,10 +1172,10 @@ public class Utils {
                 policyComponents.add(policyRef);
             }
 
-            for (Iterator policySubjects = appliesToElem
+            for (Iterator<OMElement> policySubjects = appliesToElem
                     .getChildrenWithName(new QName("policy-subject")); 
policySubjects
                     .hasNext();) {
-                OMElement policySubject = (OMElement)policySubjects.next();
+                OMElement policySubject = policySubjects.next();
                 String identifier = policySubject.getAttributeValue(new QName(
                         "identifier"));
 

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService.java
 Sun Dec 17 22:34:08 2017
@@ -64,6 +64,7 @@ import org.apache.axis2.util.LoggingCont
 import org.apache.axis2.util.XMLPrettyPrinter;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.wsdl.WSDLUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.neethi.Policy;
@@ -2387,7 +2388,7 @@ public class AxisService extends AxisDes
             Document doc = XMLUtils.newDocument(in);
             String namespaceURI = doc.getDocumentElement().getNamespaceURI();
             if (Constants.NS_URI_WSDL11.equals(namespaceURI)) {
-                WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+               WSDLReader reader = 
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
                 reader.setFeature("javax.wsdl.importDocuments", true);
                 Definition wsdlDefinition = 
reader.readWSDL(getBaseURI(wsdlURL.toString()), doc);
                 if (wsdlDefinition != null) {

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
 Sun Dec 17 22:34:08 2017
@@ -676,7 +676,7 @@ public class AxisService2WSDL11 implemen
                                        
WSDLSerializationUtil.addExtensionElement(fac, port,
                                                        SOAP_ADDRESS, LOCATION, 
(endpointURL == null) ? ""
                                                                        : 
endpointURL, soap);
-                                       generateEPRElement(fac, port, 
endpointURL);
+                                       generateEPRElement(axisEndpoint, fac, 
port, endpointURL);
                                        addPolicyAsExtElement(axisEndpoint, 
port);
                                        service.addChild(modifyPort(port));
                                        if (isAlreadyAdded(axisBinding, 
definition)) {
@@ -726,7 +726,7 @@ public class AxisService2WSDL11 implemen
                                        
WSDLSerializationUtil.addExtensionElement(fac, port,
                                                        SOAP_ADDRESS, LOCATION, 
(endpointURL == null) ? ""
                                                                        : 
endpointURL, soap12);
-                                       generateEPRElement(fac, port, 
endpointURL);
+                                       generateEPRElement(axisEndpoint, fac, 
port, endpointURL);
                                        addPolicyAsExtElement(axisEndpoint, 
port);
                                        service.addChild(modifyPort(port));
                                        if (isAlreadyAdded(axisBinding, 
definition)) {
@@ -1310,10 +1310,10 @@ public class AxisService2WSDL11 implemen
                        OMElement definitionElement) {
                QName bindingName = axisBinding.getName();
                QName name = new QName("name");
-               for (Iterator iterator = definitionElement
+               for (Iterator<OMElement> iterator = definitionElement
                                .getChildrenWithName(new 
QName(wsdl.getNamespaceURI(),
                                                BINDING_LOCAL_NAME)); 
iterator.hasNext();) {
-                       OMElement element = (OMElement) iterator.next();
+                       OMElement element = iterator.next();
                        String value = element.getAttributeValue(name);
                        if (bindingName.getLocalPart().equals(value)) {
                                return true;
@@ -1351,27 +1351,61 @@ public class AxisService2WSDL11 implemen
             }
        }
        
-       /**
-        * Generate the Identity element according to the 
WS-AddressingAndIdentity if the 
-        * AddressingConstants.IDENTITY_PARAMETER parameter is set. 
-        * http://schemas.xmlsoap.org/ws/2006/02/addressingidentity/ 
-        */
-       
-       private void generateIdentityElement(OMFactory fac,OMElement epr, 
Parameter wsaIdParam) {
-           
-           // Create the Identity element
-           OMElement identity = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY);
-           OMElement keyInfo = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY_KEY_INFO);
-           OMElement x509Data = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY_X509_DATA);
-           OMElement x509cert = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY_X509_CERT);
-           x509cert.setText((String)wsaIdParam.getValue());
-           
-           x509Data.addChild(x509cert);
-           keyInfo.addChild(x509Data);
-           identity.addChild(keyInfo);
-           
-           epr.addChild(identity);
-           
+    /**
+     * Generate a &lt;wsid:Identity&gt; element according to the <a
+     * 
href="http://www.oasis-open.org/committees/download.php/29516/ws-addressingandidentity.doc";
+     * >WS-AddressingAndIdentity specification</a> and add it as a child of 
the given
+     * <code>epr</code> &lt;wsa:EndpointReference&gt; element.
+     * <p>
+     * If none of the <code>identityParameter</code> and 
<code>x509CertIdentityParameter</code>
+     * configures a valid value, this method will skip creating and adding an 
identity element.
+     * </p>
+     * 
+     * @param fac
+     *            A factory to use for creating OMElements.
+     * @param epr
+     *            The endpoint reference element to add the generated identity 
element to. Must not
+     *            be <code>null</code>.
+     * @param identity
+     *            An optional &lt;wsid:Identity&gt; OMElement to clone and 
use, instead of
+     *            generating a new one.
+     * @param x509CertIdentityParameter
+     *            An optional parameter that may contain a 
&lt;ds:X509Certificate&gt; String literal
+     *            value to set as key info in the created identity element.
+     */
+    private void generateIdentityElement(OMFactory fac, OMElement epr, 
OMElement identity, Parameter x509CertIdentityParameter) {
+        if (identity != null) {
+            identity = identity.cloneOMElement();
+            epr.addChild(identity);
+        }
+            
+        if (x509CertIdentityParameter != null && 
x509CertIdentityParameter.getValue() != null) {
+            if (identity == null) {
+                identity = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY);
+                epr.addChild(identity);
+            }
+            
+            OMElement keyInfo = 
identity.getFirstChildWithName(AddressingConstants.QNAME_IDENTITY_KEY_INFO);
+            if (keyInfo == null) {
+                keyInfo = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY_KEY_INFO);
+                identity.addChild(keyInfo);
+            }
+            
+            OMElement x509Data = 
keyInfo.getFirstChildWithName(AddressingConstants.QNAME_IDENTITY_X509_DATA);
+            if (x509Data == null) {
+                x509Data = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY_X509_DATA);
+                keyInfo.addChild(x509Data);
+            }
+            
+            OMElement x509cert = 
x509Data.getFirstChildWithName(AddressingConstants.QNAME_IDENTITY_X509_CERT);
+            if (x509cert == null) {
+                x509cert = 
fac.createOMElement(AddressingConstants.QNAME_IDENTITY_X509_CERT);
+                x509Data.addChild(x509cert);
+            }
+            
+            String x509CertValue = (String) 
x509CertIdentityParameter.getValue();
+            x509cert.setText(x509CertValue);
+        }
        }
        
        
@@ -1384,12 +1418,15 @@ public class AxisService2WSDL11 implemen
          * </wsa:EndpointReference>
         * 
         */
-       private void generateEPRElement(OMFactory fac, OMElement port, String 
endpointURL){
+       private void generateEPRElement(AxisEndpoint endpoint, OMFactory fac, 
OMElement port, String endpointURL){
+           //an optional String parameter that contains x509 certificate 
information 
+           Parameter x509CertIdentityParameter = 
axisService.getParameter(AddressingConstants.IDENTITY_PARAMETER);
            
-           Parameter parameter = 
axisService.getParameter(AddressingConstants.IDENTITY_PARAMETER);
-                   
-           // If the parameter is not set, return
-           if (parameter == null || parameter.getValue() == null) {
+           //an optional OMElement parameter that represents an 
<wsid:Identity> element
+           OMElement identityElement = 
AddressingHelper.getAddressingIdentityParameterValue(endpoint);
+
+           if ((x509CertIdentityParameter == null || 
x509CertIdentityParameter.getValue() == null) && identityElement == null) {
+               //none of these is configured, for backward compatibility do 
not generate anything and return
                return;
            }
            
@@ -1401,7 +1438,7 @@ public class AxisService2WSDL11 implemen
            wsaEpr.addChild(address);
            
            // This will generate the identity element if the service parameter 
is set
-           generateIdentityElement(fac, wsaEpr, parameter);
+           generateIdentityElement(fac, wsaEpr, identityElement, 
x509CertIdentityParameter);
            
            port.addChild(wsaEpr);   
            

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java
 Sun Dec 17 22:34:08 2017
@@ -38,13 +38,9 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
-
 
 /**
  * Class ParameterIncludeImpl
@@ -88,15 +84,13 @@ public class ParameterIncludeImpl
     /**
      * Field parmeters
      */
-    protected Map<String, Parameter> parameters;
+    private final HashMap<String, Parameter> parameters;
 
     /**
      * Constructor ParameterIncludeImpl.
      */
     public ParameterIncludeImpl() {
-        // Use a capacity large enough to prevent
-        // resizing
-        parameters = new HashMap<String, Parameter>(64);
+        parameters = new HashMap<String, Parameter>();
     }
 
     /**
@@ -108,26 +102,6 @@ public class ParameterIncludeImpl
         if (param != null) {
             synchronized (parameters) {
                 parameters.put(param.getName(), param);
-                try {
-                    parameters.put(param.getName(), param);
-                } catch (ConcurrentModificationException cme) {
-                    // The ParameteterIncludeImpl is supposed to be immutable 
after it is populated.
-                    // But alas, sometimes the callers forget and try to add 
new items.  If
-                    // this occurs, swap over to the slower ConcurrentHashMap 
and continue.
-                    if (log.isDebugEnabled()) {
-                        log.debug("ConcurrentModificationException 
Occured...changing to ConcurrentHashMap");
-                        log.debug("The exception is: " + cme);
-                    }
-
-                    Map newMap = new ConcurrentHashMap(parameters);
-                    newMap.put(param.getName(), param);
-                    parameters = newMap;
-                }
-
-                if (DEBUG_ENABLED) {
-                    this.debugParameterAdd(param);
-                }
-
             }
             
             if (DEBUG_ENABLED) {
@@ -138,22 +112,8 @@ public class ParameterIncludeImpl
 
     public void removeParameter(Parameter param) throws AxisFault {
         synchronized (parameters) {
-            try {
-                parameters.remove(param.getName());
-            } catch (ConcurrentModificationException cme) {
-                // The ParameteterIncludeImpl is supposed to be immutable 
after it is populated.
-                // But alas, sometimes the callers forget and try to add new 
items.  If
-                // this occurs, swap over to the slower ConcurrentHashMap and 
continue.
-                if (log.isDebugEnabled()) {
-                    log.debug("ConcurrentModificationException 
Occured...changing to ConcurrentHashMap");
-                    log.debug("The exception is: " + cme);
-                }
-
-                Map newMap = new ConcurrentHashMap(parameters);
-                newMap.remove(param.getName());
-                parameters = newMap;
-            }
-        } 
+            parameters.remove(param.getName());
+        }
     }
 
     /**
@@ -164,13 +124,13 @@ public class ParameterIncludeImpl
      * @throws AxisFault
      */
     public void deserializeParameters(OMElement parameters) throws AxisFault {
-        Iterator iterator =
+        Iterator<OMElement> iterator =
                 parameters.getChildrenWithName(new 
QName(DeploymentConstants.TAG_PARAMETER));
 
         while (iterator.hasNext()) {
 
             // this is to check whether some one has locked the parmeter at 
the top level
-            OMElement parameterElement = (OMElement) iterator.next();
+            OMElement parameterElement = iterator.next();
             Parameter parameter = new Parameter();
 
             // setting parameterElement
@@ -220,11 +180,13 @@ public class ParameterIncludeImpl
      * @return Returns parameter.
      */
     public Parameter getParameter(String name) {
-        return parameters.get(name);
+        synchronized (parameters) {
+            return parameters.get(name);
+        }
     }
 
     public ArrayList<Parameter> getParameters() {
-        synchronized(parameters) {
+        synchronized (parameters) {
             return new ArrayList<Parameter>(parameters.values());
         }
     }

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
 Sun Dec 17 22:34:08 2017
@@ -91,7 +91,6 @@ import javax.wsdl.extensions.soap12.SOAP
 import javax.wsdl.extensions.soap12.SOAP12Body;
 import javax.wsdl.extensions.soap12.SOAP12Header;
 import javax.wsdl.extensions.soap12.SOAP12Operation;
-import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLLocator;
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
@@ -333,10 +332,16 @@ public class WSDL11ToAxisServiceBuilder
             Binding binding = findBinding(wsdl4jDefinition, wsdl4jService);
             Definition bindingWSDL = getParentDefinition(wsdl4jDefinition,
                     binding.getQName(), COMPONENT_BINDING, new HashSet());
-            Definition portTypeWSDL = getParentDefinition(bindingWSDL,
-                    binding.getPortType().getQName(), COMPONENT_PORT_TYPE, new 
HashSet());
-            PortType portType = 
portTypeWSDL.getPortType(binding.getPortType().getQName());
-
+            
+            //do not search for wsdl where port type is defined, this search 
is depth-first
+            //and might lead to a wsdl where the port is only referenced but 
undefined
+            //instead look up the port type in the wsdl and only if not found 
fall back to binding's port type
+            PortType portType = 
wsdl4jDefinition.getPortType(binding.getPortType().getQName());
+            if (portType == null) {
+                //TODO in case of recursive imports, binding's port type will 
contain operations with null input message 
+                //requires fix for http://sourceforge.net/p/wsdl4j/bugs/39
+                portType = binding.getPortType();
+            }
 
             if (portType == null) {
                 throw new AxisFault("There is no port type associated with the 
binding");
@@ -362,7 +367,7 @@ public class WSDL11ToAxisServiceBuilder
             addDocumentation(axisService, documentationElement);
 
             axisService.setName(wsdl4jService.getQName().getLocalPart());
-            populateEndpoints(binding, bindingWSDL,wsdl4jService, portType, 
portTypeWSDL);
+            populateEndpoints(binding, bindingWSDL,wsdl4jService, portType);
             processPoliciesInDefintion(wsdl4jDefinition);
             axisService.getPolicyInclude().setPolicyRegistry(registry);
 
@@ -458,8 +463,7 @@ public class WSDL11ToAxisServiceBuilder
     private void populateEndpoints(Binding binding,
                                    Definition bindingWSDL,
                                    Service wsdl4jService,
-                                   PortType portType,
-                                   Definition portTypeWSDL) throws AxisFault {
+                                   PortType portType) throws AxisFault {
 
         Map wsdl4jPorts = wsdl4jService.getPorts();
         QName bindingName = binding.getQName();
@@ -472,7 +476,7 @@ public class WSDL11ToAxisServiceBuilder
         // process the port type for this binding
         // although we support multiports they must be belongs to same port 
type and should have the
         // same soap style
-        populatePortType(portType, portTypeWSDL);
+        populatePortType(portType);
 
         Binding currentBinding;
         Definition currentBindingWSDL = null;
@@ -493,12 +497,12 @@ public class WSDL11ToAxisServiceBuilder
                     if (axisService.getEndpointName() == null &&
                             bindingName.equals(port.getBinding().getQName())) {
                         populateEndpoint(axisEndpoint, port, currentBinding,
-                                bindingWSDL, portType, portTypeWSDL, true);
+                                bindingWSDL, portType, true);
                         axisService.setEndpointName(axisEndpoint.getName());
                         
axisService.setBindingName(axisEndpoint.getBinding().getName().getLocalPart());
                     } else {
                         populateEndpoint(axisEndpoint, port, currentBinding,
-                                bindingWSDL, portType, portTypeWSDL, false);
+                                bindingWSDL, portType, false);
                     }
 
                     axisEndpoint.setParent(axisService);
@@ -524,7 +528,6 @@ public class WSDL11ToAxisServiceBuilder
                                   Binding wsdl4jBinding,
                                   Definition bindingWSDL,
                                   PortType portType,
-                                  Definition portTypeWSDL,
                                   boolean isSetMessageQNames)
             throws AxisFault {
 
@@ -545,7 +548,6 @@ public class WSDL11ToAxisServiceBuilder
                     wsdl4jBinding,
                     bindingWSDL,
                     portType,
-                    portTypeWSDL,
                     isSetMessageQNames);
             processedBindings.put(wsdl4jBinding.getQName(), axisBinding);
         }
@@ -564,6 +566,12 @@ public class WSDL11ToAxisServiceBuilder
                                if(referenceParameters != null){
                                        
axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, 
new ArrayList(referenceParameters.values()));
                                }
+                               for (OMElement extensibleElement : 
epr.getExtensibleElements()) {
+                                   if 
(AddressingConstants.QNAME_IDENTITY.equals(extensibleElement.getQName())) {
+                                       
axisEndpoint.addParameter(AddressingConstants.ADDRESSING_IDENTITY_PARAMETER, 
extensibleElement.cloneOMElement());
+                                       break;
+                                   }
+                               }
                        } catch (Exception e) {
                                if(log.isDebugEnabled()){
                                        log.debug("Exception encountered 
processing embedded wsa:EndpointReference", e);
@@ -573,8 +581,7 @@ public class WSDL11ToAxisServiceBuilder
        }
     }
 
-       private void populatePortType(PortType wsdl4jPortType,
-                                  Definition portTypeWSDL) throws AxisFault {
+       private void populatePortType(PortType wsdl4jPortType) throws AxisFault 
{
                copyExtensionAttributes(wsdl4jPortType.getExtensionAttributes(),
                                axisService, PORT_TYPE);
         List wsdl4jOperations = wsdl4jPortType.getOperations();
@@ -595,7 +602,7 @@ public class WSDL11ToAxisServiceBuilder
         for (Iterator iterator = wsdl4jOperations.iterator(); 
iterator.hasNext();) {
             wsdl4jOperation = (Operation) iterator.next();
 
-            axisOperation = populateOperations(wsdl4jOperation, 
wsdl4jPortType, portTypeWSDL);
+            axisOperation = populateOperations(wsdl4jOperation, 
wsdl4jPortType);
             addDocumentation(axisOperation, 
wsdl4jOperation.getDocumentationElement());
             if (wsdl4jOperation.getInput() != null) {
                 addMessageDocumentation(axisOperation, 
wsdl4jOperation.getInput().getDocumentationElement(), 
WSDLConstants.MESSAGE_LABEL_IN_VALUE);
@@ -640,7 +647,6 @@ public class WSDL11ToAxisServiceBuilder
                                  Binding wsdl4jBinding,
                                  Definition bindingWSDL,
                                  PortType portType,
-                                 Definition portTypeWSDL,
                                  boolean isSetMessageQNames)
             throws AxisFault {
 
@@ -673,7 +679,7 @@ public class WSDL11ToAxisServiceBuilder
             axisBindingOperation.setName(new 
QName(bindingWSDL.getTargetNamespace(), wsdl4jBindingOperation.getName()));
             addDocumentation(axisBindingOperation, 
wsdl4jBindingOperation.getDocumentationElement());
 
-            axisOperation = axisService.getOperation(new 
QName(portTypeWSDL.getTargetNamespace(), wsdl4jOperation.getName()));
+            axisOperation = axisService.getOperation(new 
QName(portType.getQName().getNamespaceURI(), wsdl4jOperation.getName()));
             axisBindingOperation.setAxisOperation(axisOperation);
 
             // process ExtensibilityElements of the wsdl4jBinding
@@ -1401,9 +1407,9 @@ public class WSDL11ToAxisServiceBuilder
      * @throws AxisFault
      */
     private AxisOperation populateOperations(Operation wsdl4jOperation,
-                                             PortType wsdl4jPortType, 
Definition dif)
+                                             PortType wsdl4jPortType)
             throws AxisFault {
-        QName opName = new QName(dif.getTargetNamespace(), 
wsdl4jOperation.getName());
+        QName opName = new QName(wsdl4jPortType.getQName().getNamespaceURI(), 
wsdl4jOperation.getName());
         // Copy Name Attribute
         AxisOperation axisOperation = axisService.getOperation(opName);
         if (axisOperation == null) {
@@ -1439,7 +1445,7 @@ public class WSDL11ToAxisServiceBuilder
                 String action = null;
                 if (inputActions == null || inputActions.size() == 0) {
                     action = WSDL11ActionHelper
-                            .getActionFromInputElement(dif, wsdl4jPortType,
+                            .getActionFromInputElement(wsdl4jDefinition, 
wsdl4jPortType,
                                                        wsdl4jOperation, 
wsdl4jInputMessage);
                 }
                 if (action != null) {
@@ -1470,7 +1476,7 @@ public class WSDL11ToAxisServiceBuilder
                 // with the Default Action Pattern
                 String action = axisOperation.getOutputAction();
                 if (action == null) {
-                    action = WSDL11ActionHelper.getActionFromOutputElement(dif,
+                    action = 
WSDL11ActionHelper.getActionFromOutputElement(wsdl4jDefinition,
                                                                            
wsdl4jPortType,
                                                                            
wsdl4jOperation,
                                                                            
wsdl4jOutputMessage);
@@ -1502,7 +1508,7 @@ public class WSDL11ToAxisServiceBuilder
                 String action = axisOperation.getOutputAction();
                 if (action == null) {
                     action = WSDL11ActionHelper
-                            .getActionFromInputElement(dif, wsdl4jPortType,
+                            .getActionFromInputElement(wsdl4jDefinition, 
wsdl4jPortType,
                                                        wsdl4jOperation, 
wsdl4jInputMessage);
                 }
                 if (action != null) {
@@ -1529,7 +1535,7 @@ public class WSDL11ToAxisServiceBuilder
                 ArrayList inputActions = axisOperation.getWSAMappingList();
                 String action = null;
                 if (inputActions == null || inputActions.size() == 0) {
-                    action = WSDL11ActionHelper.getActionFromOutputElement(dif,
+                    action = 
WSDL11ActionHelper.getActionFromOutputElement(wsdl4jDefinition,
                                                                            
wsdl4jPortType,
                                                                            
wsdl4jOperation,
                                                                            
wsdl4jOutputMessage);
@@ -1558,7 +1564,7 @@ public class WSDL11ToAxisServiceBuilder
                         .setName(faultMessage.getQName().getLocalPart());
 
                 copyExtensibleElements(faultMessage.getExtensibilityElements(),
-                                       dif, axisFaultMessage, 
PORT_TYPE_OPERATION_FAULT);
+                                       wsdl4jDefinition, axisFaultMessage, 
PORT_TYPE_OPERATION_FAULT);
 
             }
 
@@ -1567,7 +1573,7 @@ public class WSDL11ToAxisServiceBuilder
             // with the Default Action Pattern
             String action = axisOperation.getFaultAction(fault.getName());
             if (action == null) {
-                action = WSDL11ActionHelper.getActionFromFaultElement(dif,
+                action = 
WSDL11ActionHelper.getActionFromFaultElement(wsdl4jDefinition,
                                                                       
wsdl4jPortType,
                                                                       
wsdl4jOperation, fault);
             }
@@ -1588,7 +1594,7 @@ public class WSDL11ToAxisServiceBuilder
             
                 String faultAction = 
axisOperation.getFaultAction(exceptionClassName);
                 if (faultAction == null) {
-                    faultAction = 
WSDL11ActionHelper.getActionFromFaultElement(dif,
+                    faultAction = 
WSDL11ActionHelper.getActionFromFaultElement(wsdl4jDefinition,
                                                                           
wsdl4jPortType,
                                                                           
wsdl4jOperation, fault);
                     if (log.isDebugEnabled()) {
@@ -2322,7 +2328,7 @@ public class WSDL11ToAxisServiceBuilder
      */
     private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
 
-        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+       WSDLReader reader = 
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
 
         // switch off the verbose mode for all usecases
         reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
 Sun Dec 17 22:34:08 2017
@@ -73,6 +73,7 @@ import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.Hashtable;
 import java.util.LinkedHashMap;
@@ -301,6 +302,14 @@ public class DefaultSchemaGenerator impl
                 serviceMethods.add(method);
             }
         }
+        // The order of the methods returned by getMethods is undefined, but 
the test cases assume that the
+        // order is the same on all Java versions. Java 6 seems to use reverse 
lexical order, so we use that
+        // here to make things deterministic.
+        Collections.sort(serviceMethods, new Comparator<Method>() {
+            public int compare(Method o1, Method o2) {
+                return -o1.getName().compareTo(o2.getName());
+            }
+        });
         methods = processMethods(serviceMethods.toArray(new 
Method[serviceMethods.size()]));
         
         for (String extraClassName : getExtraClasses()) {

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
 Sun Dec 17 22:34:08 2017
@@ -29,8 +29,10 @@ import org.apache.axis2.context.ServiceG
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.service.Lifecycle;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -116,7 +118,7 @@ public class DependencyManager {
                     Class<?> implClass = Loader.loadClass(
                             classLoader,
                             ((String) implInfoParam.getValue()).trim());
-                    Object serviceImpl = implClass.newInstance();
+                    Object serviceImpl = makeNewServiceObject(service);
                     serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, 
serviceImpl);
                     initServiceObject(serviceImpl, serviceContext);
                     restoreThreadContext(tc);
@@ -126,6 +128,17 @@ public class DependencyManager {
             }
         }
     }
+    
+    protected static Object makeNewServiceObject(AxisService service) throws 
AxisFault {
+        Object serviceObject = Utils.createServiceObject(service);
+        if (serviceObject == null) {
+            throw new AxisFault(
+                    Messages.getMessage("paramIsNotSpecified", 
"SERVICE_OBJECT_SUPPLIER"));
+        } else {
+            return serviceObject;
+        }
+    }
+        
 
     /**
      * Notify a service object that it's on death row.

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
 Sun Dec 17 22:34:08 2017
@@ -28,7 +28,6 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.util.DetachableInputStream;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -106,16 +105,8 @@ public class TransportUtils {
 
             SOAPEnvelope env = createSOAPMessage(msgContext, inStream, 
contentType);
 
-            // if we were told to detach, we will make the call here, this is 
only applicable
-            // if a DetachableInputStream instance is found on the 
MessageContext
             if(detach) {
-                DetachableInputStream dis = (DetachableInputStream) 
msgContext.getProperty(Constants.DETACHABLE_INPUT_STREAM);
-                if(dis != null) {
-                    if(log.isDebugEnabled()) {
-                        log.debug("Detaching input stream after SOAPEnvelope 
construction");
-                    }
-                    dis.detach();
-                }
+                detachInputStream(msgContext);
             }
             return env;
         } catch (Exception e) {
@@ -196,10 +187,10 @@ public class TransportUtils {
             type = getContentType(contentType, msgContext);
             Builder builder = MessageProcessorSelector.getMessageBuilder(type, 
msgContext);
             if (builder != null) {
-                   if (log.isDebugEnabled()) {
-                       log.debug("createSOAPEnvelope using Builder (" +
-                                 builder.getClass() + ") selected from type (" 
+ type +")");
-                   }
+                if (log.isDebugEnabled()) {
+                    log.debug("createSOAPEnvelope using Builder (" +
+                              builder.getClass() + ") selected from type (" + 
type +")");
+                }
                 documentElement = builder.processDocument(inStream, 
contentType, msgContext);
             }
         }
@@ -241,10 +232,10 @@ public class TransportUtils {
         if (contentType != null) {
             type = getContentType(contentType, msgContext);
             if (builder != null) {
-                   if (log.isDebugEnabled()) {
-                       log.debug("createSOAPEnvelope using Builder (" +
-                                 builder.getClass() + ") selected from type (" 
+ type +")");
-                   }
+                if (log.isDebugEnabled()) {
+                    log.debug("createSOAPEnvelope using Builder (" +
+                              builder.getClass() + ") selected from type (" + 
type +")");
+                }
                 documentElement = builder.processDocument(inStream, 
contentType, msgContext);
             }
         }
@@ -438,114 +429,107 @@ public class TransportUtils {
         }
     }
 
+    /**
+     * This is a helper method to get the response written flag from the 
RequestResponseTransport
+     * instance.
+     */
+    public static boolean isResponseWritten(MessageContext messageContext) {
+        RequestResponseTransport reqResTransport = 
getRequestResponseTransport(messageContext);
+        if (reqResTransport != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Found RequestResponseTransport returning 
isResponseWritten()");
+            }
+            return reqResTransport.isResponseWritten();
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("Did not find RequestResponseTransport returning 
false from get"
+                        + "ResponseWritten()");
+            }
+            return false;
+        }
+    }
 
+    /**
+     * This is a helper method to set the response written flag on the 
RequestResponseTransport
+     * instance.
+     */
+    public static void setResponseWritten(MessageContext messageContext, 
boolean responseWritten) {
+        RequestResponseTransport reqResTransport = 
getRequestResponseTransport(messageContext);
+        if (reqResTransport != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Found RequestResponseTransport setting response 
written");
+            }
+            reqResTransport.setResponseWritten(responseWritten);
+        } else {
+            if (log.isDebugEnabled()) {
+               log.debug("Did not find RequestResponseTransport cannot set 
response written");
+            }
+        }
+    }
 
+    /**
+     * This is an internal helper method to retrieve the 
RequestResponseTransport instance
+     * from the MessageContext object. The MessageContext may be the response 
MessageContext so
+     * in that case we will have to retrieve the request MessageContext from 
the OperationContext.
+     */
+    private static RequestResponseTransport 
getRequestResponseTransport(MessageContext messageContext) {
+        try {
+            // If this is the request MessageContext we should find it 
directly by the getProperty()
+            // method
+            RequestResponseTransport transportControl = 
(RequestResponseTransport)
+                    
messageContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
+            
+            if (transportControl != null) {
+                return transportControl;
+            }
+            // If this is the response MessageContext we need to look for the 
request MessageContext
+            else if (messageContext.getOperationContext() != null
+                    && 
messageContext.getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)
 != null) {
+                return (RequestResponseTransport) 
messageContext.getOperationContext().getMessageContext(
+                        
WSDLConstants.MESSAGE_LABEL_IN_VALUE).getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
+            }
+            else {
+                return null;
+            }
+        }
+        catch(AxisFault af) {
+            // probably should not be fatal, so just log the message
+            String msg = Messages.getMessage("getMessageContextError", 
af.toString());
+            log.debug(msg);
+            return null;
+        }
+    }
 
-
-        /**
-         * This is a helper method to get the response written flag from the 
RequestResponseTransport
-         * instance.
-         */
-        public static boolean isResponseWritten(MessageContext messageContext) 
{
-            RequestResponseTransport reqResTransport = 
getRequestResponseTransport(messageContext);
-            if (reqResTransport != null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Found RequestResponseTransport returning 
isResponseWritten()");
-                }
-                return reqResTransport.isResponseWritten();
-            } else {
-                if (log.isDebugEnabled()) {
-                    log.debug("Did not find RequestResponseTransport returning 
false from get"
-                            + "ResponseWritten()");
-                }
-                return false;
-            }
+    /**
+     * Clean up cached attachment file
+     * @param msgContext
+     */
+    public static void deleteAttachments(MessageContext msgContext) {
+        if (log.isDebugEnabled()) {
+            log.debug("Entering deleteAttachments()");
         }
 
-       /**
-         * This is a helper method to set the response written flag on the 
RequestResponseTransport
-         * instance.
-        */
-       public static void setResponseWritten(MessageContext messageContext, 
boolean responseWritten) {
-            RequestResponseTransport reqResTransport = 
getRequestResponseTransport(messageContext);
-            if (reqResTransport != null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Found RequestResponseTransport setting response 
written");
-                }
-                reqResTransport.setResponseWritten(responseWritten);
-            } else {
-                if (log.isDebugEnabled()) {
-                   log.debug("Did not find RequestResponseTransport cannot set 
response written");
-               }
-           }
-       }
-
-       /**
-        * This is an internal helper method to retrieve the 
RequestResponseTransport instance
-        * from the MessageContext object. The MessageContext may be the 
response MessageContext so
-        * in that case we will have to retrieve the request MessageContext 
from the OperationContext.
-        */
-       private static RequestResponseTransport 
getRequestResponseTransport(MessageContext messageContext) {
-          try {
-                  // If this is the request MessageContext we should find it 
directly by the getProperty()
-               // method
-              RequestResponseTransport transportControl = 
(RequestResponseTransport)
-                  
messageContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
-              
-               if (transportControl != null) {
-                   return transportControl;
-               }
-               // If this is the response MessageContext we need to look for 
the request MessageContext
-                  else if (messageContext.getOperationContext() != null
-                                       && messageContext.getOperationContext()
-                               
.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE) != null) {
-                                                       return 
(RequestResponseTransport) messageContext.
-                                                       
getOperationContext().getMessageContext(
-                                                                       
WSDLConstants.MESSAGE_LABEL_IN_VALUE).getProperty(
-                                                                               
        RequestResponseTransport.TRANSPORT_CONTROL);
-                       }
-                       else {
-                               return null;
-                       }
-          }
-           catch(AxisFault af) {
-               // probably should not be fatal, so just log the message
-               String msg = Messages.getMessage("getMessageContextError", 
af.toString());
-               log.debug(msg);
-               return null;
-           }
-    }
-
-       /**
-        * Clean up cached attachment file
-        * @param msgContext
-        */
-       public static void deleteAttachments(MessageContext msgContext) {
-               if (log.isDebugEnabled()) {
-               log.debug("Entering deleteAttachments()");
-           }
-
-               Attachments attachments = msgContext.getAttachmentMap();
-
-           if (attachments != null) {
-               // Get the list of Content IDs for the attachments...but does 
not try to pull the stream for new attachments.
-               // (Pulling the stream for new attachments will probably 
fail...the stream is probably closed)
-               List keys = attachments.getContentIDList();
-               if (keys != null && keys.size() > 0) {
-                       String key = null;
-                       File file = null;
-                          LifecycleManager lcm = 
(LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
                            
-                       DataSource dataSource = null;
-                   for (int i = 0; i < keys.size(); i++) {
-                       try {
-                           key = (String) keys.get(i);
-                           dataSource = 
attachments.getDataHandler(key).getDataSource();
-                           if(dataSource instanceof CachedFileDataSource){
-                               file = 
((CachedFileDataSource)dataSource).getFile();
-                               if (log.isDebugEnabled()) {
-                                   log.debug("Delete cache attachment file: 
"+file.getName());
+        Attachments attachments = msgContext.getAttachmentMap();
+
+        if (attachments != null) {
+            // Get the list of Content IDs for the attachments...but does not 
try to pull the stream for new attachments.
+            // (Pulling the stream for new attachments will probably 
fail...the stream is probably closed)
+            List keys = attachments.getContentIDList();
+            if (keys != null && keys.size() > 0) {
+                String key = null;
+                File file = null;
+                LifecycleManager lcm = 
(LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
                       
+                DataSource dataSource = null;
+                for (int i = 0; i < keys.size(); i++) {
+                    try {
+                        key = (String) keys.get(i);
+                        dataSource = 
attachments.getDataHandler(key).getDataSource();
+                        if(dataSource instanceof CachedFileDataSource){
+                            file = 
((CachedFileDataSource)dataSource).getFile();
+                            if (log.isDebugEnabled()) {
+                                log.debug("Delete cache attachment file: 
"+file.getName());
                             }
-                               if(lcm!=null){
+                            if(lcm!=null){
                                 if(log.isDebugEnabled()){
                                     log.debug("deleting file using 
lifecyclemanager");
                                 }
@@ -553,63 +537,59 @@ public class TransportUtils {
                             }else{
                                 file.delete();
                             }
-                           }
-                       }
-                       catch (Exception e) {
-                          if (log.isDebugEnabled()) {
-                               log.debug("Delete cache attachment file 
failed"+ e.getMessage());
-                           }
-
-                           if (file != null) {
-                               if(lcm!=null){
-                                   try{
-                                       lcm.deleteOnExit(file);
-                                   }catch(Exception ex){
-                                       file.deleteOnExit();
-                                   }
-                               }
-                               else{
-                                   file.deleteOnExit();
-                               }
-                           }
-                       }
-                   }
-               }
-           }
-
-           if (log.isDebugEnabled()) {
-               log.debug("Exiting deleteAttachments()");
-           }
-       }
-
-       /**
-        * This method can be called by components wishing to detach the 
DetachableInputStream
-        * object that is present on the MessageContext. This is meant to 
shield components
-        * from any logic that needs to be executed on the 
DetachableInputStream in order to
-        * have it effectively detached. If the DetachableInputStream is not 
present, or if
-        * the supplied MessageContext is null, no action will be taken.
-        */
-       public static void detachInputStream(MessageContext msgContext) throws 
AxisFault {
-           try {
-               if(msgContext != null
-                       &&
-                       
msgContext.getProperty(Constants.DETACHABLE_INPUT_STREAM) != null) {
-                   DetachableInputStream dis = (DetachableInputStream) 
msgContext.getProperty(Constants.DETACHABLE_INPUT_STREAM);
-                   if(log.isDebugEnabled()) {
-                       log.debug("Detaching DetachableInputStream: " + dis);
-                   }
-                   dis.detach();
-               }
-               else {
-                   if(log.isDebugEnabled()) {
-                       log.debug("Detach not performed for MessageContext: " + 
msgContext);
-                   }
-               }
-           }
-           catch(Throwable t) {
-               throw AxisFault.makeFault(t);
-           }
-       }
+                        }
+                    }
+                    catch (Exception e) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Delete cache attachment file failed"+ 
e.getMessage());
+                        }
+
+                        if (file != null) {
+                            if(lcm!=null){
+                                try{
+                                    lcm.deleteOnExit(file);
+                                }catch(Exception ex){
+                                    file.deleteOnExit();
+                                }
+                            }
+                            else{
+                                file.deleteOnExit();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("Exiting deleteAttachments()");
+        }
+    }
+
+    /**
+     * Prepare the message in the given message context so that the underlying 
input stream can be
+     * closed.
+     * 
+     * @param msgContext
+     */
+    public static void detachInputStream(MessageContext msgContext) throws 
AxisFault {
+        if (msgContext != null) {
+            OMXMLParserWrapper builder = 
(OMXMLParserWrapper)msgContext.getProperty(Constants.BUILDER);
+            if (builder != null) {
+                builder.detach();
+            } else {
+                Attachments attachments = msgContext.getAttachmentMap(false);
+                if (attachments != null) {
+                    attachments.getAllContentIDs();
+                } else {
+                    SOAPEnvelope envelope = msgContext.getEnvelope();
+                    if (envelope != null) {
+                        envelope.build();
+                    }
+                }
+            }
+        }
+    }
 
     /**
      * <p>
@@ -746,4 +726,3 @@ public class TransportUtils {
     }
 
 }
-       
\ No newline at end of file

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
 Sun Dec 17 22:34:08 2017
@@ -512,11 +512,6 @@ public class HTTPConstants {
     public static final String AUTO_RELEASE_CONNECTION = 
"AutoReleaseConnection" ;
 
     /**
-     * Cleanup response
-     */
-    public static final String CLEANUP_RESPONSE = "CleanupResponse";
-
-    /**
      * Method getBytes.
      *
      * @param data

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
 Sun Dec 17 22:34:08 2017
@@ -20,9 +20,13 @@
 package org.apache.axis2.transport.http;
 
 import org.apache.axiom.attachments.Attachments;
+import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.OMMultipartWriter;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPMessage;
 import org.apache.axiom.util.UIDGenerator;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
@@ -67,11 +71,23 @@ public class SOAPMessageFormatter implem
             if (!(format.isOptimized()) && format.isDoingSWA()) {
                 writeSwAMessage(msgCtxt, out, format, preserve);
             } else {
-                OMElement element = msgCtxt.getEnvelope();
+                SOAPEnvelope envelope = msgCtxt.getEnvelope();
+                // Always use a SOAPMessage for serialization so that we 
produce an XML declaration.
+                // Note that an XML declaration shouldn't be necessary except 
for weird cases such as
+                // the UDP transport. This is for compatibility with Axis2 
1.7.0 and Axiom 1.2.x;
+                // Axiom 1.3.x no longer produces an XML declaration when 
serializing a SOAPEnvelope.
+                SOAPMessage message;
+                OMContainer parent = envelope.getParent();
+                if (parent instanceof SOAPMessage) {
+                    message = (SOAPMessage)parent;
+                } else {
+                    message = 
((SOAPFactory)envelope.getOMFactory()).createSOAPMessage();
+                    message.setSOAPEnvelope(envelope);
+                }
                 if (preserve) {
-                    element.serialize(out, format);
+                    message.serialize(out, format);
                 } else {
-                    element.serializeAndConsume(out, format);
+                    message.serializeAndConsume(out, format);
                 }
             }
         } catch (XMLStreamException e) {
@@ -85,34 +101,9 @@ public class SOAPMessageFormatter implem
 
     public byte[] getBytes(MessageContext msgCtxt, OMOutputFormat format)
             throws AxisFault {
-        if (log.isDebugEnabled()) {
-            log.debug("start getBytes()");
-            log.debug("  isOptimized=" + format.isOptimized());
-            log.debug("  isDoingSWA=" + format.isDoingSWA());
-        }
-        OMElement element = msgCtxt.getEnvelope();
-        try {
-            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-            if (!format.isOptimized()) {
-                if (format.isDoingSWA()) {
-                    writeSwAMessage(msgCtxt, bytesOut, format, false);
-                } else {
-                    element.serializeAndConsume(bytesOut, format);
-                }
-                return bytesOut.toByteArray();
-            } else {
-                element.serializeAndConsume(bytesOut, format);
-                return bytesOut.toByteArray();
-            }
-        } catch (XMLStreamException e) {
-            throw AxisFault.makeFault(e);
-        } catch (FactoryConfigurationError e) {
-            throw AxisFault.makeFault(e);
-        } finally {
-            if (log.isDebugEnabled()) {
-                log.debug("end getBytes()");
-            }
-        }
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        writeTo(msgCtxt, format, out, true);
+        return out.toByteArray();
     }
 
     public String getContentType(MessageContext msgCtxt, OMOutputFormat format,

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/MessageProcessorSelector.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/MessageProcessorSelector.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/MessageProcessorSelector.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/MessageProcessorSelector.java
 Sun Dec 17 22:34:08 2017
@@ -19,14 +19,6 @@
 
 package org.apache.axis2.util;
 
-import org.apache.axiom.attachments.Attachments;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.impl.MTOMConstants;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder;
-import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.builder.Builder;
@@ -41,9 +33,6 @@ import org.apache.axis2.transport.http.X
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
 import java.util.Map;
 
 /**
@@ -163,47 +152,6 @@ public class MessageProcessorSelector {
         return messageFormatter;
     }
 
-    public static StAXBuilder getAttachmentBuilder(MessageContext msgContext,
-                                                    Attachments attachments, 
XMLStreamReader streamReader,
-                                                    String 
soapEnvelopeNamespaceURI,
-                                                    boolean isSOAP)
-            throws OMException, XMLStreamException, FactoryConfigurationError {
-
-        StAXBuilder builder = null;
-
-        if (isSOAP) {
-            if (attachments.getAttachmentSpecType().equals(
-                    MTOMConstants.MTOM_TYPE)) {
-                //Creates the MTOM specific MTOMStAXSOAPModelBuilder
-                builder = new MTOMStAXSOAPModelBuilder(streamReader,
-                        attachments, soapEnvelopeNamespaceURI);
-                msgContext.setDoingMTOM(true);
-            } else if (attachments.getAttachmentSpecType().equals(
-                    MTOMConstants.SWA_TYPE)) {
-                builder = new StAXSOAPModelBuilder(streamReader,
-                        soapEnvelopeNamespaceURI);
-            } else if (attachments.getAttachmentSpecType().equals(
-                    MTOMConstants.SWA_TYPE_12)) {
-                builder = new StAXSOAPModelBuilder(streamReader,
-                        soapEnvelopeNamespaceURI);
-            }
-
-        }
-        // To handle REST XOP case
-        else {
-            if 
(attachments.getAttachmentSpecType().equals(MTOMConstants.MTOM_TYPE)) {
-                builder = new XOPAwareStAXOMBuilder(streamReader, attachments);
-
-            } else if 
(attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
-                builder = new StAXOMBuilder(streamReader);
-            } else if 
(attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE_12)) {
-                builder = new StAXOMBuilder(streamReader);
-            }
-        }
-
-        return builder;
-    }
-
     private static String getMessageFormatterProperty(MessageContext 
msgContext) {
         String messageFormatterProperty = null;
         Object property = msgContext

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/Utils.java
 Sun Dec 17 22:34:08 2017
@@ -733,10 +733,9 @@ public class Utils {
                     final Class<?> serviceClass = Loader.loadClass(
                             classLoader,
                             ((String) serviceClassParam.getValue()).trim());
-                    String className = ((String) 
serviceClassParam.getValue()).trim();
-                    Class serviceObjectMaker = Loader.loadClass(classLoader, 
className);
-                    if (serviceObjectMaker.getModifiers() != Modifier.PUBLIC) {
-                        throw new AxisFault("Service class " + className +
+                    int mod = serviceClass.getModifiers();
+                    if (!Modifier.isPublic(mod) || Modifier.isAbstract(mod) || 
Modifier.isInterface(mod)) {
+                        throw new AxisFault("Service class " + 
serviceClass.getName() +
                                             " must have public as access 
Modifier");
                     }
                     return 
org.apache.axis2.java.security.AccessController.doPrivileged(

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLUtils.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLUtils.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLUtils.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/util/XMLUtils.java
 Sun Dec 17 22:34:08 2017
@@ -45,12 +45,6 @@ import javax.xml.parsers.ParserConfigura
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -509,40 +503,10 @@ public class XMLUtils {
      * @throws Exception
      */
     public static OMElement toOM(Element element) throws Exception {
-        return toOM(element, true);
+        OMXMLParserWrapper builder = 
OMXMLBuilderFactory.createOMBuilder(element, true);
+        builder.detach();
+        return builder.getDocumentElement();
     }
-    
-    /**
-     * Convert DOM Element into a fully built OMElement
-     * @param element
-     * @param buildAll if true, full OM tree is immediately built. if false, 
caller is responsible 
-     * for building the tree and closing the parser.
-     * @return
-     * @throws Exception
-     */
-    public static OMElement toOM(Element element, boolean buildAll) throws 
Exception {
-
-        Source source = new DOMSource(element);
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Result result = new StreamResult(baos);
-
-        Transformer xformer = 
TransformerFactory.newInstance().newTransformer();
-        xformer.transform(source, result);
-
-        ByteArrayInputStream is = new ByteArrayInputStream(baos.toByteArray());
-
-        OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(is);
-        builder.setCache(true);
-
-        OMElement omElement = builder.getDocumentElement();
-        if (buildAll) {
-            omElement.build();
-            builder.close();
-        }
-        return omElement;
-    }
-
 
     /**
      * Converts a given OMElement to a DOM Element.
@@ -588,7 +552,6 @@ public class XMLUtils {
      */
     public static OMNode toOM(InputStream inputStream, boolean buildAll) 
throws XMLStreamException {
         OMXMLParserWrapper builder = 
OMXMLBuilderFactory.createOMBuilder(inputStream);
-        builder.setCache(true);
         OMNode omNode = builder.getDocumentElement();
         
         if (buildAll) {
@@ -623,7 +586,6 @@ public class XMLUtils {
      */
     public static OMNode toOM(Reader reader, boolean buildAll) throws 
XMLStreamException {
         OMXMLParserWrapper builder = 
OMXMLBuilderFactory.createOMBuilder(reader);
-        builder.setCache(true);
         OMNode omNode = builder.getDocumentElement();
         
         if (buildAll) {

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
 Sun Dec 17 22:34:08 2017
@@ -19,8 +19,17 @@
 
 package org.apache.axis2.wsdl;
 
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.description.WSDL2Constants;
 
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Output;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.AttributeExtensible;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
 /**
@@ -108,4 +117,68 @@ public class WSDLUtil {
         return buffer.toString();
     }
 
+    /**
+     * Registers default extension attributes types to given 
<code>extensionRegistry</code> instance.
+     * <p>
+     * The method configures the following attributes of {@link Input}, {@link 
Output} and {@link Fault} WSDL elements
+     * to use {@link AttributeExtensible.STRING_TYPE}:
+     * <ul>
+     * <li>{http://www.w3.org/2005/08/addressing}Action</li>
+     * <li>{http://www.w3.org/2006/05/addressing/wsdl}Action</li>
+     * <li>{http://www.w3.org/2007/05/addressing/metadata}Action</li>
+     * <li>{http://schemas.xmlsoap.org/ws/2004/08/addressing}Action</li>
+     * </ul>
+     * </p>
+     * @param extensionRegistry The extension registry to add default 
extension attribute types to. Must not be null.
+     */
+    public static void 
registerDefaultExtensionAttributeTypes(ExtensionRegistry extensionRegistry) {
+       if (extensionRegistry == null) {
+               throw new IllegalArgumentException("Extension registry must not 
be null");
+       }
+       
+           QName finalWSANS = new 
QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
+           extensionRegistry.registerExtensionAttributeType(Input.class, 
finalWSANS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Output.class, 
finalWSANS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Fault.class, 
finalWSANS, AttributeExtensible.STRING_TYPE);
+        
+           QName finalWSAWNS = new 
QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION);
+           extensionRegistry.registerExtensionAttributeType(Input.class, 
finalWSAWNS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Output.class, 
finalWSAWNS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Fault.class, 
finalWSAWNS, AttributeExtensible.STRING_TYPE);
+       
+           QName finalWSAMNS = new 
QName(AddressingConstants.Final.WSAM_NAMESPACE, AddressingConstants.WSA_ACTION);
+           extensionRegistry.registerExtensionAttributeType(Input.class, 
finalWSAMNS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Output.class, 
finalWSAMNS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Fault.class, 
finalWSAMNS, AttributeExtensible.STRING_TYPE);
+       
+           QName submissionWSAWNS = new 
QName(AddressingConstants.Submission.WSA_NAMESPACE, 
AddressingConstants.WSA_ACTION);
+           extensionRegistry.registerExtensionAttributeType(Input.class, 
submissionWSAWNS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Output.class, 
submissionWSAWNS, AttributeExtensible.STRING_TYPE);
+           extensionRegistry.registerExtensionAttributeType(Fault.class, 
submissionWSAWNS, AttributeExtensible.STRING_TYPE);
+    }
+    
+    /**
+     * Creates a new WSDLReader and configures it with a {@link 
WSDLFactory#newPopulatedExtensionRegistry()} if it does not specify an 
extension registry.
+     * The method will register default extension attribute types in 
WSDLReader's {@link WSDLReader#getExtensionRegistry() extensionRegistry},
+     * see {@link #registerDefaultExtensionAttributeTypes(ExtensionRegistry)}. 
+     * 
+     * @return The newly created WSDLReader instance.
+     * @throws WSDLException
+     */
+    public static WSDLReader newWSDLReaderWithPopulatedExtensionRegistry()
+               throws WSDLException {
+       WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+        WSDLReader reader = wsdlFactory.newWSDLReader();
+
+        ExtensionRegistry extensionRegistry = reader.getExtensionRegistry();
+        if (extensionRegistry == null) {
+               extensionRegistry = wsdlFactory.newPopulatedExtensionRegistry();
+        }
+        
+        WSDLUtil.registerDefaultExtensionAttributeTypes(extensionRegistry);
+        
+        reader.setExtensionRegistry(extensionRegistry);
+        
+        return reader;
+    }
 }

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
 Sun Dec 17 22:34:08 2017
@@ -18,12 +18,13 @@
  */
 
 package org.apache.axis2.wsdl.util;
-
-import org.apache.axis2.java.security.AccessController;
-import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Element;
+
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.wsdl.WSDLUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
 
 import javax.wsdl.Binding;
 import javax.wsdl.BindingFault;
@@ -42,13 +43,12 @@ 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 javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.ref.SoftReference;
@@ -1514,14 +1514,13 @@ public class WSDLWrapperReloadImpl imple
      */
     private WSDLReader getWSDLReader() throws WSDLException {
         WSDLReader reader;
-        try {
-            reader = (WSDLReader) AccessController.doPrivileged(new 
PrivilegedExceptionAction() {
-                public Object run() throws WSDLException {
-                    WSDLFactory factory = WSDLFactory.newInstance();
-                    return factory.newWSDLReader();
-                }
-            });
-        } catch (PrivilegedActionException e) {
+        try {
+            reader = (WSDLReader) AccessController.doPrivileged(new 
PrivilegedExceptionAction() {
+                public Object run() throws WSDLException {
+                    return 
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+                }
+            });
+        } catch (PrivilegedActionException e) {
             throw (WSDLException) e.getException();
         }
        // prevent system out from occurring

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/BadConfigOrderChange/axis2.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/BadConfigOrderChange/axis2.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/BadConfigOrderChange/axis2.xml
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/BadConfigOrderChange/axis2.xml
 Sun Dec 17 22:34:08 2017
@@ -33,7 +33,7 @@
 
     <messageReceiver mep="INOUT" 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
 
-     <transportSender name="http" 
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+     <transportSender name="http" 
class="org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender">
         <parameter name="PROTOCOL">HTTP/1.0</parameter>
     </transportSender>
 

Modified: 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/SystemPhaseRemove/axis2.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/SystemPhaseRemove/axis2.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/SystemPhaseRemove/axis2.xml
 (original)
+++ 
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test-resources/deployment/SystemPhaseRemove/axis2.xml
 Sun Dec 17 22:34:08 2017
@@ -34,7 +34,7 @@
     <messageReceiver mep="INOUT" 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
 
   
-     <transportSender name="http" 
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+     <transportSender name="http" 
class="org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender">
         <parameter name="PROTOCOL">HTTP/1.0</parameter>
     </transportSender>
 


Reply via email to