简体   繁体   English

生成的客户端存根中的Java Axis2 IllegalStateException

[英]Java Axis2 IllegalStateException in generated client stub

I'm using Axis2 v1.6.3 to consume https://advertising.criteo.com/API/v201010/AdvertiserService.asmx?WSDL . 我正在使用Axis2 v1.6.3来使用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. 对于许多请求,一切正常,但在尝试调用getAccount时,生成的客户端会出现异常。

The exception propagated is a NullPointerException caused when calling (in the generated stub) _messageContext.getTransportOut() . 传播的异常是在调用(在生成的存根中) _messageContext.getTransportOut()时导致的NullPointerException However, digging further, the problem seems to be due to an IllegalStateException thrown by XMLStreamReader.next when executing toOM for the envelope. 但是,进一步挖掘,问题似乎是由于XMLStreamReader.next在为包络执行toOM时抛出了IllegalStateException

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/> 而且,就我而言,param内容是: <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. 在我的情况下,问题是由于我们使用了与axis2库不同的axis2-wsdl2code-maven-plugin的版本。

Changing the axis2-wsdl2code-maven-plugin version to 1.6.3 solved the issue. axis2-wsdl2code-maven-plugin版本更改为1.6.3解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM