You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ray Chen <ra...@gmail.com> on 2014/05/01 21:12:04 UTC

About JAX-WS Holder NullPointerException

Hi All,

I have just met the NullPointerException when dealing with the soap
request input.

The itnerface is like this

@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 class is like this

@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;

The cxf configuration is like this
    <cxf:cxfEndpoint id="createSecurityOrder"
                     address="/createSecurityOrder"
                     serviceClass="com.ei.CreateSecurityOrder">
    </cxf:cxfEndpoint>

Route configuration is like this
        from("cxf:bean:createSecurityOrder")
                .routeId("preProcessOrder")
                .wireTap("direct:tap")
                .processRef("validateOrder"));

validateOrderBean is like this
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);


For some reason, I could not get any value from envelopeHeader when
sending the valid Soap request, I wonder if anyone have any idea on
it.

Also the unit testing did get passed.

Thanks for your time.

Best regards,
Ray

Re: About JAX-WS Holder NullPointerException

Posted by Ray Chen <ra...@gmail.com>.
Update, I have spent some time reading the stacktrace calls, and found
when CxfConsumer populate the parameters (inputMessage / MessageParts
of type ArrayList) to the CamelExchange, the Holder<EnvelopeHeader> is
lost already.

In the BidningOperationInfo object, it did has
inputMessage(BindingMessageInfo type)/msg(MessageInfo
type)/MessageParts(LinkedHashMap)/[5].

I wonder if I have something wrong with the above configuration, which
leads to the consumer failure of the cxf endpoint.

Thanks a lot.
Ray