axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r568060 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/ codegen/src/org/apache/axis2/wsdl/cod...
Date Tue, 21 Aug 2007 11:06:43 GMT
Author: amilas
Date: Tue Aug 21 04:06:31 2007
New Revision: 568060

URL: http://svn.apache.org/viewvc?rev=568060&view=rev
Log:
commited the patch for Axis2-3135

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/AnnotationElementBuilder.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWS20Emitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWSEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
Tue Aug 21 04:06:31 2007
@@ -137,12 +137,12 @@
 # file extension for generated source files from this language
 c.filename.extension=c
 
-jax-ws.callback.template=org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter,/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl
 jax-ws.exception.template=org.apache.axis2.wsdl.codegen.writer.ExceptionWriter,/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl
+jax-ws.interface.impl.template=org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceImplTemplate.xsl
 jax-ws.skeleton.template=org.apache.axis2.wsdl.codegen.writer.SkeletonWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl
 jax-ws.skeleton.interface.template=org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl
 jax-ws.testclass.template=org.apache.axis2.wsdl.codegen.writer.TestClassWriter,/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
-jax-ws.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
+jax-ws.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceXMLTemplate.xsl
 jax-ws.antbuild.jaxbri.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/jaxbriAntBuildTemplate.xsl
 jax-ws.antbuild.none.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl
 # file extension for generated files from this language

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
Tue Aug 21 04:06:31 2007
@@ -207,6 +207,9 @@
 
     protected static final String TEST_SRC_DIR_NAME = "test";
 
+    protected boolean useHolderClass_jaxws = false;
+    protected boolean wrapped_jaxws = false;
+
 
     /**
      * default constructor - builds
@@ -2160,12 +2163,25 @@
         addAttribute(doc, "namespace", axisOperation.getName().getNamespaceURI(), methodElement);
         addAttribute(doc, "style", (String) getBindingPropertyFromOperation(
                 WSDLConstants.WSDL_1_1_STYLE, axisOperation.getName()), methodElement);
-        addAttribute(doc, "parameterstyle", (axisOperation.getParameter(
-                Constants.UNWRAPPED_KEY) != null)?"WRAPPPED":"BARE", methodElement);
+
+        String messageExchangePattern = axisOperation.getMessageExchangePattern();
+        
+        //Jaxws Specific
+        if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){
+            boolean wrapped = false;
+            if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) {
+                AxisMessage msg = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                if(msg.getParameter(Constants.UNWRAPPED_KEY) != null){
+                    wrapped = true;
+                }
+            }
+            addAttribute(doc, "parameterstyle", (wrapped)?"WRAPPPED":"BARE", methodElement);
+        }
+
+        
         addAttribute(doc, "dbsupportname",
                 endpointName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
                 methodElement);
-        String messageExchangePattern = axisOperation.getMessageExchangePattern();
         addAttribute(doc, "mep", Utils.getAxisSpecifMEPConstant(messageExchangePattern) +
"",
                 methodElement);
         addAttribute(doc, "mepURI", messageExchangePattern, methodElement);
@@ -2195,18 +2211,20 @@
         
 
         if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) {
-            methodElement.appendChild(getInputElement(doc,
-                    axisOperation, soapHeaderInputParameterList));
             if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){
+                useHolderClass_jaxws = false;
                 AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (WSDLUtil.isOutputPresentForMEP(messageExchangePattern)) {
                     AxisMessage outMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                     if(inMessage.getName().equals(outMessage.getName())){
                         // in/out message
+                        useHolderClass_jaxws = true;
                         addAttribute(doc, "useholder", "true", methodElement);
                     }
                 }
             }
+            methodElement.appendChild(getInputElement(doc,
+                    axisOperation, soapHeaderInputParameterList));
         }
         if (WSDLUtil.isOutputPresentForMEP(messageExchangePattern)) {
             methodElement.appendChild(getOutputElement(doc,
@@ -2872,7 +2890,7 @@
                 MessagePartInformationHolder infoHolder =
                         (MessagePartInformationHolder) detailsParameter.getValue();
                 List partsList = infoHolder.getPartsList();
-
+                wrapped_jaxws = true;
                 //populate the parts list - this list is needed to generate multiple
                 //parameters in the signatures
                 for (int i = 0; i < partsList.size(); i++) {
@@ -2974,6 +2992,13 @@
         Element paramElement = doc.createElement("param");
         addAttribute(doc, "name",
                 paramName, paramElement);
+
+        if (codeGenConfiguration.getOutputLanguage().equals("jax-ws") && useHolderClass_jaxws)
{
+            Class primitive = JavaUtils.getWrapperClass(paramType);
+            if(primitive != null){
+                paramType = primitive.getName();    
+            }
+        }
 
         addAttribute(doc, "type",
                 (paramType == null) ? "" : paramType,

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/AnnotationElementBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/AnnotationElementBuilder.java?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/AnnotationElementBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/AnnotationElementBuilder.java
Tue Aug 21 04:06:31 2007
@@ -25,6 +25,19 @@
         return annotationElement;
     }
 
+    static Element buildWebServiceAnnotationElement(String endpointInterface, Document doc)
{
+
+        Element annotationElement = doc.createElement("annotation");
+        XSLTUtils.addAttribute(doc, "name", "javax.jws.WebService", annotationElement);
+
+        Element paramElement = doc.createElement("param");
+        XSLTUtils.addAttribute(doc, "type", "endpointInterface", paramElement);
+        XSLTUtils.addAttribute(doc, "value", endpointInterface, paramElement);
+        annotationElement.appendChild(paramElement);
+
+        return annotationElement;
+    }
+
     static Element buildWebFaultAnnotationElement(String name, String targetNS, Document
doc) {
         Element annotationElement = doc.createElement("annotation");
         XSLTUtils.addAttribute(doc, "name", "javax.xml.ws.WebFault", annotationElement);

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWS20Emitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWS20Emitter.java?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWS20Emitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWS20Emitter.java
Tue Aug 21 04:06:31 2007
@@ -3,9 +3,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.apache.axis2.description.WSDL2Constants;
-import org.apache.axis2.util.JavaUtils;
-import org.apache.woden.internal.util.dom.DOM2Writer;
-
+import org.apache.axis2.AxisFault;
 import javax.xml.namespace.QName;
 import java.util.Iterator;
 
@@ -16,14 +14,18 @@
      *
      * @return DOM Document
      */
