I have tried to invoke the EPaymentHandler from JSP directly, it works fine.
The EPaymentHandler.execute() invokes
CreditCardPaymentRequestBinder.toObject.
But when I invoke the EPaymentHandler from inside a child class of
org.apache.axis2.receivers.RawXMLINOutMessageReceiver, then I get the NPE.
The child class of RawXMLINOutMessageReceiver override the
invokeBusinessLogic method as follows:
public void invokeBusinessLogic(MessageContext msgContext, MessageContext
newmsgContext) throws AxisFault {
log.debug("EPaymentHandler invoked.");
try {
epayHandler.execute(msgContext, newmsgContext);
// epayHandler will invoke CreditCardPaymentRequestBinder.
} catch (Exception e) {
log.error(e);
throw new AxisFault(e);
}
}
As can be seen, this method does not contain any code dealing with StAX
parser.
I am wondering which step affects the StAX parser and cause the
org.apache.axiom.om.impl.llom.OMStAXWrapper.generateEvents(
OMStAXWrapper.java:1115) NPE.
I am not familiar with the implementation of AXIOM, and now cannot proceed.
As far as I know, wstx-asl-3.2.0.jar is the implementation of stax-api. How
about the axiom-impl-1.2.2.jar? Does it use wstx-asl-3.2.0?
Regards,
Xinjun
On 5/4/07, Xinjun Chen <[EMAIL PROTECTED]> wrote:
Hi Dims,
The same soap request works with my standalone program. The same method
toObject runs correctly gives correct result.
Regards,
Xinjun
On 5/3/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote:
>
> Xinjun,
>
> can you run tcpmon to capture the soap request and use that xml with
> your stand alone program to see if that works?
>
> -- dims
>
> On 5/3/07, Xinjun Chen <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> >
> > I wrote a sample custom serializer/deserializer to serialize an
> object. When
> > I use a standalone program to test the serializer, it works fine. But
> when I
> > deploy the serializer as part of a web service and and invoke the web
> > service through a SOAP request, I got the following null pointer
> execption.
> > I googled but didn't find the reason of this. Why does the NPE occur
> only
> > when I deploy the binder as part of the web service? I used the same
> > SOAPEnvelope to test.
> >
> >
> >
> > java.lang.NullPointerException
> > at
> > org.apache.axiom.om.impl.llom.OMStAXWrapper.generateEvents(OMStAXWrap
> > per.java:1115)
> > at
> > org.apache.axiom.om.impl.llom.OMStAXWrapper.next (OMStAXWrapper.java:9
> > 11)
> > at
> > com.mycom.CreditCardPaymentRequestBinder.toObject(
> CreditCardPaymentRequestBinder.java:138)
> >
> >
> >
> > The toObject method definition is as follows:
> >
> > public CreditCardPaymentRequest toObject(QName qname, XMLStreamReader
> > reader) throws XMLStreamException {
> > CreditCardPaymentRequest obj = new CreditCardPaymentRequest();
> >
> > String rootElementName = qname.getLocalPart ();
> > String uri = qname.getNamespaceURI();
> >
> > if(!rootNsUri.equals(uri)) {
> > throw new XMLStreamException("Invalid namespace " + uri + ".
> Expected
> > namespace uri is " + rootNsUri);
> > }
> >
> > while(reader.hasNext()) {
> > int type = reader.next(); // Line number: 138
> >
> > if(XMLStreamConstants.START_ELEMENT == type){
> > String element = reader.getLocalName ();
> >
> > if( rootLocalName.equals(element) ) {
> > continue;
> > } else if( element.equals("cardNumber") ){
> > obj.setCardNumber(reader.getElementText());
> > } else if( element.equals("expiryMonth") ) {
> > obj.setExpiryMonth(reader.getElementText());
> > } else if( element.equals("expiryYear") ) {
> > obj.setExpiryYear(reader.getElementText());
> > } else if( element.equals("brand") ) {
> > obj.setBrand(reader.getElementText());
> > } else if( element.equals("totalAmount") ) {
> > obj.setTotalAmount(reader.getElementText ());
> > } else if( element.equals("currency") ) {
> > obj.setCurrency(reader.getElementText());
> > } else if( element.equals("systemId") ) {
> > obj.setSystemId(reader.getElementText ());
> > } else if( element.equals("referenceNumber") ) {
> > obj.setReferenceNumber(reader.getElementText());
> > } else if( element.equals("op") ) {
> > obj.setOp(reader.getElementText ());
> > } else {
> > throw new RuntimeException("Unexpected element " + element);
> > }
> > }
> >
> > if(XMLStreamConstants.END_ELEMENT == type){
> > if(reader.getLocalName ().equals(rootElementName)){
> > break;
> > }
> > }
> >
> > }
> >
> > return obj;
> > }
> >
> >
> >
> >
> >
> > Regards,
> >
> > Xinjun
>
>
> --
> Davanum Srinivas :: http://davanum.wordpress.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>