By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

SAAJ response - invalid SOAP envelope

P: n/a
I'm using SAAJ 1.2 (from jwsdp-1.3) and JDK 1.4.2_03.

I've written a client application that uses the SAAJ api to send a
SOAP message to a servlet. The servlet successfully receives the
message and returns a SOAP response containing a single element in the
SOAP body. The client receives the response and writes its content to
standard out via the SOAPMessage.writeTo() method. The response
received looks correct:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<eai:Response xmlns:eai="urn:nz:govt:eai">SUCCESS</eai:Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

.... but when I try to access the soap envelope as follows:

SOAPMessage response = connection.call(message, endpoint);
response.writeTo(System.out);
SOAPPart part = response.getSOAPPart();
SOAPEnvelope env = part.getEnvelope();

The last line in the above code fragment throws the following
exception (see below). Does anyone know whats causing this? Please
help.

Thanks in advance ...
Steve

SEVERE: SAAJ0511: Unable to create envelope from given source
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create
envelope from given source:
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:71)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1 Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java :34)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEn velope(SOAPPartImpl.java:82)
at test.SendDogLicense.main(SendDogLicense.java:124)
Caused by: javax.xml.transform.TransformerException:
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create
or change an object in a way which is incorrect with regard to
namespaces.
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:511)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:63)
.... 3 more
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made
to create or change an object in a way which is incorrect with regard
to namespaces.
at org.apache.xml.utils.DOMBuilder.startElement(DOMBu ilder.java:354)
at org.apache.xalan.transformer.TransformerIdentityIm pl.startElement(TransformerIdentityImpl.java:1073)
at org.xml.sax.helpers.XMLFilterImpl.startElement(Unk nown Source)
at org.apache.xerces.parsers.AbstractSAXParser.startE lement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.sc anStartElement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NS ContentDispatcher.scanRootElementHook(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:494)
.... 4 more
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.