-    protected Document createDOMDocumentForSEI() {
+    protected Document createDOMDocumentForSEI() throws AxisFault {
         Document doc = getEmptyDocument();
         Element rootElement = doc.createElement("javaConstruct");
 
         Element importList = doc.createElement("importList");
         rootElement.appendChild(importList);
 
+        String packageName = codeGenConfiguration.getPackageName();
+        String targetNS = codeGenConfiguration.getTargetNamespace();
+        String portTypeName = (String) axisService.getParameterValue(WSDL2Constants.INTERFACE_LOCAL_NAME);
         portTypeName = resolveNameCollision(portTypeName, packageName, TYPE_SUFFIX);
+        this.axisService.addParameter(JAXWS_PORT_TYPE_NAME, portTypeName);
 
         addAttribute(doc, "package", packageName, rootElement);
         addAttribute(doc, "targetNamespace", targetNS, rootElement);
@@ -46,6 +48,45 @@
     }
 
     /**
+     * Creates the XML model for the Service Endpoint interface
+     *
+     * @return DOM Document
+     */
+    protected Document createDOMDocumentForSEIImpl() throws AxisFault {
+        Document doc = getEmptyDocument();
+        Element rootElement = doc.createElement("javaConstruct");
+
+        //Element importList = doc.createElement("importList");
+        //rootElement.appendChild(importList);
+
+        String packageName = codeGenConfiguration.getPackageName();
+        String targetNS = codeGenConfiguration.getTargetNamespace();
+        String portTypeName = (String) axisService.getParameterValue(WSDL2Constants.INTERFACE_LOCAL_NAME);
+        portTypeName = resolveNameCollision(portTypeName, packageName, TYPE_SUFFIX);
+        this.axisService.addParameter(JAXWS_PORT_TYPE_NAME, portTypeName);
+
+        addAttribute(doc, "package", packageName, rootElement);
+        addAttribute(doc, "targetNamespace", targetNS, rootElement);
+        addAttribute(doc, "name", axisService.getParameter(JAXWS_PORT_TYPE_NAME).getValue()
+ JAXWS_IMPL_SUFFIX,
+                rootElement);
+
+        Element annotationElement = AnnotationElementBuilder.buildWebServiceAnnotationElement(
+               packageName +"." +axisService.getParameter(JAXWS_PORT_TYPE_NAME).getValue(),
doc);
+        rootElement.appendChild(annotationElement);
+
+        loadOperations(doc, rootElement, null);
+
+        //attach a list of faults
+        rootElement.appendChild(getUniqueListofFaults(doc));
+        doc.appendChild(rootElement);
+        //////////////////////////////////////////////////////////
+//        System.out.println(DOM2Writer.nodeToString(rootElement));
+        ////////////////////////////////////////////////////////////
+        return doc;
+
+    }
+
+    /**
      * Creates the XML model for the Service Class
      *
      * @return DOM Document
@@ -57,8 +98,11 @@
         Element importList = doc.createElement("importList");
         rootElement.appendChild(importList);
 
+        String serviceName = axisService.getName();
         String capitalizedServiceName = serviceName.toUpperCase();
         String wsdlLocation = "Needs to be fixed";
+        String packageName = codeGenConfiguration.getPackageName();
+        String targetNS = codeGenConfiguration.getTargetNamespace();
 
         serviceName = resolveNameCollision(serviceName, packageName, TYPE_SUFFIX);
 
@@ -68,12 +112,6 @@
         addAttribute(doc, "wsdlLocation", wsdlLocation, rootElement);
         addAttribute(doc, "capitalizedServiceName", capitalizedServiceName, rootElement);
 
-        //Adding annotations -- tempory solution  hardcoded solution
-//        Element importElement;
-//        importElement = doc.createElement("import");
-//        addAttribute(doc, "value", "java.net.URL", importElement);
-//        importList.appendChild(importElement);
-
         Element annotationElement = AnnotationElementBuilder.buildWebServiceClientAnnotationElement(serviceName,
                 targetNS, wsdlLocation, doc);
         rootElement.appendChild(annotationElement);
@@ -84,7 +122,8 @@
 
             Element portElement = doc.createElement("port");
             addAttribute(doc, "portName", portName, portElement);
-            addAttribute(doc, "portTypeName", portTypeName, portElement);
+            addAttribute(doc, "portTypeName", (String) this.axisService.getParameter(JAXWS_PORT_TYPE_NAME).getValue(),
+                    portElement);
 
             Element endPointAnnoElement = AnnotationElementBuilder.buildWebEndPointAnnotationElement(portName,
doc);
             portElement.appendChild(endPointAnnoElement);
@@ -115,18 +154,20 @@
         Element importList = doc.createElement("importList");
         faultElement.appendChild(importList);
 
+        String packageName = codeGenConfiguration.getPackageName();
+        String targetNS = codeGenConfiguration.getTargetNamespace();
+
         addAttribute(doc, "package", packageName, faultElement);
         addAttribute(doc, "targetNamespace", targetNS, faultElement);
 
         String exceptionClassName = (String) faultClassNameMap.get(key);
-        exceptionClassName = resolveNameCollision(exceptionClassName, packageName, EXCEPTION_SUFFIX);
-        addAttribute(doc, "name",exceptionClassName, faultElement);
-//            addAttribute(doc, "shortName",
-//                    (String) faultClassNameMap.get(key) + "Exception",
-//                    faultElement);
+        String resolvedExpClass = resolveNameCollision(exceptionClassName, packageName, EXCEPTION_SUFFIX);
+
+        if (!resolvedExpClass.equals(exceptionClassName))
+            faultClassNameMap.put(key, resolvedExpClass);
+
+        addAttribute(doc, "name", resolvedExpClass, faultElement);
 
-        //the type represents the type that will be wrapped by this
-        //name
         String typeMapping =
                 this.mapper.getTypeMappingName((QName) faultElementQNameMap.get(key));
         String shortType = extratClassName(typeMapping);
@@ -144,14 +185,6 @@
         addAttribute(doc, "value", typeMapping, importElement);
         importList.appendChild(importElement);
 
-//            String attribValue = (String) instantiatableMessageClassNames.
-//                    get(key);
-//            addAttribute(doc, "instantiatableType",
-//                    attribValue == null ? "" : attribValue,
-//                    faultElement);
-
-        // add an extra attribute to say whether the type mapping is
-        // the default
         if (mapper.getDefaultMappingName().equals(typeMapping)) {
             addAttribute(doc, "default", "yes", faultElement);
         }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWSEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWSEmitter.java?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWSEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWSEmitter.java
Tue Aug 21 04:06:31 2007
@@ -1,15 +1,14 @@
 package org.apache.axis2.wsdl.codegen.emitter.jaxws;
 
 import org.w3c.dom.Document;
-import org.apache.axis2.wsdl.codegen.writer.FileWriter;
-import org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter;
-import org.apache.axis2.wsdl.codegen.writer.ExceptionWriter;
-import org.apache.axis2.wsdl.codegen.writer.SkeletonWriter;
+import org.w3c.dom.Element;
+import org.apache.axis2.wsdl.codegen.writer.*;
 import org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.AxisFault;
+
 import java.util.Iterator;
 import java.util.Map;
 
@@ -18,18 +17,11 @@
     protected final static String TYPE_SUFFIX = "Type";
     protected final static String SERVICE_SUFFIX = "Service";
     protected final static String EXCEPTION_SUFFIX = "Exception";
-
-    protected String portTypeName;
-    protected String serviceName;
-    protected String packageName;
-    protected String targetNS;
+    protected final static String JAXWS_PORT_TYPE_NAME = "JaxwsPortTypeName";
+    protected final static String JAXWS_IMPL_SUFFIX = "Impl";
 
     public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
         super.setCodeGenConfiguration(configuration);
-        portTypeName = (String) axisService.getParameterValue(WSDL2Constants.INTERFACE_LOCAL_NAME);
-        serviceName = axisService.getName();
-        targetNS = codeGenConfiguration.getTargetNamespace();
-        packageName = codeGenConfiguration.getPackageName();
     }
 
     public void emitSkeleton() throws CodeGenerationException {
@@ -56,11 +48,14 @@
                 //handle faults
                 generateAndPopulateFaultNames();
 
+                //write the Exceptions
+                writeExceptions();
+
                 //write the Service Endpoint Interface
                 writeServiceEndpointInterface();
 
-                //write the Exceptions
-                writeExceptions();
+                //write the Service Endpoint Interface
+                writeServiceEndpointInterfaceImpl();
 
                 //write the Service Class
                 writeServiceClass();
@@ -110,6 +105,19 @@
         writeFile(skeletonModel, skeletonInterfaceWriter);
     }
 
+    protected void writeServiceEndpointInterfaceImpl() throws Exception {
+        Document skeletonModel = createDOMDocumentForSEIImpl();
+        debugLogDocument("Document for Service Endpoint Interface:", skeletonModel);
+        FileWriter interfaceImplementationWriter = new InterfaceImplementationWriter(
+                codeGenConfiguration.isFlattenFiles() ?
+                        getOutputDirectory(codeGenConfiguration.getOutputLocation(), null)
:
+                        getOutputDirectory(codeGenConfiguration.getOutputLocation(),
+                                codeGenConfiguration.getSourceLocation())
+                , this.codeGenConfiguration.getOutputLanguage());
+
+        writeFile(skeletonModel, interfaceImplementationWriter);
+    }
+
     /**
      * Writes the exception calsses.
      */
@@ -153,12 +161,37 @@
         writeFile(skeletonModel, skeletonInterfaceWriter);
     }
 
