You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2008/01/15 17:22:27 UTC

svn commit: r612147 [12/17] - in /webservices/axis2/branches/java/jaxws21: ./ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/schem...

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Tue Jan 15 08:21:22 2008
@@ -23,19 +23,12 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.dataretrieval.DRConstants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.ModuleConfiguration;
-import org.apache.axis2.description.ParameterInclude;
-import org.apache.axis2.description.PolicyInclude;
-import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.*;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
 import org.apache.axis2.description.java2wsdl.TypeTable;
 import org.apache.axis2.engine.MessageReceiver;
@@ -43,6 +36,7 @@
 import org.apache.axis2.engine.ServiceLifeCycle;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -124,6 +118,13 @@
             Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER));
             processParameters(itr, service, service.getParent());
 
+            //If multiple services in one service group have different values for the PARENT_FIRST
+            //  parameter then the final value become the value specified by the last service in the group
+//            Parameter parameter = service.getParameter(DeploymentClassLoader.PARENT_FIRST);
+//            if (parameter !=null && "false".equals(parameter.getValue())) {
+//                ClassLoader serviceClassLoader = service.getClassLoader();
+//                ((DeploymentClassLoader)serviceClassLoader).setParentFirst(false);
+//            }
             // process service description
             OMElement descriptionElement =
                     service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION));
@@ -154,7 +155,7 @@
                     service_element.getAttribute(new QName(ATTRIBUTE_WSADDRESSING));
             if (addressingRequiredatt != null) {
                 String addressingRequiredString = addressingRequiredatt.getAttributeValue();
-                service.setWSAddressingFlag(addressingRequiredString);
+                AddressingHelper.setAddressingRequirementParemeterValue(service, addressingRequiredString);
             }
 
             //Setting service target namespace if any
@@ -334,6 +335,7 @@
             // Set the default message receiver for the operations that were
             // not listed in the services.xml
             setDefaultMessageReceivers();
