axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r512604 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/ kernel/conf/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/deployment/util/ kernel/src/org/apache/axis2/description/ kernel/src...
Date Wed, 28 Feb 2007 04:56:34 GMT
Author: deepal
Date: Tue Feb 27 20:56:33 2007
New Revision: 512604

URL: http://svn.apache.org/viewvc?view=rev&rev=512604
Log:
fixing AXIS2-1981
 - Now we generate wsdl for all the cases no matter what the MR is , but if the MR is not
RPC then we generate schema with xs:Any

Modified:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
Tue Feb 27 20:56:33 2007
@@ -70,6 +70,9 @@
     private NamespaceGenerator nsGen = null;
 
     private String targetNamespace = null;
+    //to keep the list of operation which uses MR other than RPC MR
+    private ArrayList nonRpcMethods = new ArrayList();
+
 
     public NamespaceGenerator getNsGen() throws Exception {
         if ( nsGen == null ) {
@@ -220,7 +223,12 @@
                             parameterName = (parameterNames != null && parameterNames[j]
!= null) ? parameterNames[j] : getSimpleName(methodParameter);
                         }
                         JClass paraType = methodParameter.getType();
-                        generateSchemaForType(sequence, paraType,parameterName);
+                        if(nonRpcMethods.contains(getSimpleName(jMethod))){
+                            generateSchemaForType(sequence, null,getSimpleName(jMethod));
+                            break;
+                        } else {
+                            generateSchemaForType(sequence, paraType,parameterName);
+                        }
                     }
                     // for its return type
                     JClass returnType = jMethod.getReturnType();
@@ -230,16 +238,19 @@
                         sequence = new XmlSchemaSequence();
                         methodSchemaType.setParticle(sequence);
                         JAnnotation returnAnnon= jMethod.getAnnotation(AnnotationConstants.WEB_RESULT);
+                        String returnName ="return";
                         if(returnAnnon!=null){
-                            String returnName= returnAnnon.getValue(AnnotationConstants.NAME).asString();
+                            returnName= returnAnnon.getValue(AnnotationConstants.NAME).asString();
                             if(returnName!=null&&!"".equals(returnName)){
-                                generateSchemaForType(sequence, returnType, returnName);
-                            } else{
-                                generateSchemaForType(sequence, returnType, "return");
+                                returnName ="return";
                             }
-                        } else{
-                            generateSchemaForType(sequence, returnType, "return");
                         }
+                        if(nonRpcMethods.contains(getSimpleName(jMethod))){
+                            generateSchemaForType(sequence, null, returnName);
+                        } else {
+                            generateSchemaForType(sequence, returnType, returnName);
+                        }
+
                     }
                 }
             } else {
@@ -366,12 +377,20 @@
     }
 
     private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName)
