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 ke...@apache.org on 2007/04/23 10:26:55 UTC

svn commit: r531375 - in /webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2: description/AxisService2WSDL2.java transport/http/util/URLTemplatingUtil.java

Author: keithc
Date: Mon Apr 23 01:26:54 2007
New Revision: 531375

URL: http://svn.apache.org/viewvc?view=rev&rev=531375
Log:
Fixing nullpointer in AxisService2WSDL2.
REST was not working due to bug in URLTemplating. Fixing it.


Modified:
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java?view=diff&rev=531375&r1=531374&r2=531375
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java Mon Apr 23 01:26:54 2007
@@ -62,10 +62,10 @@
         OMNamespace tns = omFactory
                 .createOMNamespace(axisService.getTargetNamespace(),
                                    axisService.getTargetNamespacePrefix());
-        if (!nameSpacesMap.containsValue(WSDL2Constants.WSDL_NAMESPACE)) {
+        if (nameSpacesMap!= null && !nameSpacesMap.containsValue(WSDL2Constants.WSDL_NAMESPACE)) {
             descriptionElement.declareDefaultNamespace(WSDL2Constants.WSDL_NAMESPACE);
         }
-        if (nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_SOAP)) {
+        if (nameSpacesMap!= null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_SOAP)) {
             wsoap = omFactory
                     .createOMNamespace(WSDL2Constants.URI_WSDL2_SOAP,
                                        WSDLSerializationUtil.getPrefix(
@@ -74,7 +74,7 @@
             wsoap = descriptionElement
                     .declareNamespace(WSDL2Constants.URI_WSDL2_SOAP, WSDL2Constants.SOAP_PREFIX);
         }
-        if (nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_HTTP)) {
+        if (nameSpacesMap!= null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_HTTP)) {
             whttp = omFactory
                     .createOMNamespace(WSDL2Constants.URI_WSDL2_HTTP,
                                        WSDLSerializationUtil.getPrefix(
@@ -83,7 +83,7 @@
             whttp = descriptionElement
                     .declareNamespace(WSDL2Constants.URI_WSDL2_HTTP, WSDL2Constants.HTTP_PREFIX);
         }
-        if (nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_EXTENSIONS)) {
+        if (nameSpacesMap!= null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_EXTENSIONS)) {
             wsdlx = omFactory
                     .createOMNamespace(WSDL2Constants.URI_WSDL2_EXTENSIONS,
                                        WSDLSerializationUtil.getPrefix(

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java?view=diff&rev=531375&r1=531374&r2=531375
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java Mon Apr 23 01:26:54 2007
@@ -166,7 +166,17 @@
      */
     private static String getOMElementValue(String elementName, OMElement parentElement) {
 
-        OMElement httpURLParam = parentElement.getFirstChildWithName(new QName(elementName));
+        OMElement httpURLParam = null;
+        Iterator children = parentElement.getChildElements();
+
+        while(children.hasNext()) {
+            OMElement child = (OMElement) children.next();
+            QName qName = child.getQName();
+            if (elementName.equals(qName.getLocalPart())) {
+                httpURLParam = child;
+                break;
+            }
+        }
 
         if (httpURLParam != null) {
             httpURLParam.detach();
@@ -209,14 +219,15 @@
 
         }
                 URI targetURI;
+                URI appendedURI;
                 if (replacedQuery.charAt(0) == '?') {
-                    targetURI = new URI(targetURL.toString());
+                    appendedURI = new URI(targetURL.toString() + replacedQuery);
                 } else {
                     targetURI = new URI(targetURL.toString() + "/");
+                    appendedURI = targetURI.resolve(replacedQuery);
                 }
                 
-                URI appendedURI = targetURI.resolve(replacedQuery);
-                targetURL = appendedURI.toURL(); 
+                targetURL = appendedURI.toURL();
 
             } catch (MalformedURLException e) {
                 throw new AxisFault("An error occured while trying to create request URL");



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