+            Utils.processBeanPropertyExclude(service);
             if (!service.isUseUserWSDL()) {
                 // Generating schema for the service if the impl class is Java
                 if (!service.isWsdlFound()) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java Tue Jan 15 08:21:22 2008
@@ -23,6 +23,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
@@ -160,6 +161,7 @@
 
     public void unDeploy(String fileName) throws DeploymentException {
         try {
+            fileName = Utils.getShortFileName(fileName);
             fileName = DeploymentEngine.getAxisServiceName(fileName);
             AxisServiceGroup serviceGroup = axisConfig.removeServiceGroup(fileName);
             if (serviceGroup != null) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml Tue Jan 15 08:21:22 2008
@@ -273,5 +273,6 @@
         <phase name="RMPhase"/>
         <phase name="PolicyDetermination"/>
         <phase name="MessageOut"/>
+        <phase name="Security"/>
     </phaseOrder>
 </axisconfig>

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Tue Jan 15 08:21:22 2008
@@ -42,7 +42,6 @@
 import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder;
-import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
 import org.apache.axis2.description.WSDLToAxisServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
@@ -60,8 +59,6 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -229,6 +226,8 @@
                             serviceArchiveFile.getCanonicalFile().toURI().toString());
 
                 } else if (axisServiceBuilder instanceof WSDL20ToAllAxisServicesBuilder) {
+                    ((WSDL20ToAllAxisServicesBuilder) axisServiceBuilder).setCustomWSDLResolver(
+                            new AARBasedWSDLLocator(baseURI, serviceArchiveFile, in));
                     // trying to use the jar scheme as the base URI. I think this can be used to handle
                     // wsdl 1.1 as well without using a custom URI resolver. Need to look at it later.
                     axisServiceBuilder.setBaseUri(
@@ -402,21 +401,33 @@
         OMElement element = (OMElement) XMLUtils.toOM(in);
         OMNamespace documentElementNS = element.getNamespace();
         if (documentElementNS != null) {
-            WSDL11ToAllAxisServicesBuilder wsdlToAxisServiceBuilder;
+            WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder;
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             element.serialize(out);
             if (Constants.NS_URI_WSDL11.
                     equals(documentElementNS.getNamespaceURI())) {
                 wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder(
                         new ByteArrayInputStream(out.toByteArray()));
-                wsdlToAxisServiceBuilder.setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl,
+                ((WSDL11ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl,
                                                                                          loader,
                                                                                          new ByteArrayInputStream(
                                                                                                  out.toByteArray())));
                 wsdlToAxisServiceBuilder.setCustomResolver(
                         new WarFileBasedURIResolver(loader));
-                return wsdlToAxisServiceBuilder.populateAllServices();
-            } else {
+                return ((WSDL11ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices();
+            } else if (WSDL2Constants.WSDL_NAMESPACE.
+                    equals(documentElementNS.getNamespaceURI())){
+                wsdlToAxisServiceBuilder = new WSDL20ToAllAxisServicesBuilder(
+                        new ByteArrayInputStream(out.toByteArray()));
+                ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl,
+                                                                                         loader,
+                                                                                         new ByteArrayInputStream(
+                                                                                                 out.toByteArray())));
+                wsdlToAxisServiceBuilder.setCustomResolver(
+                        new WarFileBasedURIResolver(loader));
+                return ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices();
+            }
+            else {
                 throw new DeploymentException(Messages.getMessage("invalidWSDLFound"));
             }
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java Tue Jan 15 08:21:22 2008
@@ -112,7 +112,7 @@
                                                                 this.file.getAbsolutePath()));
                     }
                     urlsToLoadFrom = new URL[]{this.file.toURL()};
-                    classLoader = Utils.createClassLoader(urlsToLoadFrom, parent, false, file);
+                    classLoader = Utils.createClassLoader(urlsToLoadFrom, parent, true, file);
                 } catch (Exception e) {
                     throw AxisFault.makeFault(e);
                 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java Tue Jan 15 08:21:22 2008
@@ -150,8 +150,8 @@
         String fileName = file.getName();
         WSInfo info = (WSInfo) currentJars.get(fileName);
         if(info==null){
-            info = new WSInfo(file.getName(), file.lastModified(), deployer ,type);
-            currentJars.put(file.getName(),info);
+            info = new WSInfo(file.getAbsolutePath(), file.lastModified(), deployer ,type);
+            currentJars.put(file.getAbsolutePath(), info);
             DeploymentFileData fileData = new DeploymentFileData(file, deployer);
             deploymentEngine.addWSToDeploy(fileData);
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java Tue Jan 15 08:21:22 2008
@@ -20,6 +20,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.woden.resolver.URIResolver;
+import org.apache.woden.WSDLException;
 import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
 import org.xml.sax.InputSource;
 
@@ -31,6 +33,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
@@ -42,7 +45,7 @@
  * The logic here is that we only care about the import location
  * all imports must be relative to the META-INF folder
  */
-public class AARBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator {
+public class AARBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator, URIResolver {
 
     protected static final Log log = LogFactory
             .getLog(AARBasedWSDLLocator.class);
@@ -131,4 +134,21 @@
     public void close() {
         //TODO: FIXME:    
     }
-}
+
+    public URI resolveURI(URI uri) throws WSDLException, IOException {
+        lastImportLocation = URI.create(baseURI).resolve(uri);
+
+        if (isAbsolute(uri.toString())) {
+            return uri;
+        } else {
+            String absolutePath = aarFile.getAbsolutePath();
+            try {
+                return new URI("jar:file://" + absolutePath + "!/" + lastImportLocation);
+            } catch (URISyntaxException e) {
+                log.debug(e);
+            }
+        }
+        log.info("AARBasedWSDLLocator: Unable to resolve " + lastImportLocation);
+        return null;
+    }
+}
\ No newline at end of file

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java Tue Jan 15 08:21:22 2008
@@ -21,13 +21,18 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
+import org.apache.woden.resolver.URIResolver;
+import org.apache.woden.WSDLException;
 import org.xml.sax.InputSource;
 
 import javax.wsdl.xml.WSDLLocator;
 import java.io.InputStream;
+import java.io.IOException;
 import java.net.URI;
+import java.net.URL;
+import java.net.URISyntaxException;
 
-public class WarBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator {
+public class WarBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator, URIResolver {
     protected static final Log log = LogFactory
             .getLog(WarBasedWSDLLocator.class);
 
@@ -82,5 +87,25 @@
 
     public void close() {
         //TODO: FIXME:
+    }
+
+    public URI resolveURI(URI uri) throws WSDLException, IOException {
+
+        if (isAbsolute(uri.toString())) {
+            return uri;
+        } else {
+            lastImportLocation = URI.create(baseURI).resolve(uri.toString());
+            String searchingStr = lastImportLocation.toString();
+            URL resource = classLoader.getResource(searchingStr);
+            if (resource != null) {
+                try {
+                    return new URI(resource.toString());
+                } catch (URISyntaxException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            log.info("AARBasedWSDLLocator: Unable to resolve " + lastImportLocation);
+            return null;
+        }
     }
 }

Copied: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java (from r610664, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java?p2=webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java&p1=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java&r1=610664&r2=612147&rev=612147&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java Tue Jan 15 08:21:22 2008
@@ -15,8 +15,6 @@
  */
 package org.apache.axis2.deployment.util;
 
-import java.util.Locale;
-
 /**
  * this class is used to keep the excludeProperties and includePropertes
  * of the given bean when generating the wsdl, and serializing.
@@ -56,7 +54,7 @@
      * @param property
      * @return is exclude the property or not
      */
-    public boolean isExcluedProperty(String property){
+    public boolean isExcludedProperty(String property){
        boolean isExclude = false;
        if ((excludeProperties != null) && (excludeProperties.trim().length() > 0)){
            if (property.matches(excludeProperties)){

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/PhasesInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/PhasesInfo.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/PhasesInfo.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/PhasesInfo.java Tue Jan 15 08:21:22 2008
@@ -151,6 +151,10 @@
         return OUTPhases;
     }
 
+    public ArrayList getOutFaultPhaseList(){
+        return OUT_FaultPhases;
+    }
+
     public ArrayList getOUT_FaultPhases() throws DeploymentException {
         ArrayList globalPhaseList = new ArrayList();
         boolean messageOut = false;

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Tue Jan 15 08:21:22 2008
@@ -26,6 +26,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.DeploymentClassLoader;
 import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.deployment.repository.util.DeploymentFileData;
 import org.apache.axis2.description.AxisModule;
@@ -68,14 +69,7 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-import java.util.StringTokenizer;
+import java.util.*;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
@@ -673,4 +667,50 @@
         return file;
     }
 
+    /**
+     * This method is to process bean exclude parameter and the XML format of that would be
+     * <parameter name="beanPropertyRules">
+     *     <bean class="full qualified class name" excludeProperties="name,age"/>+
+     * </parameter>
+     * @param service , AxisService object
+     */
+    public static void processBeanPropertyExclude(AxisService  service){
+        Parameter excludeBeanProperty = service.getParameter("beanPropertyRules");
+        if (excludeBeanProperty != null) {
+            OMElement parameterElement = excludeBeanProperty.getParameterElement();
+            Iterator bneasItr =parameterElement.getChildrenWithName(new QName("bean"));
+            ExcludeInfo excludeInfo = new ExcludeInfo();
+            while (bneasItr.hasNext()) {
+                OMElement bean = (OMElement) bneasItr.next();
+                String clazz = bean.getAttributeValue(
+                        new QName(DeploymentConstants.TAG_CLASS_NAME));
+                String excludePropertees = bean.getAttributeValue(
+                        new QName(DeploymentConstants.TAG_EXCLUDE_PROPERTIES));
+                String includeProperties = bean.getAttributeValue(
+                        new QName(DeploymentConstants.TAG_INCLUDE_PROPERTIES));
+                excludeInfo.putBeanInfo(clazz, new BeanExcludeInfo(excludePropertees,includeProperties));
+            }
+            service.setExcludeInfo(excludeInfo);
+        }
+    }
+
+    /**
+     * This will split a bean exclude property values into ArrayList
+     * @param value : String to be splited
+     * @return : Arryalist of the splited string
+     */
+    private static List getArrayFromString(String value) {
+        String values [] = value.split(",");
+        ArrayList list = new ArrayList();
+        for (int i = 0; i < values.length; i++) {
+            String s = values[i];
+            list.add(s);
+        }
+       return list;
+    }
+
+    public static String getShortFileName(String filename){
+        File file = new File(filename);
+        return file.getName();
+    }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBinding.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBinding.java Tue Jan 15 08:21:22 2008
@@ -76,6 +76,12 @@
             return obj;
         }
 
+        // need this here to guarantee that we dont return a SOAP version for HTTP Bindings
+        if (WSDL2Constants.ATTR_WSOAP_VERSION.equals(name) &&
+                WSDL2Constants.URI_WSDL2_HTTP.equals(type)) {
+            return null;
+        }
+
         obj = WSDL20DefaultValueHolder.getDefaultValue(name);
 
         return obj;

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java Tue Jan 15 08:21:22 2008
@@ -184,7 +184,7 @@
         property = (String) this.options.get(WSDL2Constants.ATTR_WHTTP_LOCATION);
         if (property != null) {
             bindingOpElement.addAttribute(omFactory.createOMAttribute(
-                    WSDL2Constants.ATTRIBUTE_LOCATION, whttp, serviceName + "/" + property));
+                    WSDL2Constants.ATTRIBUTE_LOCATION, whttp, property));
         }
         property = (String) this.options.get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING);
         if (property != null) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Tue Jan 15 08:21:22 2008
@@ -54,6 +54,9 @@
 
     protected Map engagedModules;
 
+    /** List of ParameterObservers who want to be notified of changes */
+    protected List parameterObservers = null;
+
     private OMFactory omFactory = OMAbstractFactory.getOMFactory();
 
     // Holds the documentation details for each element
@@ -67,6 +70,18 @@
         children = new HashMap();
     }
 
+    public void addParameterObserver(ParameterObserver observer) {
+        if (parameterObservers == null)
+            parameterObservers = new ArrayList();
+        parameterObservers.add(observer);
+    }
+
+    public void removeParameterObserver(ParameterObserver observer) {
+        if (parameterObservers != null) {
+            parameterObservers.remove(observer);
+        }
+    }
+
     public void addParameter(Parameter param) throws AxisFault {
         if (param == null) {
             return;
@@ -78,6 +93,14 @@
         }
 
         parameterInclude.addParameter(param);
+
+        // Tell anyone who wants to know
+        if (parameterObservers != null) {
+            for (Iterator i = parameterObservers.iterator(); i.hasNext();) {
+                ParameterObserver observer = (ParameterObserver)i.next();
+                observer.parameterChanged(param.getName(), param.getValue());
+            }
+        }
     }
 
     public void addParameter(String name, Object value) throws AxisFault {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java Tue Jan 15 08:21:22 2008
@@ -20,11 +20,47 @@
 
 package org.apache.axis2.description;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.SocketException;
+import java.net.URL;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.http.HTTPAddress;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.description.java2wsdl.*;
-import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
@@ -37,9 +73,15 @@
 import org.apache.axis2.dataretrieval.LocatorType;
 import org.apache.axis2.dataretrieval.OutputForm;
 import org.apache.axis2.dataretrieval.WSDLSupplier;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.util.ExcludeInfo;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
+import org.apache.axis2.description.java2wsdl.DocLitBareSchemaGenerator;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.TypeTable;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.DefaultObjectSupplier;
 import org.apache.axis2.engine.MessageReceiver;
@@ -50,8 +92,8 @@
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.http.server.HttpUtils;
 import org.apache.axis2.util.Loader;
-import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.util.XMLPrettyPrinter;
+import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -63,25 +105,13 @@
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
 import org.codehaus.jam.JMethod;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import javax.wsdl.*;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.extensions.http.HTTPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.*;
-import java.net.SocketException;
-import java.net.URL;
-import java.security.PrivilegedAction;
-import java.util.*;
-
 /**
  * Class AxisService
  */
@@ -229,9 +259,6 @@
     private String endpointName;
     private String endpointURL;
 
-    // Flag representing whether WS-Addressing is required to use this service.
-    // Reflects the wsaw:UsingAddressing wsdl extension element
-    private String wsaddressingFlag = AddressingConstants.ADDRESSING_UNSPECIFIED;
     private boolean clientSide = false;
 
     //To keep a ref to ObjectSupplier instance
@@ -240,6 +267,9 @@
     // package to namespace mapping
     private Map p2nMap;
 
+    // to keep the exclude property details
+    private ExcludeInfo excludeInfo;
+
     private TypeTable typeTable;
 
     // Data Locators for  WS-Mex Support
@@ -272,15 +302,18 @@
         this.endpointMap.put(key, axisEndpoint);
     }
 
+    /**
+     * @deprecated Use AddressingHelper.getAddressingRequirementParemeterValue
+     */
     public String getWSAddressingFlag() {
-        return wsaddressingFlag;
+        return AddressingHelper.getAddressingRequirementParemeterValue(this);
     }
 
+    /**
+     * @deprecated Use AddressingHelper.setAddressingRequirementParemeterValue
+     */
     public void setWSAddressingFlag(String ar) {
-        wsaddressingFlag = ar;
-        if (wsaddressingFlag == null) {
-            wsaddressingFlag = AddressingConstants.ADDRESSING_UNSPECIFIED;
-        }
+    	AddressingHelper.setAddressingRequirementParemeterValue(this, ar);
     }
 
     public boolean isSchemaLocationsAdjusted() {
@@ -726,7 +759,7 @@
         }
         if (log.isDebugEnabled()) {
             log.debug("mapActionToOperation: Mapping Action to Operation: action: " + action +
-                      "; operation: " + axisOperation);
+                      "; operation: " + axisOperation+ "named: "+axisOperation.getName());
         }
 
         // First check if this action has already been flagged as invalid because it is a duplicate.
@@ -1019,7 +1052,9 @@
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
                 originalImprotString = wsdlImport.getLocationURI();
-                wsdlImport.setLocationURI(this.name + "?wsdl=" + originalImprotString);
+                if (!originalImprotString.startsWith("http")){
+                    wsdlImport.setLocationURI(this.name + "?wsdl=" + originalImprotString);
+                }
                 changeImportAndIncludeLocations(wsdlImport.getDefinition());
             }
         }
@@ -1361,22 +1396,41 @@
      */
     public AxisOperation getOperationBySOAPAction(String soapAction) {
         if ((soapAction == null) || soapAction.length() == 0) {
+        	if(log.isDebugEnabled()){
+        		log.debug("getOperationBySOAPAction: "+soapAction +" is null or ''. Returning null.");
+        	}
             return null;
         }
         // If the action maps to an alais that is not unique, then it can't be used to map to 
         // an operation.
         if (invalidOperationsAliases.contains(soapAction)) {
+        	if(log.isDebugEnabled()){
+        		log.debug("getOperationBySOAPAction: "+soapAction +" is an invalid operation alias. Returning null.");
+        	}
             return null;
         }
 
-        AxisOperation operation = (AxisOperation) getChild(new QName(soapAction));
-
+        AxisOperation operation = null;
+        Iterator children = getChildren();
+        // I could not find any spec statement that explicitly forbids using a short name in the SOAPAction header or wsa:Action element,
+        // so I believe this to be valid.  There may be customers using the shortname as the SOAPAction in their client code that would
+        // also require this support.
+        while(children.hasNext() && (operation == null)){
+        	AxisOperation op = (AxisOperation)children.next();
+        	if(op.getName().getLocalPart().equals(soapAction)){
+        		operation = op;
+        	}
+        }
+        
         if (operation != null) {
+        	if(log.isDebugEnabled()){
+        		log.debug("getOperationBySOAPAction: Operation ("+operation+","+operation.getName()+") for soapAction: "+soapAction+" found as child.");
+        	}
             return operation;
         }
 
         operation = (AxisOperation) operationsAliasesMap.get(soapAction);
-
+        
         return operation;
     }
 
@@ -1876,6 +1930,7 @@
         map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX,
                 Java2WSDLConstants.URI_2001_SCHEMA_XSD);
         axisService.setNameSpacesMap(map);
