You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/12/05 11:29:49 UTC

svn commit: r482573 - in /webservices/axis2/branches/java/WSDL_2_0/modules: codegen/src/org/apache/axis2/wsdl/codegen/emitter/ kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/engine/ kernel/src/org/apache/axis2/transport/http/ kern...

Author: chinthaka
Date: Tue Dec  5 02:29:48 2006
New Revision: 482573

URL: http://svn.apache.org/viewvc?view=rev&rev=482573
Log:
Fixing a build break.
Adding servicename.endpointname to map to an AxisService.


Modified:
    webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=482573&r1=482572&r2=482573
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Tue Dec  5 02:29:48 2006
@@ -166,7 +166,7 @@
     public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
         this.codeGenConfiguration = configuration;
         this.axisService = codeGenConfiguration.getAxisService();
-        this.axisBinding = axisService.getEndpoit(axisService.getEndpointName()).getBinding();
+        this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding();
         resolver = new XSLTIncludeResolver(codeGenConfiguration);
     }
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=482573&r1=482572&r2=482573
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java Tue Dec  5 02:29:48 2006
@@ -72,7 +72,7 @@
  */
 public class AxisService extends AxisDescription {
 
-    private Map endpoitMap = new HashMap();
+    private Map endpointMap = new HashMap();
 
     private Map messageNameToOperationsMap = new HashMap();
 
@@ -191,12 +191,12 @@
     // name of the  binding used : use in codegeneration
     private String bindingName;
 
-    public AxisEndpoint getEndpoit(String key) {
-        return (AxisEndpoint)endpoitMap.get(key);
+    public AxisEndpoint getEndpoint(String key) {
+        return (AxisEndpoint)endpointMap.get(key);
     }
 
     public void addEndpoint(String key,AxisEndpoint axisEndpoint) {
-        this.endpoitMap.put(key,axisEndpoint);
+        this.endpointMap.put(key,axisEndpoint);
     }
 
     public String getWSAddressingFlag() {
@@ -1854,5 +1854,9 @@
 
     public void setEndpointURL(String endpointURL) {
         this.endpointURL = endpointURL;
+    }
+
+    public Map getEndpoints() {
+        return endpointMap;
     }
 }

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=482573&r1=482572&r2=482573
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Tue Dec  5 02:29:48 2006
@@ -68,7 +68,7 @@
 
     private URL axis2Repository = null;
 
-    private HashMap allservices = new HashMap();
+    private HashMap allServices = new HashMap();
 
     /**
      * Stores the module specified in the server.xml at the document parsing time.
@@ -131,13 +131,13 @@
         observersList = new ArrayList();
         inPhasesUptoAndIncludingPostDispatch = new ArrayList();
         systemClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController.doPrivileged(new PrivilegedAction() {
-          public Object run() {
-            return Thread.currentThread().getContextClassLoader();      
-          }
+            public Object run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
         });
-        serviceClassLoader = systemClassLoader; 
+        serviceClassLoader = systemClassLoader;
         moduleClassLoader = systemClassLoader;
-        
+
         this.phasesinfo = new PhasesInfo();
         targetResolvers = new ArrayList();
     }
@@ -214,8 +214,8 @@
 
     /**
      * This method will check whethere for a given service , can we ganerate
-     * valid wsdl or not. So if user derop a wsdl we print that out , else if
-     * all the operation uses RPC message recivers we will generate wsdl
+     * 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
      */
@@ -251,26 +251,28 @@
     public synchronized void addServiceGroup(AxisServiceGroup axisServiceGroup)
             throws AxisFault {
         notifyObservers(AxisEvent.SERVICE_DEPLOY, axisServiceGroup);
-        Iterator services = axisServiceGroup.getServices();
         axisServiceGroup.setParent(this);
-        AxisService description;
+        AxisService axisService;
+
+        Iterator services = axisServiceGroup.getServices();
         while (services.hasNext()) {
-            description = (AxisService) services.next();
-            if (allservices.get(description.getName()) != null) {
+            axisService = (AxisService) services.next();
+            String serviceName = axisService.getName();
+            if (allServices.get(serviceName) != null) {
                 throw new AxisFault(Messages.getMessage(
-                        "twoservicecannothavesamename", description.getName()));
+                        "twoservicecannothavesamename", axisService.getName()));
             }
-            if (description.getSchematargetNamespace() == null) {
-                description
+            if (axisService.getSchematargetNamespace() == null) {
+                axisService
                         .setSchematargetNamespace(Java2WSDLConstants.AXIS2_XSD);
             }
-            isWSDLEnable(description);
+            isWSDLEnable(axisService);
         }
         services = axisServiceGroup.getServices();
         while (services.hasNext()) {
-            description = (AxisService) services.next();
-            if (description.isUseDefaultChains()) {
-                Iterator operations = description.getOperations();
+            axisService = (AxisService) services.next();
+            if (axisService.isUseDefaultChains()) {
+                Iterator operations = axisService.getOperations();
                 while (operations.hasNext()) {
                     AxisOperation operation = (AxisOperation) operations.next();
                     phasesinfo.setOperationPhases(operation);
@@ -284,10 +286,27 @@
         }
         services = axisServiceGroup.getServices();
         while (services.hasNext()) {
-            description = (AxisService) services.next();
-            allservices.put(description.getName(), description);
-            if (!description.isClientSide()) {
-                notifyObservers(AxisEvent.SERVICE_DEPLOY, description);
+            axisService = (AxisService) services.next();
+
+            Map endpoints = axisService.getEndpoints();
+            String serviceName = axisService.getName();
+
+            if (endpoints.isEmpty()) {
+                allServices.put(serviceName, axisService);
+            } else if (endpoints.size() == 1) {
+                // if we have one endpoint, just process it. This is special case as this will be the case
+                // most of the time
+                allServices.put(serviceName + "." + axisService.getEndpointName(), axisService);
+            } else {
+                Iterator endpointNameIter = endpoints.keySet().iterator();
+                while (endpointNameIter.hasNext()) {
+                    String endpointName = (String) endpointNameIter.next();
+                    allServices.put(serviceName + "." + endpointName, axisService);
+                }
+            }
+
+            if (!axisService.isClientSide()) {
+                notifyObservers(AxisEvent.SERVICE_DEPLOY, axisService);
             }
         }
         // serviceGroups.put(axisServiceGroup.getServiceGroupName(),
@@ -304,7 +323,7 @@
         Iterator services = axisServiceGroup.getServices();
         while (services.hasNext()) {
             AxisService axisService = (AxisService) services.next();
-            allservices.remove(axisService.getName());
+            allServices.remove(axisService.getName());
             if (!axisService.isClientSide()) {
                 notifyObservers(AxisEvent.SERVICE_REMOVE, axisService);
             }
@@ -491,7 +510,7 @@
      * @throws AxisFault
      */
     public synchronized void removeService(String name) throws AxisFault {
-        AxisService service = (AxisService) allservices.remove(name);
+        AxisService service = (AxisService) allServices.remove(name);
 
         if (service != null) {
             log.debug(Messages.getMessage("serviceremoved", name));
@@ -618,7 +637,7 @@
      * @return Returns AxisService.
      */
     public AxisService getService(String name) throws AxisFault {
-        AxisService axisService = (AxisService) allservices.get(name);
+        AxisService axisService = (AxisService) allServices.get(name);
         if (axisService != null) {
             if (axisService.isActive()) {
                 return axisService;
@@ -638,7 +657,7 @@
      * @return AxisService
      */
     public AxisService getServiceForActivation(String serviceName) {
-        AxisService axisService = (AxisService) allservices.get(serviceName);
+        AxisService axisService = (AxisService) allServices.get(serviceName);
         if (axisService != null) {
             return axisService;
         } else {
@@ -673,11 +692,11 @@
             while (servics.hasNext()) {
                 AxisService axisService = (AxisService) servics.next();
 
-                allservices.put(axisService.getName(), axisService);
+                allServices.put(axisService.getName(), axisService);
             }
         }
 
-        return allservices;
+        return allServices;
     }
 
     // the class loder which become the top most parent of all the modules and
@@ -785,7 +804,7 @@
     }
 
     public void stopService(String serviceName) throws AxisFault {
-        AxisService service = (AxisService) allservices.get(serviceName);
+        AxisService service = (AxisService) allServices.get(serviceName);
         if (service == null) {
             throw new AxisFault(Messages.getMessage("servicenamenotvalid",
                     serviceName));
@@ -795,7 +814,7 @@
     }
 
     public void startService(String serviceName) throws AxisFault {
-        AxisService service = (AxisService) allservices.get(serviceName);
+        AxisService service = (AxisService) allServices.get(serviceName);
         if (service == null) {
             throw new AxisFault(Messages.getMessage("servicenamenotvalid",
                     serviceName));

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java?view=diff&rev=482573&r1=482572&r2=482573
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java Tue Dec  5 02:29:48 2006
@@ -153,29 +153,35 @@
      * @param urlString
      * @return - the URL after appending the properties
      */
-    private String appendParametersToURL(MessageContext messageContext, String urlString) throws MalformedURLException {
-        OMElement firstElement = messageContext.getEnvelope().getBody().getFirstElement();
+    private String appendParametersToURL(MessageContext messageContext, String urlString) {
+        try {
+            OMElement firstElement = messageContext.getEnvelope().getBody().getFirstElement();
 
-        ArrayList httpLocationParams = (ArrayList) messageContext.getProperty(
-                Constants.Configuration.URL_HTTP_LOCATION_PARAMS_LIST);
+            ArrayList httpLocationParams = (ArrayList) messageContext.getProperty(
+                    Constants.Configuration.URL_HTTP_LOCATION_PARAMS_LIST);
 
-        URL url = new URL(urlString);
-        String path = url.getPath();
+            URL url = new URL(urlString);
+            String path = url.getPath();
 
-        for (int i = 0; i < httpLocationParams.size(); i++) {
-            String httpLocationParam = (String) httpLocationParams.get(i);
-            OMElement httpURLParam = firstElement.getFirstChildWithName(new QName(httpLocationParam));
-            if (httpURLParam != null) {
-                path += httpURLParam.getText();
+            for (int i = 0; i < httpLocationParams.size(); i++) {
+                String httpLocationParam = (String) httpLocationParams.get(i);
+                OMElement httpURLParam = firstElement.getFirstChildWithName(new QName(httpLocationParam));
+                if (httpURLParam != null) {
+                    path += httpURLParam.getText();
+                }
             }
-        }
 
-        String query = url.getQuery();
-        if (query != null && !"".equals(query)) {
-            return path + "?" + query;
-        } else {
-            return path;
+            String query = url.getQuery();
+            if (query != null && !"".equals(query)) {
+                return path + "?" + query;
+            } else {
+                return path;
+            }
+        } catch (MalformedURLException e) {
+            log.error("Error in processing POST request", e);
         }
+
+        return null;
     }
 
     private void sendViaGet(MessageContext msgContext, URL url)

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java?view=diff&rev=482573&r1=482572&r2=482573
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java Tue Dec  5 02:29:48 2006
@@ -73,11 +73,12 @@
     }
 
     /**
-     * This method is designed for REST handling. Parameter of a REST request comes in the URL or in
+     * This method is designed for REST handling. Parameters of a REST request comes in the URL or in
      * the body of the message (if it is POST). Since those parameters may not be in the proper order,
-     * we need to retrieve the schema of the operation and construct the message according to that
-     * from the parameters received as the REST request.
-     * This method will carry out that function and it is assumed that this method is called in that scenarios only.
+     * we need to retrieve the schema of the operation and construct the message according to the
+     * parameters received as the REST request.
+     * This method will carry out that function and it is assumed that this method is called in that
+     * scenarios only.
      *
      * @param msgCtxt
      * @param request
@@ -95,7 +96,9 @@
         SOAPBody body = soapEnvelope.getBody();
 
         if (xmlSchemaElement == null) {
-            // if there is no schema its piece of cake !! add these to the soap body in any order you like
+            // if there is no schema its piece of cake !! add these to the soap body in any order you like.
+            // Note : if there are parameters in the path of the URL, there is no way this can add them
+            // to the message.
             OMElement bodyFirstChild = soapFactory.createOMElement(msgCtxt.getAxisOperation().getName(), body);
 
             // first add the parameters in the URL
@@ -119,8 +122,9 @@
             }
             OMElement bodyFirstChild = soapFactory.createOMElement(bodyFirstChildQName, body);
 
-            if (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_POST.equals(request.getMethod())
-                || (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_GET.equals(request.getMethod()))) {
+            String httpMethod = request.getMethod();
+            if (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_POST.equals(httpMethod)
+                || (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_GET.equals(httpMethod))) {
                 XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
                 if (schemaType instanceof XmlSchemaComplexType) {
                     XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);



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