Java 在非空数组上生成nil的轴
我在WSDL中有以下标记:Java 在非空数组上生成nil的轴,java,web-services,axis,Java,Web Services,Axis,我在WSDL中有以下标记: <xs:element name="promoCodeValues" maxOccurs="1" minOccurs="0" > <xs:complexType> <xs:sequence> <xs:element nillable="false" nam
<xs:element name="promoCodeValues" maxOccurs="1" minOccurs="0" >
<xs:complexType>
<xs:sequence>
<xs:element nillable="false" name="promoCode" type="ac:stringMax20"/>
</xs:sequence>
</xs:complexType>
</xs:element>
在我的java代码中,我调用它来填充PromoCodeValue:
String[] promoCodes = {"test"};
request.setPromoCodeValues(promoCodes);
但在我的XML中,我有一个始终是这样的:
<promoCodeValues><promoCode xsi:nil="true"/></promoCodeValues>
我在Axis的JIRA上发现了这个:
我一步一步地遵循提供的补丁,发现一切都已经存在(我使用Axis1.4)。有人知道如何解决这个问题吗??我真的很困惑,不想迁移到其他地方。解决了它!我正在发布答案,以防有人会有同样的问题。 实际上,Eclipse中有一个选项可以用来生成bean而不是数组。 转到窗口->首选项->Web服务->Axis发射器并检查 对于包装的XML数组类型,更喜欢构建bean而不是直接数组 然后重新生成web服务客户端
<promoCodeValues><promoCode xsi:nil="true"/></promoCodeValues>