简体   繁体   English

axis2“意外的子元素值”

[英]axis2 “unexpected subelement value”

I'm trying to use Axis2 to connect to a SOAP webservice. 我正在尝试使用Axis2连接到SOAP Web服务。 This was previously working in Axis 1, but 2 is causing problems. 这以前在Axis 1中起作用,但是2引起了问题。 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". 我已经使用wsdl2java重新生成了Java代码,该代码已经为Axis2生成了存根,但是当处理带有“意外子元素值”的服务器响应元素时,它就wsdl2java了。

The fragment of the wsdl document in question is: 有问题的wsdl文档的片段是:

<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>

The response being returned looks like: 返回的响应如下所示:

<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>

sort of thing. 那类的东西。 Most of these <stuff> blocks process fine, but the last one fails on <b> with the above error. 这些<stuff>块中的大多数<stuff>正常运行,但是最后一个在<b>上失败,并出现上述错误。 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". 调试代码失败,原因是reader.isStartElement()返回false并且new javax.xml.namespace.QName("","b").equals(reader.getName())为false- reader.getName()返回“一种”。 Debugging further, reader.currentElement reports " string " instead of the wrapped object type it usually returns. 进一步调试后, reader.currentElement报告“ string ”,而不是通常返回的包装对象类型。 I have tried this with Axiom 1.2.7 and 1.2.8 - both seem to suffer from the same problem. 我已经使用Axiom 1.2.7和1.2.8进行了尝试-两者似乎都遇到相同的问题。 Is this a known bug, or can anybody shed light on what might be going on? 这是一个已知的错误,还是任何人都可以了解可能发生的情况?

Seems like this was a problem with the SAX binding generator. 似乎这是SAX绑定生成器的问题。 Switching in the JAXB bindings has fixed the problem. 切换JAXB绑定已解决此问题。

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

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