+        Utils.processBeanPropertyExclude(axisService);
         axisService.setElementFormDefault(false);
         try {
             axisService.addSchema(schemaGenerator.generateSchema());
@@ -2001,12 +2056,18 @@
         }
     }
 
+    public Map populateSchemaMappings(){
+        // when calling from other than codegen. i.e from deployment
+        // engine we don't have to override the absolute http locations.
+        return populateSchemaMappings(false);
+    }
+
     /**
      * runs the schema mappings if it has not been run previously
      * it is best that this logic be in the axis service since one can
      * call the axis service to populate the schema mappings
      */
-    public Map populateSchemaMappings() {
+    public Map populateSchemaMappings(boolean overrideAbsoluteAddress) {
 
         //populate the axis service with the necessary schema references
         ArrayList schema = this.schemaList;
@@ -2015,7 +2076,7 @@
             Hashtable nameTable = new Hashtable();
             Hashtable sourceURIToNewLocationMap = new Hashtable();
             //calculate unique names for the schemas
-            calculateSchemaNames(schema, nameTable, sourceURIToNewLocationMap);
+            calculateSchemaNames(schema, nameTable, sourceURIToNewLocationMap, overrideAbsoluteAddress);
             //adjust the schema locations as per the calculated names
             changedSchemaLocations = adjustSchemaNames(schema, nameTable,sourceURIToNewLocationMap);
             //reverse the nametable so that there is a mapping from the
@@ -2032,7 +2093,10 @@
      *
      * @param schemas
      */
-    private void calculateSchemaNames(List schemas, Hashtable nameTable, Hashtable sourceURIToNewLocationMap) {
+    private void calculateSchemaNames(List schemas,
+                                      Hashtable nameTable,
+                                      Hashtable sourceURIToNewLocationMap,
+                                      boolean overrideAbsoluteAddress) {
         //first traversal - fill the hashtable
         for (int i = 0; i < schemas.size(); i++) {
             XmlSchema schema = (XmlSchema) schemas.get(i);
@@ -2047,9 +2111,10 @@
 
                     if (s != null && getScheamLocationWithDot(sourceURIToNewLocationMap, s) == null) {
                         //insert the name into the table
-                        insertIntoNameTable(nameTable, s, sourceURIToNewLocationMap);
+                        insertIntoNameTable(nameTable, s, sourceURIToNewLocationMap, overrideAbsoluteAddress);
                         //recursively call the same procedure
-                        calculateSchemaNames(Arrays.asList(new XmlSchema[]{s}), nameTable, sourceURIToNewLocationMap);
+                        calculateSchemaNames(Arrays.asList(new XmlSchema[]{s}),
+                                nameTable, sourceURIToNewLocationMap, overrideAbsoluteAddress);
                     }
                 }
             }
@@ -2062,24 +2127,37 @@
      * @param nameTable
      * @param s
      */
-    private void insertIntoNameTable(Hashtable nameTable, XmlSchema s, Hashtable sourceURIToNewLocationMap) {
+    private void insertIntoNameTable(Hashtable nameTable,
+                                     XmlSchema s,
+                                     Hashtable sourceURIToNewLocationMap,
+                                     boolean overrideAbsoluteAddress) {
         String sourceURI = s.getSourceURI();
-        String newURI = sourceURI.substring(sourceURI.lastIndexOf('/') + 1);
-        if (newURI.endsWith(".xsd")) {
-            //remove the .xsd extention
-            newURI = newURI.substring(0, newURI.lastIndexOf("."));
+        // check whether the sourece uri is an absolute one and are
+        // we allowed to override it.
+        // if the absolute uri overriding is not allowed the use the
+        // original sourceURI as new one
+        if (sourceURI.startsWith("http") && !overrideAbsoluteAddress) {
+            nameTable.put(s, sourceURI);
+            sourceURIToNewLocationMap.put(sourceURI, sourceURI);
         } else {
-            newURI = "xsd" + count++;
-        }
+            String newURI = sourceURI.substring(sourceURI.lastIndexOf('/') + 1);
+            if (newURI.endsWith(".xsd")) {
+                //remove the .xsd extention
+                newURI = newURI.substring(0, newURI.lastIndexOf("."));
+            } else {
+                newURI = "xsd" + count++;
+            }
 
-        newURI = customSchemaNameSuffix != null? newURI + customSchemaNameSuffix: newURI;
-        // make it unique
-        while(nameTable.containsValue(newURI)){
-            newURI = newURI + count++;
+            newURI = customSchemaNameSuffix != null ? newURI + customSchemaNameSuffix : newURI;
+            // make it unique
+            while (nameTable.containsValue(newURI)) {
+                newURI = newURI + count++;
+            }
+
+            nameTable.put(s, newURI);
+            sourceURIToNewLocationMap.put(sourceURI, newURI);
         }
 
-        nameTable.put(s, newURI);
-        sourceURIToNewLocationMap.put(sourceURI,newURI);
     }
 
     /**
@@ -2559,5 +2637,13 @@
 
     public String toString() {
         return getName();
+    }
+
+    public ExcludeInfo getExcludeInfo() {
+        return excludeInfo;
+    }
+
+    public void setExcludeInfo(ExcludeInfo excludeInfo) {
+        this.excludeInfo = excludeInfo;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Tue Jan 15 08:21:22 2008
@@ -7,6 +7,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.util.ExternalPolicySerializer;
@@ -17,6 +18,7 @@
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.AxisFault;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.PolicyReference;
@@ -55,6 +57,8 @@
 
     private AxisService axisService;
 
+    private String serviceName;
+
     private String[] serviceEndpointURLs;
 
     private String targetNamespace;
@@ -87,13 +91,17 @@
 
     public AxisService2WSDL11(AxisService service) throws Exception {
         this.axisService = service;
+        this.serviceName = service.getName();
+        init();
+    }
 
+    private void init() throws AxisFault {
         // the EPR list of AxisService contains REST EPRs as well. Those REST EPRs will be used to generated HTTPBinding
         // and rest of the EPRs will be used to generate SOAP 1.1 and 1.2 bindings. Let's first initialize those set of
         // EPRs now to be used later, especially when we generate the WSDL.
-        serviceEndpointURLs = service.getEPRs();
+        serviceEndpointURLs = axisService.getEPRs();
         if (serviceEndpointURLs == null) {
-            Map endpointMap = service.getEndpoints();
+            Map endpointMap = axisService.getEndpoints();
              if (endpointMap.size() > 0) {
                 Iterator endpointItr = endpointMap.values().iterator();
                 if (endpointItr.hasNext()) {
@@ -102,21 +110,26 @@
                 }
 
             } else {
-                 serviceEndpointURLs = new String[]{service.getEndpointName()};
+                 serviceEndpointURLs = new String[]{axisService.getEndpointName()};
              }
         }
 
-        this.targetNamespace = service.getTargetNamespace();
+        this.targetNamespace = axisService.getTargetNamespace();
 
         serializer = new ExternalPolicySerializer();
         // CHECKME check whether service.getAxisConfiguration() return null ???
 
-        AxisConfiguration configuration = service.getAxisConfiguration();
+        AxisConfiguration configuration = axisService.getAxisConfiguration();
         if (configuration != null) {
             serializer.setAssertionsToFilter(configuration
                     .getLocalPolicyAssertions());
         }
+    }
 
+    public AxisService2WSDL11(AxisService service, String serviceName) throws Exception {
+        this.axisService = service;
+        this.serviceName = serviceName;
+        init();
     }
 
     public OMElement generateOM() throws Exception {
@@ -342,7 +355,7 @@
         OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
         defintions.addChild(portType);
 
-        portType.addAttribute(ATTRIBUTE_NAME, axisService.getName()
+        portType.addAttribute(ATTRIBUTE_NAME, serviceName
                 + PORT_TYPE_SUFFIX, null);
 
         addPolicyAsExtAttribute(PolicyInclude.PORT_TYPE_POLICY, axisService
@@ -454,11 +467,12 @@
      * @param disableSOAP12 if false, generate SOAP 1.2 binding, if true, don't
      * @throws Exception if there's a problem
      */
-    public void generateService(OMFactory fac, OMElement defintions, boolean disableREST, boolean disableSOAP12)
+    public void generateService(OMFactory fac, OMElement defintions, boolean disableREST,
+                                boolean disableSOAP12)
             throws Exception {
         OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl);
         defintions.addChild(service);
-        service.addAttribute(ATTRIBUTE_NAME, axisService.getName(), null);
+        service.addAttribute(ATTRIBUTE_NAME, serviceName, null);
         generateSOAP11Ports(fac, service);
         if (!disableSOAP12) {
             generateSOAP12Ports(fac, service);
@@ -482,14 +496,14 @@
                 String protocol = new URI(urlString).getScheme();
                 OMElement port = fac.createOMElement(PORT, wsdl);
                 service.addChild(port);
-                String name = axisService.getName() + SOAP11PORT
+                String name = serviceName + SOAP11PORT
                         + ((protocol == null) ? "" : "_" + protocol);
                 if (i > 0) {
                     name += i;
                 }
                 port.addAttribute(ATTRIBUTE_NAME, name, null);
                 port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
-                        + axisService.getName() + BINDING_NAME_SUFFIX, null);
+                        + serviceName + BINDING_NAME_SUFFIX, null);
                 WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
                                     soap);
 
@@ -507,13 +521,13 @@
             if (urlString != null && urlString.startsWith("http")) {
                 OMElement port = fac.createOMElement(PORT, wsdl);
                 service.addChild(port);
-                String name = axisService.getName() + HTTP_PORT;
+                String name = serviceName + HTTP_PORT;
                 if (i > 0) {
                     name += i;
                 }
                 port.addAttribute(ATTRIBUTE_NAME, name, null);
                 port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
-                        + axisService.getName() + HTTP_BINDING, null);
+                        + serviceName + HTTP_BINDING, null);
                 OMElement extElement = fac.createOMElement("address", http);
                 port.addChild(extElement);
 //                urlString = urlString.replaceAll(servicePath, "rest");
@@ -530,14 +544,14 @@
                 String protocol = new URI(urlString).getScheme();
                 OMElement port = fac.createOMElement(PORT, wsdl);
                 service.addChild(port);
-                String name = axisService.getName() + SOAP12PORT
+                String name = serviceName + SOAP12PORT
                         + ((protocol == null) ? "" : "_" + protocol);
                 if (i > 0) {
                     name += i;
                 }
                 port.addAttribute(ATTRIBUTE_NAME, name, null);
                 port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
-                        + axisService.getName() + SOAP12BINDING_NAME_SUFFIX, null);
+                        + serviceName + SOAP12BINDING_NAME_SUFFIX, null);
                 WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
                                     soap12);
 
