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.
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:
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 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.
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:
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!!
This tiny ad is wafer thin:
a bit of art, as a gift, that will fit in a stocking