我正在使用近乎最新的CXF和Camel jar,当通过cxf:bean:ServiceEndpoint将soap请求填充到Camel路由时,JAX-WS Holder参数始终返回null。我尝试通过跟踪堆栈进行调试,并在将CXFExchange填充到CamelExchange中时发现Holder的值为null。我想知道如何解决这个问题。顺便说一句,一切都适用于JAX-WS端点。
itnerface就像这样
@WebService(name="createSecurityOrder", targetNamespace="http://")
@XmlSeeAlso({ObjectFactory.class})
public interface CreateSecurityOrder {
@WebResult(name = "Acknowledgment", targetNamespace = "http://")
@RequestWrapper(localName = "createSecurityOrder", targetNamespace
= "http://", className = "com.ei.CreateSecurityOrder_Type")
@WebMethod
@ResponseWrapper(localName = "acknowledgment", targetNamespace = "http://")
public Acknowledgment createSecurityOrder(
@WebParam(name = "miscellaneous", targetNamespace = "http://")
PartnerInformation miscellaneous,
@WebParam(name = "paymentInformation", targetNamespace = "http://")
PaymentInformation paymentInformation,
@WebParam(name = "customerInformation", targetNamespace = "http://")
CustomerInformation customerInformation,
@WebParam(name = "securityBom", targetNamespace = "http://")
SecurityBOM securityBom,
@WebParam(mode = WebParam.Mode.INOUT, name =
"ENVELOPE_HEADER", targetNamespace = "http://", header = true)
javax.xml.ws.Holder<EnvelopeHeader> envelopeHeader
) throws SecurityOrderException;
}
** Order_Type类就像这样
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CreateSecurityOrder", propOrder = {
"miscellaneous",
"paymentInformation",
"customerInformation",
"securityBom"
})
public class CreateSecurityOrder_Type {
@XmlElement(required = true)
protected PartnerInformation miscellaneous;
@XmlElement(required = true)
protected PaymentInformation paymentInformation;
@XmlElement(required = true)
protected CustomerInformation customerInformation;
@XmlElement(required = true, nillable=false)
protected SecurityBOM securityBom;
cxf配置就像这样
<cxf:cxfEndpoint id="createSecurityOrder"
address="/createSecurityOrder"
serviceClass="com.ei.CreateSecurityOrder">
</cxf:cxfEndpoint>
路线配置就像这样
from("cxf:bean:createSecurityOrder")
.routeId("preProcessOrder")
.wireTap("direct:tap")
.processRef("validateOrder"));
validateOrderBean就像这样
public class ValidateOrder implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
List<Object> parameters = in.getBody(List.class);
// populate parameters
PartnerInformation partnerInformation = (PartnerInformation)
parameters.get(0);
PaymentInformation paymentInformation = (PaymentInformation)
parameters.get(1);
CustomerInformation customerInformation =
(CustomerInformation) parameters.get(2);
SecurityBOM securityBom = (SecurityBOM) parameters.get(3);
Holder<EnvelopeHeader> envelopeHeader =
(Holder<EnvelopeHeader>) parameters.get(4);