How to add custom SOAP header in Spring WS using Axiom and XmlBeans
Posted
by java_pill
on Stack Overflow
See other posts from Stack Overflow
or by java_pill
Published on 2010-04-14T18:11:38Z
Indexed on
2010/04/14
18:13 UTC
Read the original article
Hit count: 607
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 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());
}
© Stack Overflow or respective owner