+    protected Document createDOMDocumentForServiceXML() {
+        Document doc = getEmptyDocument();
+        String className = null;
+        String serviceName = null;
+        Element rootElement = doc.createElement("interfaces");
+        doc.appendChild(rootElement);
+
+        for (Iterator iter = this.axisServices.iterator(); iter.hasNext();) {
+            this.axisService = (AxisService) iter.next();
+            this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding();
+            serviceName = axisService.getName();
+            className = (String)axisService.getParameter(JAXWS_PORT_TYPE_NAME).getValue()
+ JAXWS_IMPL_SUFFIX;
+            rootElement.appendChild(getServiceElement(serviceName, className, doc));
+        }
+
+        return doc;
+    }
+
     /**
      * Creates the XML model for the Service Endpoint interface
      *
      * @return DOM Document
      */
-    protected abstract Document createDOMDocumentForSEI();
+    protected abstract Document createDOMDocumentForSEI() throws AxisFault;
+
+     /**
+     * Creates the XML model for the Service Endpoint interface Implementation class
+     *
+     * @return DOM Document
+     */
+    protected abstract Document createDOMDocumentForSEIImpl() throws AxisFault;
 
     /**
      * Creates the XML model for the Service Class
@@ -174,6 +207,48 @@
      * @return DOM Document
      */
     protected abstract Document createDOMDocumentForException(String key);
