axis2“意外的子元素值" [英] axis2 "unexpected subelement value"

查看:115
本文介绍了axis2“意外的子元素值"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Axis2连接到SOAP Web服务.这以前在Axis 1中起作用,但是2引起了问题.我已经使用wsdl2java重新生成了Java代码,该代码已经为Axis2生成了存根,但是当处理带有意外子元素值"的服务器响应元素时,它就会崩溃.

I'm trying to use Axis2 to connect to a SOAP webservice. This was previously working in Axis 1, but 2 is causing problems. I've regenerated the Java code using wsdl2java which has generated the stubs for Axis2, but it's falling over when processing an element of the server response with "unexpected subelement value".

所涉及的wsdl文档的片段是:

The fragment of the wsdl document in question is:

<complexType name="A">
<sequence>
<element name="a" type="xsd:base64Binary" minOccurs="1" maxOccurs="1" nillable="false" />
<element name="b" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="c" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="d" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="e" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="f" type="xsd:string" minOccurs="1" maxOccurs="1" />
</sequence>
</complexType>

返回的响应如下:

<stuff>
<a>dsfusdbifsdisuibvuidnfuisndfvl\sbvuidn</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>
<stuff>
<a>dsfusdbifsdisdfsfsdfsdfuibvuidnfuisndfvl\dfgd</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>
<stuff>
<a>dsfusdbifsdisuibvuidnfuisndfvl\sdfsdfvv</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>
<stuff>
<a>wwasdfgfbdfb\sbv==uidn</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>

一类的东西.这些<stuff>块中的大多数都可以正常运行,但是最后一个在<b>上失败,并出现上述错误.调试代码失败,因为reader.isStartElement()返回false并且new javax.xml.namespace.QName("","b").equals(reader.getName())为false-reader.getName()返回"a".进一步调试后,reader.currentElement报告"字符串",而不是通常返回的包装对象类型.我已经使用Axiom 1.2.7和1.2.8进行了尝试-两者似乎都遇到相同的问题.这是一个已知的错误,还是任何人都可以了解可能发生的情况?

sort of thing. Most of these <stuff> blocks process fine, but the last one fails on <b> with the above error. Debugging the code, it fails because reader.isStartElement() returns false and new javax.xml.namespace.QName("","b").equals(reader.getName()) is false - reader.getName() returns "a". Debugging further, reader.currentElement reports "string" instead of the wrapped object type it usually returns. I have tried this with Axiom 1.2.7 and 1.2.8 - both seem to suffer from the same problem. Is this a known bug, or can anybody shed light on what might be going on?

推荐答案

似乎这是SAX绑定生成器的问题.切换JAXB绑定已解决了该问题.

Seems like this was a problem with the SAX binding generator. Switching in the JAXB bindings has fixed the problem.

这篇关于axis2“意外的子元素值"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