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 bu...@apache.org on 2002/12/10 04:03:16 UTC
DO NOT REPLY [Bug 15208] New: -
calling getChildElements(name) on SOAPBody - classCastException
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15208>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15208
calling getChildElements(name) on SOAPBody - classCastException
Summary: calling getChildElements(name) on SOAPBody -
classCastException
Product: Axis
Version: 1.0
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Basic Architecture
AssignedTo: axis-dev@xml.apache.org
ReportedBy: darrenr@orderware.net
If call getChildElements(name) on a SOAPBody your receive a class cast
exception, I'm not an Axis developer but I took a peek at the latest source
code and there seems to be cut/paste error for the same method of SOAPHeader
and SOAPBodyElements are mis-casted to SOAPHeaderElements any here's some
sample code to replicate:
import java.util.Iterator;
import javax.xml.soap.*;
public class ClassCastExceptionTest
{
public static void main(String[] args) throws Exception
{
MessageFactory factory = MessageFactory.newInstance ();
SOAPMessage message = factory.createMessage ();
// Traverse the message and get to the SOAP Body
SOAPPart soapPart = message.getSOAPPart ();
SOAPEnvelope envelope = soapPart.getEnvelope ();
SOAPBody body = envelope.getBody ();
Name myName = envelope.createName ("MyName");
body.addBodyElement(myName);
try
{
Iterator it = body.getChildElements (myName); // <---- the
offending code is in here
if (it.hasNext ())
System.out.println ("There are child elements");
}
catch (ClassCastException clc)
{
System.err.println ("Surely this ClassCastException exception is
caused by a bug?");
}
}
}