I think the problem is in the space between "<?" and "xml". You have:
<? xml version='1.0' ?>
It should be:
<?xml version='1.0' ?>
Anne
At 01:55 PM 8/14/2003 +0530, you wrote:
Hi,
can some one help me ?
My SOAP service is sending me following respose
<? xml version='1.0' ?>
<soap-env:Envelope xmlns:soap-env="<http://schemas.xmlsoap.org/soap/envelope/>http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<gpp-mm7:TransactionID xmlns:gpp-mm7="<http://localhost/soap/REL-5-MM7-1-0>http://localhost/soap/REL-5-MM7-1-0" soap-env:mustUnderstand="1">
123
</gpp-mm7:TransactionID>
</soap-env:Header>
<soap-env:Body>
<gpp-mm7:SubmitRes xmlns:gpp-mm7="<http://localhost/soap/REL-5-MM7-1-0>http://localhost/soap/REL-5-MM7-1-0">
<MM7Version> 1.0</MM7Version>
<Status>
<StatusCode> 1000</StatusCode>
<StatusText> Ok</StatusText>
<Detail></Detail>
</Status>
<MessageID> b4ec400004VRyW.kWRqV4kc3oPPVzak0N</MessageID>
</gpp-mm7:SubmitRes>
</soap-env:Body>
</soap-env:Envelope>
But my soap client is not able parse the response envelope . I am getting following exception:
org.xml.sax.SAXParseException: The processing instruction must begin with the name of the target.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1056)
at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:626)
at org.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDocumentScanner.java:680)
at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.dispatch(XMLDocumentScanner.java:748)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:948)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:123)
at MM7Client.main(MM7Client.java:54)
how ever if I will remove the xml prologue i.e. "<? xml version='1.0' ?>" then it is able to parse.
can any one pls suggest me what could be the reason ?
We are using 1. Apache SOAP Version 2.2 2. Xerces Java Parser 1.2.3
Code that I am using for parsing is the SOAP response is as follows:
try {
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder ();
Document doc = xdb.parse (new InputSource(new StringReader(xmlmsg)));
if (doc == null) {
System.err.println ("Failed to parse XML");
return;
}
Envelope msgEnv = Envelope.unmarshall(doc.getDocumentElement());
} catch (Exception e){
e.printStackTrace () ;
}
Regards,
- Sandip
