axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r543462 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
Date Fri, 01 Jun 2007 11:36:59 GMT
Author: keithc
Date: Fri Jun  1 04:36:58 2007
New Revision: 543462

URL: http://svn.apache.org/viewvc?view=rev&rev=543462
Log:
Fix for Axis2-2747. REST fails when input is anyType

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java?view=diff&rev=543462&r1=543461&r2=543462
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
Fri Jun  1 04:36:58 2007
@@ -84,27 +84,13 @@
             xmlSchemaElement = axisMessage.getSchemaElement();
 
         if (xmlSchemaElement == null) {
+            OMElement bodyFirstChild =
+                            soapFactory.createOMElement(messageContext.getAxisOperation().getName(),
body);
+
             // 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(messageContext.getAxisOperation().getName(),
body);
-
-            // first add the parameters in the URL
-            if (requestParameterMap != null) {
-                Iterator requestParamMapIter = requestParameterMap.keySet().iterator();
-                while (requestParamMapIter.hasNext()) {
-                    String key = (String) requestParamMapIter.next();
-                    String value = (String) requestParameterMap.get(key);
-                    if (value != null) {
-                        soapFactory.createOMElement(key, null, bodyFirstChild).setText(value);
-                         if (value != null) {
-                               soapFactory.createOMElement(key, null, bodyFirstChild).setText(value);
-                         }
-                    }
-
-                }
-            }
+            createSOAPMessageWithoutSchema(soapFactory, messageContext, bodyFirstChild, requestParameterMap);
         } else {
 
             // first get the target namespace from the schema and the wrapping element.
@@ -134,6 +120,10 @@
                     while (iterator.hasNext()) {
                         XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
                         QName qName = innerElement.getQName();
+                        if (qName ==null && innerElement.getSchemaTypeName().equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE))
{
+                            createSOAPMessageWithoutSchema(soapFactory, messageContext, bodyFirstChild,
requestParameterMap);
+                            break;
+                        }
                         long minOccurs = innerElement.getMinOccurs();
                         boolean nillable = innerElement.isNillable();
                         String name =
@@ -173,6 +163,24 @@
         }
     }
         return soapEnvelope;
+    }
+
+    private static void createSOAPMessageWithoutSchema(SOAPFactory soapFactory,
+                                                       MessageContext messageContext, OMElement
bodyFirstChild,
+                                                       MultipleEntryHashMap requestParameterMap)
{
+
+        // first add the parameters in the URL
+        if (requestParameterMap != null) {
+            Iterator requestParamMapIter = requestParameterMap.keySet().iterator();
+            while (requestParamMapIter.hasNext()) {
+                String key = (String) requestParamMapIter.next();
+                String value = (String) requestParameterMap.get(key);
+                if (value != null) {
+                    soapFactory.createOMElement(key, null, bodyFirstChild).setText(value);
+                }
+
+            }
+        }
     }
 
     public static StAXBuilder getPOXBuilder(InputStream inStream, String charSetEnc)



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