我正在使用 XMLBeans 绑定(bind)开发基于 Axis2 的 WebServices。我已使用 WSDL2Java 生成器生成了代码,并尝试使用请求中设置的示例值对其进行测试。
在其中一个 setter 方法(自动生成的代码)中,我找到了以下代码。方法 get_store()
返回一个 null 值,因此我得到一个 NullPointerException。
target = (org.apache.xmlbeans.SimpleValue)
get_store().find_element_user(TRANSACTIONTYPE$0, 0);
我尝试 Google 寻找解决方案,结果发现 similar issue没有指定解决方案。
这个问题有解决办法吗?请帮助我
最佳答案
这个问题已经解决!!
我实际上试图以正常的 Java 方式实例化响应对象,因此在运行 WebServices 时出现了上述异常。
错误的方式 - ResponseType responseType = new ResponseType();
正确方法 - ResponseType responseType = ResponseType.Factory.newInstance();
关于java - XMLBeans get_store() 方法返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7144183/