axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Airey <ma...@informatics.jax.org>
Subject ClassCastException
Date Mon, 28 Jan 2008 20:03:30 GMT
Hi,

  I'm fairly new, but learning every day.  I'm writing a web service in 
Axis2 1.3.  I'm getting an odd ClassCastException when I send a request 
to my web service.  The odd thing is that it only occurs when the test 
tool (soapUI) I'm using formats the xml of the soap request.  If I leave 
the content all on one line the error doesn't occur.  I started

Working request:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:bat="http://service.ws.mgi.jax.org/xsd/batch" 
xmlns:bt="http://service.ws.mgi.jax.org/xsd/batchType">
   <soap:Header/>
   <soap:Body>
      <bat:request>
<bat:batchRequest><bat:IDSet 
IDType="symbol"><bt:id>Trp53</bt:id></bat:IDSet></bat:batchRequest>
      </bat:request>
   </soap:Body>
</soap:Envelope>


Broken request:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:bat="http://service.ws.mgi.jax.org/xsd/batch" 
xmlns:bt="http://service.ws.mgi.jax.org/xsd/batchType">
   <soap:Header/>
   <soap:Body>
      <bat:request>
<bat:batchRequest><bat:IDSet 
IDType="symbol"><bt:id>Trp53</bt:id></bat:IDSet></bat:batchRequest>
      </bat:request>
   </soap:Body>
</soap:Envelope>

Here is the code that is parsing the xml:

        for (Iterator iter = request.getChildElements(); iter.hasNext();) {
            // get key and element          
            requestElement = (OMElementImpl) iter.next();           
            key = requestElement.getLocalName();
           
            // determine what argument type it is and load to args
            if (key.equals("IDSet")) {
                // this is a set if ids, get the id type and list of ids
                children = new HashSet();
                // get the ID type attribute from this arg
                QName attName = new QName("IDType");
                this.args.put("IDType", new String[]
                        {requestElement.getAttributeValue(attName)});
                // get all children of IDSet, these are the input ids
                for(Iterator it = requestElement.getChildren(); 
it.hasNext();){
                    child = (OMElementImpl) it.next();
                    if (!child.getText().trim().equals("")) {
                        children.add(child.getText().trim());
                    }
                }

Am I doing something incorrect in the way I am parsing with AXIOM?  Do I 
need to filter the incoming request a certain way to get rid of control 
characters?  I would not expect the formatting done by the test tool to 
insert illegal characters, so I am assuming I am making a newbie type of 
error.

Any help or suggestion is greatly appreciated.

Thanks,
Mark Airey


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


Mime
View raw message