views:

213

answers:

1

I'm using Spring WS 1.5.8, XmlBeans for marshalling/unmarshalling and AxiomSoapMessageFactory. My app. needs a custom SOAP header. The data that needs to be in the SOAP Header is a XmlBean (i.e sessionContext in the code below). How can I construct the SOAP Header with this XmlBeans XmlObject element in it? I've mentioned the code of my WebServiceMessageCallback that I'm using and executing this code results in "'Content is not allowed in prolog.' error.

Thanks,

public class CustomMessageCallBack extends TransformerObjectSupport implements WebServiceMessageCallback {
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
SoapMessage soapMessage = (SoapMessage) message;
SoapHeader header = soapMessage.getSoapHeader();
StringSource headerSource = new StringSource(XmlBeanUtils.getValue(sessionContext) );
transform(headerSource, header.getResult());
}

}
A: 

The error usually means that Byte Order Mark (BOM) is present before < ?xml ... tag.

See http://mark.koli.ch/2009/02/resolving-orgxmlsaxsaxparseexception-content-is-not-allowed-in-prolog.html

Tahir Akhtar