I'm using Axis2 v1.6.3 to consume https://advertising.criteo.com/API/v201010/AdvertiserService.asmx?WSDL . Everything works ok for many of the requests, but when trying to call getAccount, an exception is risen in the generated client.
The exception propagated is a NullPointerException
caused when calling (in the generated stub) _messageContext.getTransportOut()
.
However, digging further, the problem seems to be due to an IllegalStateException
thrown by XMLStreamReader.next
when executing toOM
for the envelope.
The (slightly modified) stack trace is:
java.lang.IllegalStateException
at org.apache.xmlbeans.impl.store.Jsr173$XMLStreamReaderForString.next(Jsr173.java:1110)
at org.apache.xmlbeans.impl.store.Jsr173$SyncedJsr173.next(Jsr173.java:1138)
at ----.CriteoStub.toOM(CriteoStub.java:2390)
at ----.CriteoStub.toOM(CriteoStub.java:2379)
at ----.CriteoStub.toEnvelope(CriteoStub.java:3657)
at ----.CriteoStub.getAccount(CriteoStub.java:703)
The generated code is:
private org.apache.axiom.om.OMElement toOM(final com.criteo.advertising.api.v201010.GetAccountDocument param)
throws org.apache.axis2.AxisFault {
final javax.xml.stream.XMLStreamReader xmlReader = param.newXMLStreamReader();
while (!xmlReader.isStartElement()) {
try {
xmlReader.next(); //<---------- here is the exception risen
} catch (javax.xml.stream.XMLStreamException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
//...
And, in my case, param content is:
<xml-fragment/>
Google shows related issues in the past, but nothing current and no solution.
Any clue on how to solve this issue?
In my case the problem was caused by the fact that we were using a version for axis2-wsdl2code-maven-plugin
different from the axis2 library.
Changing the axis2-wsdl2code-maven-plugin
version to 1.6.3 solved the issue.