Apache 轴 1.3 - wsdl 中具有相同名称的元素

Apache axis 1.3 - Element with same name in wsdl

我在 wsdl 文件中有一个包含以下元素的 SOAP 服务。(第一个以小写 'i' 开头,第二个以大写 'I' 开头)

字段 1

<element minOccurs="0" name="inventoryOrganization" nillable="true" type="xsd:string"/>

字段 2

<element minOccurs="0" name="InventoryOrganization" nillable="true" type="tns2:ReceiptOfGoods_InventoryOrganization"/>

当我从这个 .wsdl 创建存根时,在存根文件中我有

private java.lang.String inventoryOrganization;

private com.app.system.webservices.dataimport.generated.gr.service.data.ReceiptOfGoods_InventoryOrganization inventoryOrganization2;

生成的XML字段如下

<ns1:inventoryOrganization2 invalid="false">
    <ns1:guid>SAMPLE-ID</ns1:guid>
    <ns1:code>100001</ns1:code>
</ns1:inventoryOrganization2>

<ns1:InventoryOrganization xsi:type="xsd:string">SAMPLE-ID</ns1:InventoryOrganization>

我应该在生成的存根中做些什么更改才能与此服务通信。我希望经过更多研究后,自定义序列化器将是答案。

问题是,在生成的 class 中,字段被映射为

typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("inventoryOrganization");
elemField.setXmlName(new javax.xml.namespace.QName("http://url/data", "InventoryOrganization"));
elemField.setXmlType(new javax.xml.namespace.QName("http://url/data", "ReceiptOfGoods_InventoryOrganization"));
elemField.setMinOccurs(0);
elemField.setNillable(true);

必须改为

typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("inventoryOrganization2");
elemField.setXmlName(new javax.xml.namespace.QName("http://url/data", "InventoryOrganization"));
elemField.setXmlType(new javax.xml.namespace.QName("http://url/data", "ReceiptOfGoods_InventoryOrganization"));
elemField.setMinOccurs(0);
elemField.setNillable(true);

在自动生成的存根中,它被映射为 elemField.setFieldName("inventoryOrganization"); ,而不是 elemField.setFieldName("inventoryOrganization2");