0
我使用Spring WS 1.5.8,XmlBeans進行編組/解組和AxiomSoapMessageFactory。我的應用程序需要一個自定義的SOAP頭。需要在SOAP Header中的數據是一個XmlBean(即下面代碼中的sessionContext)。我該如何構造帶有此XmlBeans XmlObject元素的SOAP Header?我已經提到了我正在使用的WebServiceMessageCallback的代碼,並且執行此代碼導致「'在prolog中不允許內容'。錯誤。如何使用Axiom和XmlBeans在Spring WS中添加自定義SOAP頭
謝謝,
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());
}
}