You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ericho <er...@vantixweb.com> on 2004/08/27 16:34:02 UTC

SOAPPart exception w/ Axis

Hi,
I have some code that was using the WSDP stuff from sun and we are moving it
to use axis.  We have the following weird behavior.  This code snippet:

-----
SOAPMessage message = factory.createMessage();

             MimeHeaders mh = message.getMimeHeaders();
           
mh.addHeader("SOAPAction","http://www.trx.com/TRXServices/TRXSSabre/SeatMapGet");



             SOAPPart soapPart = message.getSOAPPart();
             SOAPEnvelope envelope = soapPart.getEnvelope();
             SOAPHeader header = envelope.getHeader();

            // we don't use the header for TRX
            header.detachNode();

            Name oper = envelope.createName("SeatMapGet", "",
"http://www.trx.com/TRXServices/TRXSSabre/");

            envelope.getBody().addChildElement(oper);
             message.saveChanges();
            // use transform to attach the docs
            //TODO:  Use a template that encompasses the whole message body,
            //TODO:  Evaluate string replacement as a performance improvement.
             TransformerFactory tFactory = TransformerFactory.newInstance();
             Transformer transformer = tFactory.newTransformer();

             Source spSrc = soapPart.getContent();
-----


Causes this exception:


------
javax.xml.soap.SOAPException: Could not get document from SOAPEnvelope
        at org.apache.axis.SOAPPart.getContent(SOAPPart.java:709)
        at SeatMapRequester.getSeatMap(SeatMapRequester.java:151)
        at SeatMapManager.sendSeatMapRequest(SeatMapManager.java:105)
        at _results__jsp._jspService(_results__jsp.java:28)
        at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
        at com.caucho.jsp.Page.subservice(Page.java:506)
        at
com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
        at com.caucho.server.http.Invocation.service(Invocation.java:315)
        at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
        at
com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
        at
com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
        at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
        at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.ClassCastException
        at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:173)
        at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:509)
        at org.apache.axis.message.MessageElement.output(MessageElement.java:783)
        at
org.apache.axis.message.MessageElement.getAsString(MessageElement.java:706)
        at
org.apache.axis.message.MessageElement.getAsDocument(MessageElement.java:685)
        at org.apache.axis.SOAPPart.getContent(SOAPPart.java:707)
        ... 12 more
-----

Have tried a couple versions of the axis libs but always get this error. Not
sure what could be causing it.

Any ideas?