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 de...@apache.org on 2007/03/01 12:33:29 UTC

svn commit: r513283 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/typemapping/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/deployment/util/ metadata/src/org/apache/axis2/jaxws/description/

Author: deepal
Date: Thu Mar  1 03:33:26 2007
New Revision: 513283

URL: http://svn.apache.org/viewvc?view=rev&rev=513283
Log:
Change POJO deloyer to use JAX-WS

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java?view=diff&rev=513283&r1=513282&r2=513283
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java Thu Mar  1 03:33:26 2007
@@ -36,6 +36,7 @@
     private static final String W_FLOAT = "java.lang.Float";
     private static final String W_CALENDAR = "java.util.Calendar";
     private static final String W_DATE = "java.util.Date";
+    private static final String W_DATA_HANDLER = "javax.activation.DataHandler";
     private static final String INT = "int";
     private static final String BOOLEAN = "boolean";
     private static final String BYTE = "byte";
@@ -133,7 +134,6 @@
     public static boolean isCollection(Class obj) {
         return java.util.Collection.class.isAssignableFrom(obj);
     }
-    
     public static boolean isSimpleType(String objClassName) {
         if (objClassName.equals(STRING)) {
             return true;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?view=diff&rev=513283&r1=513282&r2=513283
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Thu Mar  1 03:33:26 2007
@@ -2,6 +2,7 @@
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.MessageReceiver;
@@ -81,24 +82,20 @@
                              * nothing will happen) 2. In the next stage for all the methods
                              * messages and port types will be creteated
                              */
-                            boolean callJaxWs = false;
                             JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
                             if (annotation != null) {
-                                String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
-                                if (wsdlLocation != null && !"".equals(wsdlLocation)) {
-                                    callJaxWs = true;
-                                }
-                            }
-                            if (callJaxWs) {
                                 Class claxx = Class.forName(
                                         "org.apache.axis2.jaxws.description.DescriptionFactory");
                                 Method mthod = claxx.getMethod(
-                                        "createServiceDescriptionFromServiceImpl",
-                                        new Class[]{Class.class, AxisService.class});
+                                        "createAxisService",
+                                        new Class[]{Class.class});
                                 Class pojoClass = Loader.loadClass(classLoader, className);
-                                AxisService axisService = new AxisService(className);
-                                axisService.setName(className);
-                                mthod.invoke(claxx, new Object[]{pojoClass, axisService});
+                                AxisService axisService = (AxisService)mthod.invoke(claxx, new Object[]{pojoClass});
+                                Utils.fillAxisService(axisService,
+                                        configCtx.getAxisConfiguration(),
+                                        new ArrayList(),
+                                        new ArrayList());
+
                                 configCtx.getAxisConfiguration().addService(axisService);
                             } else {
                                 HashMap messageReciverMap = new HashMap();
@@ -177,46 +174,19 @@
                              * nothing will happen) 2. In the next stage for all the methods
                              * messages and port types will be creteated
                              */
-                            boolean callJaxWs = false;
                             JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
                             if (annotation != null) {
-                                String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
-                                if (wsdlLocation != null && !"".equals(wsdlLocation)) {
-                                    callJaxWs = true;
-                                }
-                            } else {
-                                continue;
-                            }
-                            if (callJaxWs) {
                                 Class claxx = Class.forName(
                                         "org.apache.axis2.jaxws.description.DescriptionFactory");
                                 Method mthod = claxx.getMethod(
-                                        "createServiceDescriptionFromServiceImpl",
-                                        new Class[]{Class.class, AxisService.class});
+                                        "createAxisService",
+                                        new Class[]{Class.class});
                                 Class pojoClass = Loader.loadClass(classLoader, className);
-                                AxisService axisService = new AxisService(className);
-                                axisService.setName(className);
-                                mthod.invoke(claxx, new Object[]{pojoClass, axisService});
-                                axisServiceList.add(axisService);
-                            } else {
-                                HashMap messageReciverMap = new HashMap();
-                                Class inOnlyMessageReceiver = Loader.loadClass(
-                                        "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
-                                MessageReceiver messageReceiver =
-                                        (MessageReceiver) inOnlyMessageReceiver.newInstance();
-                                messageReciverMap.put(
-                                        WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY,
-                                        messageReceiver);
-                                Class inoutMessageReceiver = Loader.loadClass(
-                                        "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
-                                MessageReceiver inOutmessageReceiver =
-                                        (MessageReceiver) inoutMessageReceiver.newInstance();
-                                messageReciverMap.put(
-                                        WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT,
-                                        inOutmessageReceiver);
-                                AxisService axisService = AxisService.createService(className,
+                                AxisService axisService = (AxisService)mthod.invoke(claxx, new Object[]{pojoClass});
+                                Utils.fillAxisService(axisService,
                                         configCtx.getAxisConfiguration(),
-                                        messageReciverMap, null, null, classLoader);
+                                        new ArrayList(),
+                                        new ArrayList());
                                 axisServiceList.add(axisService);
                             }
                         }

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=513283&r1=513282&r2=513283
==============================================================================
--- 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 Thu Mar  1 03:33:26 2007
@@ -371,7 +371,34 @@
                 pinfo.setOperationPhases(operation);
                 axisService.addOperation(operation);
             }
-            operation.setSoapAction("urn:" + opName);
+            if(operation.getInputAction()==null){
+                operation.setSoapAction("urn:" + opName);
+            }
+            String MEP = operation.getMessageExchangePattern();
+            if(MEP!=null){
+                try {
+                    if(WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(MEP)
+                        || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY.equals(MEP)){
+                        Class inOnlyMessageReceiver = Loader.loadClass(
+                                "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
+                        MessageReceiver messageReceiver =
+                                (MessageReceiver) inOnlyMessageReceiver.newInstance();
+                        operation.setMessageReceiver(messageReceiver);
+                    }  else {
+                        Class inoutMessageReceiver = Loader.loadClass(
+                                "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
+                        MessageReceiver inOutmessageReceiver =
+                                (MessageReceiver) inoutMessageReceiver.newInstance();
+                        operation.setMessageReceiver(inOutmessageReceiver);
+                    }
+                } catch (ClassNotFoundException e) {
+                    log.error(e);
+                } catch (InstantiationException e) {
+                    log.error(e);
+                } catch (IllegalAccessException e) {
+                   log.error(e);
+                }
+            }
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java?view=diff&rev=513283&r1=513282&r2=513283
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java Thu Mar  1 03:33:26 2007
@@ -142,6 +142,21 @@
     public static ServiceDescription createServiceDescription(Class serviceImplClass) {
         return DescriptionFactoryImpl.createServiceDescription(serviceImplClass);
     }
+
+    /**
+     * This provide very convenient way of creating an AxisService from an annotated 
+     * java class.
+     *
+     * @param serviceImplClass A Web Service implementation class (i.e. one that carries an
+     * WebService or WebServiceProvider annotation).
+     * @return An AxisService instance
+     */
+    public static  AxisService createAxisService(Class serviceImplClass){
+        ServiceDescription serviceDescription = createServiceDescription(serviceImplClass);
+        EndpointDescription[] edArray = serviceDescription.getEndpointDescriptions();
+        AxisService axisService = edArray[0].getAxisService();
+        return axisService;
+    }
     /**
      * DO NOT USE THIS METHOD FOR PRODUCTION CODE.  It has been deprecated and is only used
      * to drive some testing.  Note that the AxisService and associated Axis description objects



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