SAAJ response - invalid SOAP envelope

From: Stephen Chell (stevecnz2_at_yahoo.com)
Date: 04/04/04


Date: 4 Apr 2004 14:49:49 -0700

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.createEnvelope(EnvelopeFactory.java:71)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:34)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(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.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:511)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(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(DOMBuilder.java:354)
at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
at org.xml.sax.helpers.XMLFilterImpl.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.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.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:494)
... 4 more



Relevant Pages

  • C# generated .NET stubs break on a null return of a complex object
    ... I have a SOAP written in Java, and being served by Apache Axis - using the ... When I make this same call with my java client - here is the SOAP message ... the response object is basically empty - because there were ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: How to retrieve the soap payload in .NET/C# client
    ... > The client sends a request to a web sevice and gets a response back. ... Usually the client will marshal the soap ... Yes, you can implement the abstract class, SoapExtension in the namespace ...
    (microsoft.public.dotnet.framework.webservices)
  • deserialization arrays in Axis SOAP messages
    ... I have been trying to make requests of a web service provided by Axis using ... As a result of seraching news groups I guessed that the SOAP response ... defines an array element in a way that causes the dotnet deserialization ... I used SOAP extensions to manipulate the offending item in the SOAP ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: SOAP serialization problem
    ... I've snooped the SOAP response, ... this deserialization, but I've not found any that work. ... You're the client and you are the customer of a Web service that's for your use only. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: SOAP serialization problem
    ... I've snooped the SOAP response, ... public string XmlTest{ ... this deserialization, but I've not found any that work. ...
    (microsoft.public.dotnet.framework.aspnet)