axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas" <dava...@gmail.com>
Subject Re: [Axis2] AXIOM Custom Serializer/Deserializer
Date Thu, 03 May 2007 15:18:25 GMT
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 <xjchen001@gmail.com> 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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message