【问题标题】:How to add custom SOAP header in Spring WS using Axiom and XmlBeans如何使用 Axiom 和 XmlBeans 在 Spring WS 中添加自定义 SOAP 标头
【发布时间】:2010-04-14 18:11:38
【问题描述】:

我正在使用 Spring WS 1.5.8、用于编组/解组的 XmlBeans 和 AxiomSoapMessageFactory。我的应用程序。需要一个自定义 SOAP 标头。需要在 SOAP Header 中的数据是一个 XmlBean(即下面代码中的 sessionContext)。如何在其中构造带有此 XmlBeans XmlObject 元素的 SOAP 标头?我已经提到了我正在使用的 WebServiceMessageCallback 代码,并且执行此代码会导致“'prolog 中不允许内容。'错误。

谢谢,

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());
}

}

【问题讨论】:

    标签: spring-ws xmlbeans axiom


    【解决方案1】:

    该错误通常表示字节顺序标记 (BOM) 出现在 < ?xml ... 标记之前。

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

    【讨论】:

      猜你喜欢
      • 2014-10-07
      • 1970-01-01
      • 1970-01-01
      • 2010-10-24
      • 2012-05-17
      • 2011-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多