+
+    /**
+     * A resusable method to return the service element for creating the service xml
+     *
+     * @param serviceName
+     * @param className
+     * @param doc
+     * @return DOM Element
+     */
+    protected Element getServiceElement(String serviceName, String className, Document doc)
{
+
+        if (allServiceInfoHolder.get(serviceName) != null) {
+            this.infoHolder = (Map) allServiceInfoHolder.get(serviceName);
+        }
+        Element rootElement = doc.createElement("interface");
+
+        addAttribute(doc, "package", "", rootElement);
+        addAttribute(doc, "classpackage", codeGenConfiguration.getPackageName(), rootElement);
+        addAttribute(doc, "name", className, rootElement);
+
+        if (!codeGenConfiguration.isWriteTestCase()) {
+            addAttribute(doc, "testOmit", "true", rootElement);
+        }
+        addAttribute(doc, "servicename", serviceName, rootElement);
+
+        Iterator it = mepToClassMap.keySet().iterator();
+        while (it.hasNext()) {
+            Object key = it.next();
+
+            if (Boolean.TRUE.equals(infoHolder.get(key))) {
+                Element elt = addElement(doc, "messagereceiver",
+                        makeJavaClassName(serviceName) + mepToSuffixMap.get(key),
+                        rootElement);
+                addAttribute(doc, "mepURI", key.toString(), elt);
+            }
+
+        }
+
+        loadOperations(doc, rootElement, null);
+
+        return rootElement;
+    }
 
     //Util methods
     public String extratClassName(String fullyQualifiedName) {

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
Tue Aug 21 04:06:31 2007
@@ -61,7 +61,7 @@
     public void engage(CodeGenConfiguration configuration) throws CodeGenerationException
{
         this.codeGenConfiguration = configuration;
 
-        if (!configuration.isParametersWrapped()) {
+        if (!configuration.isParametersWrapped() && !codeGenConfiguration.getOutputLanguage().equals("jax-ws"))
{
 
             // A check to avoid nasty surprises - Since unwrapping is not
             // supported by all frameworks, we check the framework name to be

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl
Tue Aug 21 04:06:31 2007
@@ -12,8 +12,8 @@
 /**
  * <xsl:value-of select="@name"/>.java
  *
- * This class was generated by Apache Axis2.
- * Apache Axis2 {version} - {date} {time}
+ * This class was auto-generated from WSDL.
+ * Apache Axis2 version: #axisVersion# #today#
  *
  */
 <xsl:for-each select="annotation">

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl
Tue Aug 21 04:06:31 2007
@@ -17,8 +17,8 @@
 /**
  * <xsl:value-of select="@name"/>.java
  *
- * This class was generated by Apache Axis2.
- * Apache Axis2 {version} - {date} {time}
+ * This class was auto-generated from WSDL.
+ * Apache Axis2 version: #axisVersion# #today#
  *
  */
 <xsl:for-each select="annotation">

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl
Tue Aug 21 04:06:31 2007
@@ -1,6 +1,6 @@
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-    <xsl:output method="text"/>
+    <xsl:output method="text"/>                                                   
                
     <xsl:variable name="targetNs" select="/javaConstruct/@targetNamespace"/>
     <xsl:template match="javaConstruct">package <xsl:value-of select="@package"/>;
 <xsl:for-each select="importList/import">
@@ -10,9 +10,8 @@
 /**
  * <xsl:value-of select="@name"/>.java
  *
- * This class was generated by Apache Axis2.
- * Apache Axis2 {version} - {date} {time}
- *
+ * This class was auto-generated from WSDL.
+ * Apache Axis2 version: #axisVersion# #today#
  */
 <xsl:for-each select="annotation">
     <xsl:variable name="annoparamcount" select="count(param)"/>
@@ -20,14 +19,14 @@
         <xsl:choose>
             <xsl:when test="$annoparamcount = position()">
                 <xsl:value-of select="@type"/>
-                <xsl:text>=</xsl:text>"<xsl:value-of select="@value"/>"</xsl:when>
+                <xsl:text> = </xsl:text>"<xsl:value-of select="@value"/>"</xsl:when>
             <xsl:otherwise>
                 <xsl:value-of select="@type"/>
-                <xsl:text>=</xsl:text>"<xsl:value-of select="@value"/>",<xsl:text>
</xsl:text>
+                <xsl:text> = </xsl:text>"<xsl:value-of select="@value"/>",<xsl:text>
</xsl:text>
             </xsl:otherwise>
         </xsl:choose>
     </xsl:for-each>)</xsl:for-each>
-public interface <xsl:value-of select="@name"/>{
+public interface <xsl:value-of select="@name"/> {
 <xsl:apply-templates/>
 }
     </xsl:template>
@@ -36,13 +35,17 @@
     <xsl:variable name="outparamcount" select="count(output/param)"/>
     <xsl:variable name="parameterstyle" select="@parameterstyle"/>
     <xsl:variable name="useholder" select="@useholder"/>
-    <xsl:variable name="style" select="@style"/>    
-    /**<xsl:for-each select="input/param">
-    * @param <xsl:value-of select="@name"/></xsl:for-each><xsl:if test="$outparamcount
!= 0">
-    * @return
-    *    <xsl:value-of select="output/param/@shorttype"/></xsl:if><xsl:for-each
select="fault/param[@type!='']">
-    * @throws <xsl:value-of select="@name"/></xsl:for-each>
-    */
+    <xsl:variable name="style" select="@style"/>
+    <xsl:variable name="inputWrappedCount" select="count(input/param/param)"/>
+    <xsl:variable name="inparamcount" select="count(input/param)"/>
+    /**<xsl:choose><xsl:when test="$inputWrappedCount &gt; 0"><xsl:for-each
select="input/param/param">
+     * @param <xsl:value-of select="@name"/></xsl:for-each><xsl:if test="$outparamcount
!= 0">
+     * @return <xsl:value-of select="output/param/@shorttype"/></xsl:if><xsl:for-each
select="fault/param[@type!='']">
+     * @throws <xsl:value-of select="@name"/></xsl:for-each></xsl:when><xsl:otherwise><xsl:for-each
select="input/param">
+     * @param <xsl:value-of select="@name"/></xsl:for-each><xsl:if test="$outparamcount
!= 0">
+     * @return <xsl:value-of select="output/param/@shorttype"/></xsl:if><xsl:for-each
select="fault/param[@type!='']">
+     * @throws <xsl:value-of select="@shortName"/></xsl:for-each></xsl:otherwise>
</xsl:choose>
+     */
     @javax.jws.WebMethod<xsl:choose>
         <xsl:when test="$outparamcount = 0"><xsl:text>
     </xsl:text>@javax.jws.Oneway</xsl:when>
@@ -51,51 +54,98 @@
     </xsl:text>@javax.jws.WebResult(targetNamespace = "<xsl:value-of select="$targetNs"/>"<xsl:choose>
                 <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="output/param/@partname"/>"</xsl:when></xsl:choose>)</xsl:otherwise>
     </xsl:choose>
-    <xsl:if test="$parameterstyle = 'BARE'">
-    @javax.jws.soap.SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE)</xsl:if>
+    <xsl:choose>
+        <xsl:when test="$inputWrappedCount = 0">
+    @javax.jws.soap.SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE)</xsl:when>
+        <xsl:otherwise>
+    @javax.xml.ws.RequestWrapper(localName = "<xsl:value-of select="input/param/@name"/>",
targetNamespace = "<xsl:value-of select="$targetNs"/>", className = "<xsl:value-of
select="input/param/@type"/>")<xsl:if test="$outparamcount != 0">
+    @javax.xml.ws.ResponseWrapper(localName = "<xsl:value-of select="output/param/@name"/>",
targetNamespace = "<xsl:value-of select="$targetNs"/>", className = "<xsl:value-of
select="output/param/@type"/>")</xsl:if>
+        </xsl:otherwise>
+    </xsl:choose>
     public <xsl:choose>
                 <xsl:when test="$outparamcount = 0">void </xsl:when>
                 <xsl:when test="$useholder = 'true'">void </xsl:when>
+                <xsl:when test="$inputWrappedCount != 0"><xsl:value-of select="output/param/param/@type"/><xsl:text>
</xsl:text></xsl:when>               
                 <xsl:otherwise><xsl:value-of select="output/param/@type"/><xsl:text>
</xsl:text></xsl:otherwise>
            </xsl:choose>
-    <xsl:value-of select="@name"/>(<xsl:variable name="inparamcount" select="count(input/param)"/>
-    <xsl:choose>
+    <xsl:value-of select="@name"/>(<xsl:choose>
         <xsl:when test="$useholder = 'true'">
-    <xsl:for-each select="input/param">
-        @javax.jws.WebParam(name = "<xsl:value-of select="@name"/>", targetNamespace
= "<xsl:value-of select="$targetNs"/>", mode = javax.jws.WebParam.Mode.INOUT<xsl:choose>
-                <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="@partname"/>"</xsl:when></xsl:choose>)
-        <xsl:choose>
-            <xsl:when test="$inparamcount = position()">javax.xml.ws.Holder&lt;<xsl:value-of
select="@type"/>
+    <xsl:choose>
+        <xsl:when test="$inputWrappedCount = 0">
+        <xsl:for-each select="input/param">
+            @javax.jws.WebParam(name = "<xsl:value-of select="@name"/>", targetNamespace
= "<xsl:value-of select="$targetNs"/>", mode = javax.jws.WebParam.Mode.INOUT<xsl:choose>
+                <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="@partname"/>"</xsl:when></xsl:choose>)<xsl:choose>
+            <xsl:when test="$inparamcount = position()">
+            javax.xml.ws.Holder&lt;<xsl:value-of select="@type"/>
                 <xsl:text>&gt; </xsl:text>
                 <xsl:value-of select="@name"/>
             </xsl:when>
-            <xsl:otherwise>javax.xml.ws.Holder&lt;<xsl:value-of select="@type"/>
+            <xsl:otherwise>
+            javax.xml.ws.Holder&lt;<xsl:value-of select="@type"/>
                 <xsl:text>&gt; </xsl:text>
                 <xsl:value-of select="@name"/>,<xsl:text> </xsl:text>
             </xsl:otherwise>
         </xsl:choose>
-    </xsl:for-each></xsl:when>
-        <xsl:otherwise><xsl:for-each select="input/param">
-        @javax.jws.WebParam(name = "<xsl:value-of select="@name"/>", targetNamespace
= "<xsl:value-of select="$targetNs"/>"<xsl:choose>
-                <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="@partname"/>"</xsl:when></xsl:choose>)
-        <xsl:choose>
-            <xsl:when test="$inparamcount = position()">
-                <xsl:value-of select="@type"/>
-                <xsl:text> </xsl:text>
+        </xsl:for-each>
+        </xsl:when>
+        <xsl:otherwise>
+        <xsl:for-each select="input/param/param">
+            @javax.jws.WebParam(name = "<xsl:value-of select="@name"/>", targetNamespace
= "<xsl:value-of select="$targetNs"/>", mode = javax.jws.WebParam.Mode.INOUT<xsl:choose>
+                <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="@partname"/>"</xsl:when></xsl:choose>)<xsl:choose>
+            <xsl:when test="$inputWrappedCount = position()">
+            javax.xml.ws.Holder&lt;<xsl:value-of select="@type"/>
+                <xsl:text>&gt; </xsl:text>
                 <xsl:value-of select="@name"/>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:value-of select="@type"/>
-                <xsl:text> </xsl:text>
+            javax.xml.ws.Holder&lt;<xsl:value-of select="@type"/>
+                <xsl:text>&gt; </xsl:text>
                 <xsl:value-of select="@name"/>,<xsl:text> </xsl:text>
             </xsl:otherwise>
         </xsl:choose>
+        </xsl:for-each>
+        </xsl:otherwise>
+    </xsl:choose>
+   </xsl:when>
+        <xsl:when test="$inputWrappedCount &gt; 0">
+            <xsl:for-each select="input/param/param">
+            @javax.jws.WebParam(name = "<xsl:value-of select="@name"/>", targetNamespace
= "<xsl:value-of select="$targetNs"/>"<xsl:choose>
+                <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="@partname"/>"</xsl:when></xsl:choose>)
+            <xsl:choose>
+                <xsl:when test="$inputWrappedCount = position()">
+                    <xsl:value-of select="@type"/>
+                    <xsl:text> </xsl:text>
+                    <xsl:value-of select="@name"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="@type"/>
+                    <xsl:text> </xsl:text>
+                    <xsl:value-of select="@name"/>,<xsl:text> </xsl:text>
+                </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+        </xsl:when>
+        <xsl:otherwise><xsl:for-each select="input/param">
+            @javax.jws.WebParam(name = "<xsl:value-of select="@name"/>", targetNamespace
= "<xsl:value-of select="$targetNs"/>"<xsl:choose>
+                <xsl:when test="$parameterstyle = 'BARE'">, partName = "<xsl:value-of
select="@partname"/>"</xsl:when></xsl:choose>)
+            <xsl:choose>
+                <xsl:when test="$inparamcount = position()">
+                    <xsl:value-of select="@type"/>
+                    <xsl:text> </xsl:text>
+                    <xsl:value-of select="@name"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="@type"/>
+                    <xsl:text> </xsl:text>
+                    <xsl:value-of select="@name"/>,<xsl:text> </xsl:text>
+                </xsl:otherwise>
+            </xsl:choose>
     </xsl:for-each></xsl:otherwise>
-    </xsl:choose>)<!--<xsl:for-each select="fault/param[@type!='']">
+    </xsl:choose>)<xsl:for-each select="fault/param[@type!='']">
                <xsl:if test="position()=1">
-        throws </xsl:if>
-               <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/>
-           </xsl:for-each>-->;
+            throws </xsl:if>
+               <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@shortName"/>
+           </xsl:for-each>;
     </xsl:template>
 
 </xsl:stylesheet>

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java?rev=568060&r1=568059&r2=568060&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java Tue
Aug 21 04:06:31 2007
@@ -455,6 +455,28 @@
         return null;
     }
 
+    public static Class getWrapperClass(String primitive) {
+        if (primitive.equals("int")) {
+            return java.lang.Integer.class;
+        } else if (primitive.equals("short")) {
+            return java.lang.Short.class;
+        } else if (primitive.equals("boolean")) {
+            return java.lang.Boolean.class;
+        } else if (primitive.equals("byte")) {
+            return java.lang.Byte.class;
+        } else if (primitive.equals("long")) {
+            return java.lang.Long.class;
+        } else if (primitive.equals("double")) {
+            return java.lang.Double.class;
+        } else if (primitive.equals("float")) {
+            return java.lang.Float.class;
+        } else if (primitive.equals("char")) {
+            return java.lang.Character.class;
+        }
+
+        return null;
+    }
+
     /**
      * Scans the parameter string for the parameter search ignoring case when
      * comparing characters.



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


Mime
View raw message