Author: richard.opalka(a)jboss.com
Date: 2008-02-20 04:41:21 -0500 (Wed, 20 Feb 2008)
New Revision: 5747
Modified:
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/PortHandler.java
Log:
[JBWS-1905] fix
Modified:
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/PortHandler.java
===================================================================
---
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/PortHandler.java 2008-02-20
08:39:13 UTC (rev 5746)
+++
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/PortHandler.java 2008-02-20
09:41:21 UTC (rev 5747)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.samples.logicalhandler;
+import java.util.Iterator;
+
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -59,8 +61,8 @@
try
{
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
- soapElement = (SOAPElement)soapElement.getChildElements().next();
+ SOAPElement soapElement = getFirstChildElement(soapMessage.getSOAPBody());
+ soapElement = getFirstChildElement(soapElement);
String oldValue = soapElement.getValue();
String newValue = oldValue + ":" + direction +
":PortHandler";
@@ -76,4 +78,19 @@
throw new WebServiceException(ex);
}
}
+
+ private SOAPElement getFirstChildElement(SOAPElement parentNode)
+ {
+ Iterator i = parentNode.getChildElements();
+ while (i.hasNext())
+ {
+ Object currentNode = i.next();
+ if (currentNode instanceof SOAPElement)
+ {
+ return (SOAPElement) currentNode;
+ }
+ }
+
+ return null;
+ }
}
Show replies by date