开发者

How to add custom SOAP header in Spring WS using Axiom and XmlBeans

开发者 https://www.devze.com 2022-12-27 02:23 出处:网络
I\'m using Spring WS 1.5.8, XmlBeans for marshalling/unmars开发者_JAVA技巧halling and AxiomSoapMessageFactory. My app. needs a custom SOAP header. The data that needs to be in the SOAP Header is a Xml

I'm using Spring WS 1.5.8, XmlBeans for marshalling/unmars开发者_JAVA技巧halling 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());
}

}


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

0

精彩评论

暂无评论...
验证码 换一张
取 消