throws Exception {
-        boolean isArrayType = type.isArrayType();
+
+        boolean isArrayType = false;
+        if(type!=null){
+            isArrayType = type.isArrayType();
+        }
         if (isArrayType) {
             type = type.getArrayComponentType();
         }
-
-        String classTypeName = getQualifiedName(type);
+        String classTypeName;
+        if(type==null){
+            classTypeName = "java.lang.Object";
+        } else {
+            classTypeName = getQualifiedName(type);
+        }
         if (isArrayType && "byte".equals(classTypeName)) {
             classTypeName = "base64Binary";
             isArrayType = false;
@@ -608,7 +627,9 @@
     protected String getQualifiedName(JPackage packagez){
         return packagez.getQualifiedName();
     }
-
-
-
+    public void setNonRpcMethods(ArrayList nonRpcMethods) {
+        if(nonRpcMethods!=null){
+            this.nonRpcMethods = nonRpcMethods;
+        }
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml Tue Feb 27 20:56:33 2007
@@ -87,11 +87,15 @@
     <!--all the other MEP implement it and add the correct entry to here , so that you
can refer from-->
     <!--any operation -->
     <!--Note : You can ovride this for particular service by adding the same element with
your requirement-->
-    <messageReceivers>
+     <messageReceivers>
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
                          class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                          class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
     </messageReceivers>
 
     <!-- ================================================= -->
@@ -221,17 +225,17 @@
     <!--<moduleConfig name="addressing">-->
     <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
     <!--</moduleConfig>-->
-
-    <!-- ================================================= -->
-    <!-- Clustering  -->
-    <!-- ================================================= -->
-    <!-- Configure and uncomment following for preparing Axis2 to a clustered environment
-->
-    <!-- 
-    <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
-    	<parameter name="param1" locked="false">value1</parameter>
-    </cluster>
-     -->
-     
+
+    <!-- ================================================= -->
+    <!-- Clustering  -->
+    <!-- ================================================= -->
+    <!-- Configure and uncomment following for preparing Axis2 to a clustered environment
-->
+    <!-- 
+    <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
+    	<parameter name="param1" locked="false">value1</parameter>
+    </cluster>
+     -->
+     
     <!-- ================================================= -->
     <!-- Phases  -->
     <!-- ================================================= -->

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
Tue Feb 27 20:56:33 2007
@@ -106,8 +106,7 @@
      * @param service :
      *                This can be null <code>AxisService</code>
      */
-    protected MessageReceiver loadDefaultMessageReceiver(String mepURL,
-                                                         AxisService service) {
+    protected MessageReceiver loadDefaultMessageReceiver(String mepURL,                 
                                      AxisService service) {
         MessageReceiver messageReceiver;
         if (mepURL == null) {
             mepURL = WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT;
@@ -116,7 +115,7 @@
             messageReceiver = service.getMessageReceiver(mepURL);
             if (messageReceiver != null) {
                 return messageReceiver;
-        }
+            }
         }
         return axisConfig.getMessageReceiver(mepURL);
     }
@@ -248,7 +247,6 @@
     /**
      * Processes the message builders specified in axis2.xml or services.xml.
      * 
-     * @param messageBuildersElement
      */
     protected HashMap processMessageFormatters(OMElement messageFormattersElement)
     throws DeploymentException {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
Tue Feb 27 20:56:33 2007
@@ -306,20 +306,19 @@
             if (objectSupplierValue != null) {
                 loadObjectSupplierClass(objectSupplierValue);
             }
+             // Set the default message receiver for the operations that were
+            // not listed in the services.xml
+            setDefaultMessageReceivers();
             if (!service.isUseUserWSDL()) {
                 // Generating schema for the service if the impl class is Java
                 if (!service.isWsdlFound()) {
                     //trying to generate WSDL for the service using JAM  and Java reflection
                     try {
                         if (generateWsdl(service)) {
-                            Utils.fillAxisService(service, axisConfig, excludeops);
+                            Utils.fillAxisService(service, axisConfig, excludeops,null);
                         } else {
                             ArrayList nonRpcOperations = getNonPRCMethods(service);
-                            for (int i = 0; i < excludeops.size(); i++) {
-                                String opName = (String) excludeops.get(i);
-                                nonRpcOperations.add(opName);
-                                Utils.fillAxisService(service, axisConfig, nonRpcOperations);
-                            }
+                            Utils.fillAxisService(service, axisConfig, excludeops, nonRpcOperations);
                         }
                     } catch (Exception e) {
                         throw new DeploymentException(
@@ -340,16 +339,8 @@
                 service.removeOperation(new QName(opName));
             }
 
-            // Set the default message receiver for the operations that were
-            // not listed in the services.xml
-            Iterator operations = service.getPublishedOperations().iterator();
-            while (operations.hasNext()) {
-                AxisOperation operation = (AxisOperation) operations.next();
-                if (operation.getMessageReceiver() == null) {
-                    operation.setMessageReceiver(loadDefaultMessageReceiver(
-                            operation.getMessageExchangePattern(), service));
-                }
-            }
+            // Need to call the same logic towice
+            setDefaultMessageReceivers();
             Iterator moduleConfigs = service_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
             processServiceModuleConfig(moduleConfigs, service, service);
             
@@ -368,6 +359,17 @@
                             DeploymentErrorMsgs.OPERATION_PROCESS_ERROR, axisFault.getMessage()),
axisFault);
         }
         return service;
+    }
+
+    private void setDefaultMessageReceivers() {
+        Iterator operations = service.getPublishedOperations().iterator();
+        while (operations.hasNext()) {
+            AxisOperation operation = (AxisOperation) operations.next();
+            if (operation.getMessageReceiver() == null) {
+                operation.setMessageReceiver(loadDefaultMessageReceiver(
+                        operation.getMessageExchangePattern(), service));
+            }
+        }
     }
 
     private void loadObjectSupplierClass(String objectSupplierValue) throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
Tue Feb 27 20:56:33 2007
@@ -51,6 +51,10 @@
                          class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                          class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
     </messageReceivers>
 
     <!-- ================================================= -->

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Tue Feb 27 20:56:33 2007
@@ -246,7 +246,8 @@
      */
     public static void fillAxisService(AxisService axisService,
                                        AxisConfiguration axisConfig,
-                                       ArrayList excludeOperations) throws Exception {
+                                       ArrayList excludeOperations,
+                                       ArrayList nonRpcMethods) throws Exception {
         String serviceClass;
         Parameter implInfoParam = axisService.getParameter(Constants.SERVICE_CLASS);
         ClassLoader serviceClassLoader = axisService.getClassLoader();
@@ -278,11 +279,7 @@
                 serviceClass = obj.getClass().getName();
             } else {
                 return;
-                //TODO : Need to fix this
-//                 throw new DeploymentException(
-//                            "ServiceClass or ServiceObjectSupplier implmentation Object
could not be found");
             }
-
         }
         // adding name spaces
         NamespaceMap map = new NamespaceMap();
@@ -295,6 +292,7 @@
                 serviceClass.trim(), axisService.getSchematargetNamespace(),
                 axisService.getSchematargetNamespacePrefix());
         schemaGenerator.setExcludeMethods(excludeOperations);
+        schemaGenerator.setNonRpcMethods(nonRpcMethods);
         if (!axisService.isElementFormDefault()) {
             schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Tue Feb 27 20:56:33 2007
@@ -911,34 +911,27 @@
 
     private void getWSDL(OutputStream out, String[] serviceURL,
             String servicePath) throws AxisFault {
-        if (this.wsdlFound) {
-        
-            // Retrieve WSDL using the same data retrieval path for GetMetadata request.
-            DataRetrievalRequest request = new DataRetrievalRequest();
-            request.putDialect(DRConstants.SPEC.DIALECT_TYPE_WSDL);
-            request.putOutputForm(OutputForm.INLINE_FORM);
+        // Retrieve WSDL using the same data retrieval path for GetMetadata request.
+        DataRetrievalRequest request = new DataRetrievalRequest();
+        request.putDialect(DRConstants.SPEC.DIALECT_TYPE_WSDL);
+        request.putOutputForm(OutputForm.INLINE_FORM);
                         
-            MessageContext context = new MessageContext();
-            context.setAxisService(this);
-            context.setTo(new EndpointReference(serviceURL[0]));
+        MessageContext context = new MessageContext();
+        context.setAxisService(this);
+        context.setTo(new EndpointReference(serviceURL[0]));
             
-            Data[] result = getData(request, context);
-            OMElement wsdlElement;
-            if (result != null && result[0] != null) {
-                wsdlElement = (OMElement) (result[0].getData());
-                try {
-                    wsdlElement.serialize(out);
-                    out.flush();
-                    out.close();
-                } catch (Exception e) {
-                    throw new AxisFault(e);
-                }
+        Data[] result = getData(request, context);
+        OMElement wsdlElement;
+        if (result != null && result[0] != null) {
+            wsdlElement = (OMElement) (result[0].getData());
+            try {
+                wsdlElement.serialize(out);
+                out.flush();
+                out.close();
+            } catch (Exception e) {
+                throw new AxisFault(e);
             }
-
-        } else {
-            printWSDLError(out);
         }
-
     }
 
     private void printWSDLError(OutputStream out) throws AxisFault {
@@ -993,20 +986,15 @@
     }
 
     private void getWSDL2(OutputStream out, String[] serviceURL) throws AxisFault {
-        if (this.wsdlFound) {
-            AxisService2WSDL2 axisService2WSDL2 = new AxisService2WSDL2(this, serviceURL);
-            try {
-                OMElement wsdlElement = axisService2WSDL2.generateOM();
-                wsdlElement.serialize(out);
-                out.flush();
-                out.close();
-            } catch (Exception e) {
-                throw new AxisFault(e);
-            }
-        } else {
-            printWSDLError(out);
+        AxisService2WSDL2 axisService2WSDL2 = new AxisService2WSDL2(this, serviceURL);
+        try {
+            OMElement wsdlElement = axisService2WSDL2.generateOM();
+            wsdlElement.serialize(out);
+            out.flush();
+            out.close();
+        } catch (Exception e) {
+            throw new AxisFault(e);
         }
-
     }
 
     /**
@@ -1519,7 +1507,7 @@
                                             String targetNamespace,
                                             String schemaNamespace,
                                             ClassLoader loader) throws AxisFault {
-         Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass);
+        Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass);
         OMElement paraElement = Utils.getParameter(Constants.SERVICE_CLASS, implClass, false);
         parameter.setParameterElement(paraElement);
         AxisService axisService = new AxisService();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=512604&r1=512603&r2=512604
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
Tue Feb 27 20:56:33 2007
@@ -264,50 +264,6 @@
         addServiceGroup(axisServiceGroup);
     }
 
-    /**
-     * This method will check whethere for a given service , can we ganerate
-     * valid wsdl or not. So if user drop a wsdl we print that out , else if
-     * all the operation uses RPC message receivers we will generate wsdl
-     *
-     * @param axisService
-     */
-    private void isWSDLEnable(AxisService axisService) {
-        if (!axisService.isWsdlFound()) {
-            Iterator operatins = axisService.getOperations();
-            if (operatins.hasNext()) {
-                while (operatins.hasNext()) {
-                    AxisOperation axisOperation = (AxisOperation) operatins
-                            .next();
-                    
-                    if (axisOperation.isControlOperation()) {
-                        continue;
-                    }
-                    
-                    if (axisOperation.getMessageReceiver() == null) {
-                        axisService.setWsdlFound(false);
-                        return;
-                    }
-                    String messageReceiverClass = axisOperation
-                            .getMessageReceiver().getClass().getName();
-                    if (!("org.apache.axis2.rpc.receivers.RPCMessageReceiver"
-                            .equals(messageReceiverClass)
-                            || "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
-                            .equals(messageReceiverClass)
-                            || "org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver"
-                            .equals(messageReceiverClass)
-                            || "org.apache.axis2.jaxws.server.JAXWSMessageReceiver"
-                            .equals(messageReceiverClass))) {
-                        axisService.setWsdlFound(false);
-                        return;
-                    }
-                }
-                axisService.setWsdlFound(true);
-            } else {
-                axisService.setWsdlFound(false);
-            }
-        }
-    }
-
     public synchronized void addServiceGroup(AxisServiceGroup axisServiceGroup)
             throws AxisFault {
         notifyObservers(AxisEvent.SERVICE_DEPLOY, axisServiceGroup);
@@ -326,7 +282,6 @@
                 axisService
                         .setSchematargetNamespace(Java2WSDLConstants.AXIS2_XSD);
             }
-            isWSDLEnable(axisService);
         }
         services = axisServiceGroup.getServices();
         while (services.hasNext()) {



---------------------------------------------------------------------
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