[jbossws-commits] JBossWS SVN: r3053 - in branches/dlofthouse/JBWS-1648: jbossws-core/src/java/org/jboss/ws/core/jaxws/binding and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Fri May 11 14:28:00 EDT 2007


Author: darran.lofthouse at jboss.com
Date: 2007-05-11 14:28:00 -0400 (Fri, 11 May 2007)
New Revision: 3053

Modified:
   branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
   branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
   branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
   branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws707/JBWS707TestCase.java
   branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java
   branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/provider/ProviderJAXBTestCase.java
Log:
Fix test regressions.

Modified: branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java	2007-05-11 14:55:35 UTC (rev 3052)
+++ branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java	2007-05-11 18:28:00 UTC (rev 3053)
@@ -549,8 +549,14 @@
          Iterator bodyChildren = soapBody.getChildElements();
 
          SOAPBodyElement soapBodyElement = null;
-         if (bodyChildren.hasNext() != false)
-            soapBodyElement = (SOAPBodyElement)bodyChildren.next();
+         while (bodyChildren.hasNext() && soapBodyElement == null)
+         {
+            Object next = bodyChildren.next();
+            if (next instanceof SOAPBodyElement)
+            {
+               soapBodyElement = (SOAPBodyElement)next;
+            }
+         }
 
          // Translate the SOAPFault to an exception and throw it
          if (soapBodyElement instanceof SOAPFaultImpl)

Modified: branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
--- branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java	2007-05-11 14:55:35 UTC (rev 3052)
+++ branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java	2007-05-11 18:28:00 UTC (rev 3053)
@@ -23,10 +23,12 @@
 
 // $Id$
 
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPBodyElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.transform.Source;
 import javax.xml.ws.handler.Handler;
@@ -93,7 +95,18 @@
 
          SOAPMessage reqMessage = (SOAPMessage)payload;
          SOAPBodyImpl body = (SOAPBodyImpl)reqMessage.getSOAPBody();
-         SOAPContentElement bodyElement = (SOAPContentElement)body.getFirstChild();
+
+         SOAPContentElement bodyElement = null;
+         Iterator bodyChildren = body.getChildElements();
+         while (bodyChildren.hasNext() && bodyElement == null)
+         {
+            Object next = bodyChildren.next();
+            if (next instanceof SOAPContentElement)
+            {
+               bodyElement = (SOAPContentElement)next;
+            }
+         }
+
          Source source = bodyElement.getXMLFragment().getSource();
 
          if (source == null)

Modified: branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
--- branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java	2007-05-11 14:55:35 UTC (rev 3052)
+++ branches/dlofthouse/JBWS-1648/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java	2007-05-11 18:28:00 UTC (rev 3053)
@@ -27,6 +27,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.util.HashMap;
+import java.util.Iterator;
 
 import javax.activation.DataHandler;
 import javax.management.MBeanException;
