• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

AXIS 1.4 ERROR while Deserializing Nested Array of Objects in the response

Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,

Need some help with an error related to AXIS webservice.

We have an integration with a third-party for tax calculation. Recently, they have asked us to upgrade to a newer version of their services. The new version of wsdl adds an array of jurisdiction objects. We are getting a NullPointerException when the Axis library tries to deserialize the response received for this new service.  We are using Axis 1.4 library.

The error trace that I have attached is from a standalone test program which I am using to debug the issue.
It appears that the error happens due to nested array of complex type objects. Somehow i feel that AXIS is unable to deserialize the response when it contains a nested array of complex objects.

I beleive this issue occurs when response is of type, Axis deserializer breaks after parsing the first <c:frtype> element.
<c:frItem id="0">
 <c:frtype id="0">
 <c:frName id="0">Type1</c:frName>
 <c:frType id="0">absdf</c:frType>
 <c:frDesc id="0">trfdgd</c:frDesc>
 <c:frtype id="1">
 <c:frName id="0">Type2</c:frName>
 <c:frType id="0">abhg</c:frType>
 <c:frDesc id="0">yiuhj</c:frDesc>

5136 [main] DEBUG org.apache.axis.encoding.DeserializationContext  - Popped element stack to org.apache.axis.message.MessageElement:item
5136 [main] DEBUG org.apache.axis.encoding.DeserializationContext  - Exit: DeserializationContext::endElement()
5136 [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  - org.apache.axis.i18n.resource::handleGetObject(exception00)
5136 [main] ERROR org.apache.axis.client.Call  - Exception:
      at org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:135)
      at org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)
      at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)
      at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
      at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
      at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
      at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
      at org.apache.axis.client.Call.invoke(Call.java:2467)
      at org.apache.axis.client.Call.invoke(Call.java:2366)
      at org.apache.axis.client.Call.invoke(Call.java:1812)
      at com.provider.stub.ITransactionProcessorStub.runTransaction(ITransactionProcessorStub.java:2019)
      at Sample.main(Sample.java:143)
AxisFault: java.lang.NullPointerException

Please let me know if you have seen any similar issues or have any ideas on why this could be happening. I have attached the sample response and the detailed logs with this post.

I found a couple of similar posts upon googling but none of them had any solutions.

[Thumbnail for LogsAndSample_zip.jpg]
Logs and Sample Response - Rename to .zip and extract
Mehta Tejas
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to find a workaround for the AXIS issue. I created a sample webservice to test and analyse this issue and got the same error with the sample service. Upon debugging, I found that the issue happens due to the “id” attributes of the array elements within the webservice response.

For example:


To resolve this, I downloaded the axis 1.4 source code and made a small change in the DeserializerImpl class to prefix the “id” with the elementName. This id was being used in a Map which was causing the deserialization to break when the nested elements contain the same value for “id”.  I tested the updated axis.jar with the sample service and the service works fine.

The exact changes done in the DeserializerImpl class are as below:

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been researching the same issue! Looking at the fix you posted, it appears incomplete because you are essentially changing the key that is used in a couple of maps without changing any of the places that get values out of those map to use the new key. I took a look at fixing both the PUT side and GET side of the maps but it seemed like it could get messy based on how Axis1 is using id's and href's and sometimes calling hrefs ids and what has a "#" appended in front of it and what doesn't... it's a wonder any of this stuff works!  

I believe the core issue is that Axis1 is treating fields named "id" like they are of type "XSD ID" and assuming they will be unique across the entire document.

I am thinking a more targeted fix might be to introduce a check of the type of fields named "id" before they're treated like "XSD IDs".

In org.apache.axis.encoding.DeserializerImpl - there is a section of code as follows:

Thank you for this post!!
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic