Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JAXM web services and BOM

7 views
Skip to first unread message

V Virtuous

unread,
Oct 25, 2002, 5:24:46 PM10/25/02
to
We've written a web service using JAXM but the client is sending a BOM
(Byte Order Mark) which causes JAXM to throw an exception. Assuming I
can't change the client, can I get JAXM to handle the BOM? Here's the
exception:

javax.xml.soap.SOAPException: Unable to create envelope from given
source: Error on line 1 of document : Document root element is
missing. Nested exception: Document root element is missing.
at com.sun.xml.messaging.saaj.soap.dom4j.EnvelopeFactoryImpl.createEnvelope(EnvelopeFactoryImpl.java:80)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:87)
at web.services.xm.XMServlet.onMessage(XMServlet.java:498)
at javax.xml.messaging.JAXMServlet.doPost(Unknown Source)
at web.services.xm.XMServlet.doPost(XMAServlet.java:358)


The code is pretty simple, it just looks like:

/**
* Handle Request/Response style of messages.
*
* @see javax.xml.messaging.ReqRespListener#onMessage(SOAPMessage)
*/
public SOAPMessage onMessage(SOAPMessage request) {

// process the SOAP request
// obtain SOAPPart
SOAPPart sp = request.getSOAPPart();

// retrieve its envelope
SOAPEnvelope envelope = sp.getEnvelope(); // <== exception here

SOAPHeader header = envelope.getHeader();

// get body from envelope
SOAPBody body = envelope.getBody();
//etc...
}

0 new messages