@@ -558,10 +572,10 @@
             throws Exception {
         OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
         defintions.addChild(binding);
-        binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
+        binding.addAttribute(ATTRIBUTE_NAME, serviceName
                 + BINDING_NAME_SUFFIX, null);
         binding.addAttribute("type", tns.getPrefix() + ":"
-                + axisService.getName() + PORT_TYPE_SUFFIX, null);
+                + serviceName + PORT_TYPE_SUFFIX, null);
 
         addPolicyAsExtElement(PolicyInclude.BINDING_POLICY, axisService
                 .getPolicyInclude(), binding);
@@ -572,13 +586,13 @@
 
         // Add WS-Addressing UsingAddressing element if appropriate
         // SHOULD be on the binding element per the specification
-        if (axisService.getWSAddressingFlag().equals(
+        if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_OPTIONAL)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
                                 DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
                     wsaw);
-        } else if (axisService.getWSAddressingFlag().equals(
+        } else if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_REQUIRED)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
@@ -690,10 +704,10 @@
             throws Exception {
         OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
         defintions.addChild(binding);
-        binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
+        binding.addAttribute(ATTRIBUTE_NAME, serviceName
                 + SOAP12BINDING_NAME_SUFFIX, null);
         binding.addAttribute("type", tns.getPrefix() + ":"
-                + axisService.getName() + PORT_TYPE_SUFFIX, null);
+                + serviceName + PORT_TYPE_SUFFIX, null);
 
         addPolicyAsExtElement(PolicyInclude.BINDING_POLICY, axisService
                 .getPolicyInclude(), binding);