@@ -344,9 +345,21 @@
          {
             String faultString;
             SOAPBody soapBody = soapMessage.getSOAPBody();
-            if (soapBody.getChildElements().hasNext())
+
+            Iterator bodyChildren = soapBody.getChildElements();
+            SOAPBodyElement soapBodyElement = null;
+
+            while (bodyChildren.hasNext() && soapBodyElement == null)
             {
-               SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+               Object next = bodyChildren.next();
+               if (next instanceof SOAPBodyElement)
+               {
+                  soapBodyElement = (SOAPBodyElement)next;
+               }
+            }
+
+            if (soapBodyElement != null)
+            {
                Name soapName = soapBodyElement.getElementName();
                faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
             }

Modified: branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws707/JBWS707TestCase.java
===================================================================
--- branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws707/JBWS707TestCase.java	2007-05-11 14:55:35 UTC (rev 3052)
+++ branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws707/JBWS707TestCase.java	2007-05-11 18:28:00 UTC (rev 3053)
@@ -28,6 +28,7 @@
 import javax.xml.rpc.Service;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.Name;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
@@ -37,6 +38,7 @@
 
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.soap.NameImpl;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -115,7 +117,7 @@
       String xmlStr = "<?xml version='1.0' encoding='UTF-8' ?>" + 
       "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/' xmlns:tns='http://uri.jboss.org'>" + 
       " <env:Body>" + 
-      "   <tns:testMessage><![CDATA[  Hello  ]]></tns:testMessage>" +
+      "   <tns:myMessage><![CDATA[  Hello  ]]></tns:myMessage>" +
       " </env:Body>" + 
       "</env:Envelope>";
 
@@ -185,8 +187,10 @@
 
       SOAPMessage soapMessage = mf.createMessage(mimeHeaders, new ByteArrayInputStream(xmlStr.getBytes()));
       SOAPBody soapBody = soapMessage.getSOAPBody();
-      SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
       
+      Name name = new NameImpl("myMessage", "tns", "http://uri.jboss.org");
+      SOAPElement soapElement = (SOAPElement)soapBody.getChildElements(name).next();
+      
       StringBuffer builder = new StringBuffer();
       NodeList nlist = soapElement.getChildNodes();
       for (int i = 0; i < nlist.getLength(); i++)

Modified: branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java
===================================================================
--- branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java	2007-05-11 14:55:35 UTC (rev 3052)
+++ branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java	2007-05-11 18:28:00 UTC (rev 3053)
@@ -22,12 +22,14 @@
 package org.jboss.test.ws.jaxws.handlerlifecycle;
 
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Set;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.handler.soap.SOAPHandler;
 import javax.xml.ws.handler.soap.SOAPMessageContext;
@@ -186,8 +188,32 @@
       String testMethod;
       try
       {
-         SOAPElement soapElement = (SOAPElement)((SOAPMessageContext)msgContext).getMessage().getSOAPBody().getChildElements().next();
-         soapElement = (SOAPElement)soapElement.getChildElements().next();
+
+         SOAPMessage message = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPElement soapElement = null;
+         Iterator it = message.getSOAPBody().getChildElements();
+
+         while (soapElement == null && it.hasNext())
+         {
+            Object current = it.next();
+            if (current instanceof SOAPElement)
+            {
+               soapElement = (SOAPElement)current;
+            }
+         }
+
+         it = soapElement.getChildElements();
+         soapElement = null;
+
+         while (soapElement == null && it.hasNext())
+         {
+            Object current = it.next();
+            if (current instanceof SOAPElement)
+            {
+               soapElement = (SOAPElement)current;
+            }
+         }
+
          testMethod = soapElement.getValue();
       }
       catch (SOAPException e)

Modified: branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/provider/ProviderJAXBTestCase.java
===================================================================
--- branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/provider/ProviderJAXBTestCase.java	2007-05-11 14:55:35 UTC (rev 3052)
+++ branches/dlofthouse/JBWS-1648/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/provider/ProviderJAXBTestCase.java	2007-05-11 18:28:00 UTC (rev 3053)
@@ -31,6 +31,7 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
 import javax.xml.soap.SOAPConnection;
 import javax.xml.soap.SOAPConnectionFactory;
 import javax.xml.soap.SOAPEnvelope;
@@ -45,6 +46,7 @@
 
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.soap.NameImpl;
 import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 import org.w3c.dom.Element;
@@ -131,7 +133,9 @@
       SOAPMessage resMsg = con.call(reqMsg, epURL);
       SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
 
-      Element child = (Element)resEnv.getBody().getChildElements().next();
+      Name name = new NameImpl("user", "ns1", "http://org.jboss.ws/provider");
+      Element child = (Element)resEnv.getBody().getChildElements(name).next();
+      
       JAXBContext jc = JAXBContext.newInstance(new Class[]{UserType.class});
       UserType user = (UserType)jc.createUnmarshaller().unmarshal(new DOMSource(child));
 




More information about the jbossws-commits mailing list