0

I have a SOAP service with following elements in wsdl file.(first one starts with lowercase 'i' and second one with uppercase 'I')

Field 1

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

Field 2

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

When I create the stub from this .wsdl, In the stub file I have

private java.lang.String inventoryOrganization;

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

And the generated XML fields are as below

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

What change should I do in the generated stub to communicate with this service. After some more research I hope, the custom serializer will be the answer.

arjuncc
  • 3,227
  • 5
  • 42
  • 77

1 Answers1

0

The issue was , In the generated class the field was mapped like

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

It has to be changed to

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

In the automatically generated stub, it was mapped as elemField.setFieldName("inventoryOrganization"); , instead of elemField.setFieldName("inventoryOrganization2");

arjuncc
  • 3,227
  • 5
  • 42
  • 77