@@ -704,13 +718,13 @@
 
         // Add WS-Addressing UsingAddressing element if appropriate
         // SHOULD be on the binding element per the specification
-        if (axisService.getWSAddressingFlag().equals(
+        if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_OPTIONAL)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
                                 DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
                     wsaw);
-        } else if (axisService.getWSAddressingFlag().equals(
+        } else if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_REQUIRED)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
@@ -815,10 +829,10 @@
             throws Exception {
         OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
         defintions.addChild(binding);
-        binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
+        binding.addAttribute(ATTRIBUTE_NAME, serviceName
                 + HTTP_BINDING, null);
         binding.addAttribute("type", tns.getPrefix() + ":"
-                + axisService.getName() + PORT_TYPE_SUFFIX, null);
+                + serviceName + PORT_TYPE_SUFFIX, null);
 
         // Adding ext elements
         OMElement httpBinding = fac.createOMElement("binding", http);
@@ -838,7 +852,7 @@
 
             OMElement httpOperation = fac.createOMElement("operation", http);
             operation.addChild(httpOperation);
-            httpOperation.addAttribute("location", axisService.getName() + "/" + axisOperation.getName()
+            httpOperation.addAttribute("location", serviceName + "/" + axisOperation.getName()
                     .getLocalPart(), null);
 
             String MEP = axisOperation.getMessageExchangePattern();

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Tue Jan 15 08:21:22 2008
@@ -19,52 +19,58 @@
 package org.apache.axis2.description;
 
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMText;
 import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axis2.util.XMLUtils;
-import org.apache.axis2.util.WSDLSerializationUtil;
-import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.WSDLSerializationUtil;
+import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaType;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 import org.apache.ws.commons.schema.XmlSchemaParticle;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
 
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.net.URI;
-import java.net.URISyntaxException;
 
 public class AxisService2WSDL20 implements WSDL2Constants {
 
     private AxisService axisService;
+    private String serviceName;
     private String[] eprs = null;
     private OMNamespace wsaw;
 
     public AxisService2WSDL20(AxisService service) {
         this.axisService = service;
+        this.serviceName = service.getName();
+    }
+
+    public AxisService2WSDL20(AxisService service, String serviceName) {
+        this.axisService = service;
+        this.serviceName = serviceName;
     }
 
     /**
@@ -94,7 +100,8 @@
         // Declare all the defined namespaces in the document
         WSDLSerializationUtil.populateNamespaces(descriptionElement, nameSpacesMap);
 
-        descriptionElement.declareNamespace(axisService.getTargetNamespace(), axisService.getTargetNamespacePrefix());
+        descriptionElement.declareNamespace(axisService.getTargetNamespace(),
+                                            axisService.getTargetNamespacePrefix());
         wsaw = descriptionElement.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
         // Need to add the targetnamespace as an attribute according to the wsdl 2.0 spec
         OMAttribute targetNamespace = omFactory
@@ -112,9 +119,6 @@
         OMNamespace tns = omFactory
                 .createOMNamespace(axisService.getTargetNamespace(),
                                    axisService.getTargetNamespacePrefix());
-        if (nameSpacesMap != null && !nameSpacesMap.containsValue(WSDL2Constants.WSDL_NAMESPACE)) {
-            descriptionElement.declareDefaultNamespace(WSDL2Constants.WSDL_NAMESPACE);
-        }
         if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_SOAP)) {
             wsoap = omFactory
                     .createOMNamespace(WSDL2Constants.URI_WSDL2_SOAP,
@@ -153,7 +157,8 @@
         }
 
         // Add the documentation element
-        WSDLSerializationUtil.addWSDLDocumentationElement(axisService, descriptionElement, omFactory, wsdl);
+        WSDLSerializationUtil
+                .addWSDLDocumentationElement(axisService, descriptionElement, omFactory, wsdl);
 
         // Add types element
         OMElement typesElement = omFactory.createOMElement(WSDL2Constants.TYPES_LOCAL_NALE, wsdl);
@@ -217,7 +222,7 @@
         if (endpointMap != null && endpointMap.size() > 0) {
             String[] eprs = axisService.getEPRs();
             if (eprs == null) {
-                eprs = new String[]{axisService.getName()};
+                eprs = new String[]{serviceName};
             }
             OMElement serviceElement = getServiceElement(wsdl, tns, omFactory, interfaceName);
             Iterator iterator = endpointMap.values().iterator();
@@ -239,9 +244,10 @@
                 }
                 
                 // If SOAP 1.2 binding is disabled, do not add.
-                String propertySOAPVersion = (String)axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
-                if (propertySOAPVersion != null) {
-                    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(propertySOAPVersion)) {
+                String propertySOAPVersion =
+                        (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
+                if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(propertySOAPVersion)) {
+                    if (disableSOAP12) {
                         continue;
                     }
                 }
@@ -278,8 +284,8 @@
                         .addChild(binding.toWSDL20(wsdl, tns, wsoap, whttp,
                                                    interfaceName,
                                                    axisService.getNamespaceMap(),
-                                                   axisService.getWSAddressingFlag(),
-                                                   axisService.getName(),wsaw));
+                                                   AddressingHelper.getAddressingRequirementParemeterValue(axisService),
+                                                   serviceName,wsaw));
             }
 
             descriptionElement.addChild(serviceElement);
@@ -288,21 +294,23 @@
             // There are no andpoints defined hence generate default bindings and endpoints
             descriptionElement.addChild(
                     WSDLSerializationUtil.generateSOAP11Binding(omFactory, axisService, wsdl, wsoap,
-                                                                tns));
+                                                                tns, serviceName));
             if (!disableSOAP12) {
             descriptionElement.addChild(
                     WSDLSerializationUtil.generateSOAP12Binding(omFactory, axisService, wsdl, wsoap,
-                                                                tns));
+                                                                tns, serviceName));
             }
             if (!disableREST) {
                 descriptionElement.addChild(
                         WSDLSerializationUtil.generateHTTPBinding(omFactory, axisService, wsdl,
                                                                   whttp,
-                                                                  tns));
+                                                                  tns, serviceName));
             }
             descriptionElement
                     .addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl, tns,
-                                                                           axisService, disableREST, disableSOAP12, eprs));
+                                                                           axisService, disableREST,
+                                                                           disableSOAP12, eprs,
+                                                                          serviceName));
         }
 
         return descriptionElement;
@@ -376,7 +384,7 @@
                 omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl);
         serviceElement.addAttribute(
                 omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null,
-                                            axisService.getName()));
+                                            serviceName));
         serviceElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME,
                                                                 null, tns.getPrefix() + ":" +
                 interfaceName));
@@ -403,10 +411,12 @@
         OMFactory omFactory = OMAbstractFactory.getOMFactory();
         OMElement axisOperationElement =
                 omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl);
-        WSDLSerializationUtil.addWSDLDocumentationElement(axisOperation, axisOperationElement, omFactory, wsdl);
+        WSDLSerializationUtil
+                .addWSDLDocumentationElement(axisOperation, axisOperationElement, omFactory, wsdl);
         axisOperationElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
                                                                       null,
-                                                                      axisOperation.getName().getLocalPart()));
+                                                                      axisOperation
+                                                                              .getName().getLocalPart()));
         URI[] opStyle = (URI[]) axisOperation.getParameterValue(WSDL2Constants.OPERATION_STYLE);
         if (opStyle == null) {
             opStyle = checkStyle(axisOperation);
@@ -444,7 +454,9 @@
         AxisMessage inMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_IN_MESSAGE);
         if (inMessage != null) {
             OMElement inMessageElement = omFactory.createOMElement(WSDL2Constants.IN_PUT_LOCAL_NAME, wsdl);
-            inMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap)));
+            inMessageElement.addAttribute(omFactory.createOMAttribute(
+                    WSDL2Constants.ATTRIBUTE_ELEMENT, null,
+                    WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap)));
             WSDLSerializationUtil.addWSAWActionAttribute(inMessageElement, axisOperation.getInputAction(),wsaw);
             WSDLSerializationUtil.addWSDLDocumentationElement(inMessage, inMessageElement, omFactory, wsdl);
             axisOperationElement.addChild(inMessageElement);
@@ -454,7 +466,9 @@
         AxisMessage outMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_OUT_MESSAGE);
         if (outMessage != null) {
             OMElement outMessageElement = omFactory.createOMElement(WSDL2Constants.OUT_PUT_LOCAL_NAME, wsdl);
-            outMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap)));
+            outMessageElement.addAttribute(omFactory.createOMAttribute(
+                    WSDL2Constants.ATTRIBUTE_ELEMENT, null,
+                    WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap)));
             WSDLSerializationUtil.addWSAWActionAttribute(outMessageElement, axisOperation.getOutputAction(),wsaw);
             WSDLSerializationUtil.addWSDLDocumentationElement(outMessage, outMessageElement, omFactory, wsdl);
             axisOperationElement.addChild(outMessageElement);
@@ -472,9 +486,14 @@
                 } else {
                     faultElement = omFactory.createOMElement(WSDL2Constants.OUT_FAULT_LOCAL_NAME, wsdl);
                 }
-                faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + faultMessage.getName()));
-                WSDLSerializationUtil.addWSAWActionAttribute(faultElement, axisOperation.getFaultAction(faultMessage.getName()),wsaw);
-                WSDLSerializationUtil.addWSDLDocumentationElement(faultMessage, faultElement, omFactory, wsdl);
+                faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF,
+                                                                      null, tns.getPrefix() + ":" +
+                        faultMessage.getName()));
+                WSDLSerializationUtil.addWSAWActionAttribute(faultElement,
+                                                             axisOperation.getFaultAction(
+                                                                     faultMessage.getName()), wsaw);
+                WSDLSerializationUtil
+                        .addWSDLDocumentationElement(faultMessage, faultElement, omFactory, wsdl);
                 axisOperationElement.addChild(faultElement);
             }
         }
@@ -505,7 +524,7 @@
         }
 
         QName inMessageElementQname;
-        Map inMessageElementDetails = new HashMap();
+        Map inMessageElementDetails = new LinkedHashMap();
         AxisMessage inMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN);
         if (inMessage != null) {
             QName qName = inMessage.getElementQName();
@@ -524,7 +543,8 @@
                     XmlSchemaParticle particle = complexType.getParticle();
                     if (particle != null && particle instanceof XmlSchemaSequence){
                         XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle;
-                        XmlSchemaObjectCollection schemaObjectCollection = xmlSchemaSequence.getItems();
+                        XmlSchemaObjectCollection schemaObjectCollection =
+                                xmlSchemaSequence.getItems();
                         if (schemaObjectCollection != null) {
                             Iterator iterator = schemaObjectCollection.getIterator();
                             while (iterator.hasNext()) {
@@ -536,7 +556,8 @@
                                 if (innerElement.getRefName() != null) {
                                     return new URI [0];
                                 }
-                                if (innerElement.getMinOccurs() != 1 || innerElement.getMaxOccurs() != 1) {
+                                if (innerElement.getMinOccurs() != 1 ||
+                                        innerElement.getMaxOccurs() != 1) {
                                     isMultipart = false;
                                 }
                                 XmlSchemaType schemaType = innerElement.getSchemaType();
@@ -575,7 +596,7 @@
             return new URI [0];
         }
         AxisMessage outMessage = null;
-        Map outMessageElementDetails = new HashMap();                                    
+        Map outMessageElementDetails = new LinkedHashMap();
         if (isRPC && !WSDL2Constants.MEP_URI_IN_ONLY.equals(mep)) {
             outMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_OUT);
             QName qName = outMessage.getElementQName();
@@ -638,7 +659,8 @@
         int count = 0;
         if (isRPC) {
             styles.add(new URI(WSDL2Constants.STYLE_RPC));
-            axisOperation.addParameter(WSDL2Constants.ATTR_WRPC_SIGNATURE, generateRPCSignature(inMessageElementDetails,  outMessageElementDetails));
+            axisOperation.addParameter(WSDL2Constants.ATTR_WRPC_SIGNATURE, generateRPCSignature(
+                    inMessageElementDetails, outMessageElementDetails));
             count ++;
         }
         if (isIRI) {
@@ -672,8 +694,8 @@
         Iterator outElementIterator = outElementSet.iterator();
         while (outElementIterator.hasNext()) {
             String outElementName = (String) outElementIterator.next();
-            out = out + outElementName + " " + WSDL2Constants.RPC_OUT + " ";
+            out = out + outElementName + " " + WSDL2Constants.RPC_RETURN + " ";
         }
         return in + out + inOut;
     }
-}
+}
\ No newline at end of file

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/ClientUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/ClientUtils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/ClientUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/ClientUtils.java Tue Jan 15 08:21:22 2008
@@ -97,7 +97,7 @@
             }
         }
         TransportInDescription transportIn = null;
-        if (options.isUseSeparateListener()) {
+        if (options.isUseSeparateListener() || msgCtxt.getOptions().isUseSeparateListener()) {
             if ((listenerTransportProtocol != null) && !"".equals(listenerTransportProtocol)) {
                 transportIn = ac.getTransportIn(listenerTransportProtocol);
                 ListenerManager listenerManager =

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Tue Jan 15 08:21:22 2008
@@ -186,7 +186,7 @@
          * async calls alone.
          */
         boolean useAsync = false;
-        if (!options.isUseSeparateListener()) {
+        if (!mc.getOptions().isUseSeparateListener()) {
             Boolean useAsyncOption =
                     (Boolean) mc.getProperty(Constants.Configuration.USE_ASYNC_OPERATIONS);
             if (useAsyncOption != null) {
@@ -206,7 +206,7 @@
             }
         }
 
-        if (useAsync || options.isUseSeparateListener()) {
+        if (useAsync || mc.getOptions().isUseSeparateListener()) {
             sendAsync(useAsync, mc);
         } else {
             if (block) {
@@ -224,7 +224,7 @@
             throws AxisFault {
         if (log.isDebugEnabled()) {
             log.debug("useAsync=" + useAsync + ", seperateListener=" +
-                    options.isUseSeparateListener());
+                    mc.getOptions().isUseSeparateListener());
         }
         /**
          * We are following the async path. If the user hasn't set a callback object then we must

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Tue Jan 15 08:21:22 2008
@@ -19,10 +19,18 @@
 package org.apache.axis2.description;
 
 import com.ibm.wsdl.util.xml.DOM2Writer;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
 import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.util.RESTUtil;
@@ -87,6 +95,19 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+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;
 import java.io.InputStream;
 import java.util.*;
@@ -242,7 +263,7 @@
     /**
      * sets a custom WSDL locator
      *
-     * @param customWSDLResolver
+     * @param customResolver
      */
     public void setCustomWSDLResolver(WSDLLocator customResolver) {
         this.customWSDLResolver = customResolver;
@@ -494,7 +515,7 @@
 
         copyExtensibleElements(wsdl4jPort.getExtensibilityElements(), wsdl4jDefinition,
                                axisEndpoint, BINDING);
-
+        processEmbeddedEPR(wsdl4jPort.getExtensibilityElements(), axisEndpoint);
         addDocumentation(axisEndpoint, wsdl4jPort.getDocumentationElement());
         if (processedBindings.containsKey(wsdl4jBinding.getQName())) {
             axisEndpoint.setBinding(
@@ -513,10 +534,31 @@
                     isSetMessageQNames);
             processedBindings.put(wsdl4jBinding.getQName(), axisBinding);
         }
+    }
 
+    private void processEmbeddedEPR(List extensibilityElements, AxisEndpoint axisEndpoint) {
+    	Iterator eelts = extensibilityElements.iterator();
+    	while(eelts.hasNext()){
+    		ExtensibilityElement ee = (ExtensibilityElement)eelts.next();
+    		if(AddressingConstants.Final.WSA_ENDPOINT_REFERENCE.equals(ee.getElementType())){
+    			try {
+    				Element elt = ((UnknownExtensibilityElement)ee).getElement();
+    				OMElement eprOMElement = XMLUtils.toOM(elt);
+    				EndpointReference epr = EndpointReferenceHelper.fromOM(eprOMElement);
+    				Map referenceParameters = epr.getAllReferenceParameters();
+    				if(referenceParameters != null){
+    					axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, new ArrayList(referenceParameters.values()));
+    				}
+    			} catch (Exception e) {
+    				if(log.isDebugEnabled()){
+    					log.debug("Exception encountered processing embedded wsa:EndpointReference", e);
+    				}
+    			}
+    		}
+    	}
     }
 
-    private void populatePortType(PortType wsdl4jPortType,
+	private void populatePortType(PortType wsdl4jPortType,
                                   Definition portTypeWSDL) throws AxisFault {
         List wsdl4jOperations = wsdl4jPortType.getOperations();
 
@@ -908,18 +950,28 @@
      */
     private Port findPort(Map ports) {
         Port port;
+        Port returnPort = null;
         for (Iterator portsIterator = ports.values().iterator(); portsIterator.hasNext();) {
             port = (Port) portsIterator.next();
             List extensibilityElements = port.getExtensibilityElements();
             for (int i = 0; i < extensibilityElements.size(); i++) {
                 Object extElement = extensibilityElements.get(i);
                 if (extElement instanceof SOAP12Address) {
-                    // SOAP 1.2 address found - return that port and we are done
-                    return port;
+                    // SOAP 1.2 address found - keep this and loop until http address is found
+                    returnPort = port;
+                    String location = ((SOAP12Address)extElement).getLocationURI().trim();
+                    if ((location != null) && location.startsWith("http:")){
+                        // i.e we have found an http port so return from here
+                       break;
+                    }
                 }
             }
         }
 
+        if (returnPort != null){
+            return returnPort;
+        }
+
         for (Iterator portsIterator = ports.values().iterator(); portsIterator
                 .hasNext();) {
             port = (Port) portsIterator.next();
@@ -927,12 +979,21 @@
             for (int i = 0; i < extensibilityElements.size(); i++) {
                 Object extElement = extensibilityElements.get(i);
                 if (extElement instanceof SOAPAddress) {
-                    // SOAP 1.1 address found - return that port and we are done
-                    return port;
+                    // SOAP 1.1 address found - keep this and loop until http address is found
+                    returnPort = port;
+                    String location = ((SOAPAddress)extElement).getLocationURI().trim();
+                    if ((location != null) && location.startsWith("http:")){
+                        // i.e we have found an http port so return from here
+                       break;
+                    }
                 }
             }
         }
 
+        if (returnPort != null){
+            return returnPort;
+        }
+
         for (Iterator portsIterator = ports.values().iterator(); portsIterator
                 .hasNext();) {
             port = (Port) portsIterator.next();
@@ -940,13 +1001,17 @@
             for (int i = 0; i < extensibilityElements.size(); i++) {
                 Object extElement = extensibilityElements.get(i);
                 if (extElement instanceof HTTPAddress) {
-                    // SOAP 1.1 address found - return that port and we are done
-                    return port;
+                    // HTTP address found - keep this and loop until http address is found
+                    returnPort = port;
+                    String location = ((HTTPAddress)extElement).getLocationURI().trim();
+                    if ((location != null) && location.startsWith("http:")){
+                        // i.e we have found an http port so return from here
+                       break;
+                    }
                 }
             }
         }
-        // None found - just return null.
-        return null;
+        return returnPort;
     }
 
     private Operation findOperation(PortType portType,
@@ -1745,15 +1810,9 @@
             // SOAP 1.1 body element found!
             if (extElement instanceof SOAPBody) {
                 SOAPBody soapBody = (SOAPBody) extElement;
-                if ((soapBody.getUse() != null) && (soapBody.getUse().equals(ENCODED_USE))) {
-                    throw new WSDLProcessingException("Encoded use is not supported");
-                }
                 partsList = soapBody.getParts();
             } else if (extElement instanceof SOAP12Body) {
                 SOAP12Body soapBody = (SOAP12Body) extElement;
-                if ((soapBody.getUse() != null) && (soapBody.getUse().equals(ENCODED_USE))) {
-                    throw new WSDLProcessingException("Encoded use is not supported");
-                }
                 partsList = soapBody.getParts();
             } else if (extElement instanceof MIMEMultipartRelated) {
                 MIMEMultipartRelated minMimeMultipartRelated = (MIMEMultipartRelated) extElement;
@@ -1772,15 +1831,9 @@
                             mimePartExtensibilityElement = (ExtensibilityElement) mimePartElementsIter.next();
                             if (mimePartExtensibilityElement instanceof SOAPBody) {
                                 SOAPBody soapBody = (SOAPBody) mimePartExtensibilityElement;
-                                if ((soapBody.getUse() != null) && (soapBody.getUse().equals(ENCODED_USE))) {
-                                    throw new WSDLProcessingException("Encoded use is not supported");
-                                }
                                 partsList = soapBody.getParts();
                             } else if (mimePartExtensibilityElement instanceof SOAP12Body) {
                                 SOAP12Body soapBody = (SOAP12Body) mimePartExtensibilityElement;
-                                if ((soapBody.getUse() != null) && (soapBody.getUse().equals(ENCODED_USE))) {
-                                    throw new WSDLProcessingException("Encoded use is not supported");
-                                }
                                 partsList = soapBody.getParts();
                             }
                         }
@@ -2115,11 +2168,9 @@
                     if (originOfExtensibilityElements.equals(PORT)
                         || originOfExtensibilityElements.equals(BINDING)) {
                         if (Boolean.TRUE.equals(unknown.getRequired())) {
-                            axisService
-                                    .setWSAddressingFlag(AddressingConstants.ADDRESSING_REQUIRED);
+                        	AddressingHelper.setAddressingRequirementParemeterValue(axisService, AddressingConstants.ADDRESSING_REQUIRED);
                         } else {
-                            axisService
-                                    .setWSAddressingFlag(AddressingConstants.ADDRESSING_OPTIONAL);
+                        	AddressingHelper.setAddressingRequirementParemeterValue(axisService, AddressingConstants.ADDRESSING_OPTIONAL);
                         }
                     }
 



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