Axis cannot find the mapping that is needed to translate objects that you submit via XML. He does not know how to translate XML into an object or vice versa. A good idea is to return an object containing an array of objects.
With Axis, you have to say how to make a mapping between XML and an object. This is determined using the WSDL and the classes themselves.
1) Look at the WSDL generated by the web service: you can find this by looking at http: // localhost: 8080 / Service? Wsdl . Check that this is normal.
2) Axis finds this mapping by looking at the return value of Class.getTypeDesc (); Verify that this match is correct.
For one of my services, I have the following mapping, defined as the return value of a web service (RechercherBatimentRetour class, subclass of Retour class).
typeDesc.setXmlType(new QName("sbatimentto", "RechercherBatimentRetour")); // 1 org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("batiments"); elemField.setXmlName(new QName("", "batiments")); // 2 elemField.setXmlType(new QName("sbatimentto", "ResumeBatimentTo")); elemField.setNillable(true); typeDesc.addFieldDesc(elemField);
This defines the return value of this SOAP service.
// 1 → This means that the WSDL ComplexType RechercherBatimentRetour is in the namespace 'sbatimentto'.
// 2 → We add the 'batiments' field to the ComplexType, which is defined through getter and setter in the class as:
public ResumeBatimentTo[] getBatiments() { return batiments; } public void setBatiments(ResumeBatimentTo[] batiments) { this.batiments = batiments; }
ResumeBatimentTo is also in the same namespace. So it ends with a WSDL that contains (among others)
<complexType name = "Retour">
<sequence>
<element name = "codeRetour" nillable = "true" type = "xsd: string" />
<element name = "message" nillable = "true" type = "xsd: string" />
<element name = "statut" type = "xsd: boolean" />
</sequence>
</complexType>
<complexType name = "RechercherBatimentRetour">
<complexContent>
<extension base = "tns1: Retour">
<sequence>
<element name = "batiments" nillable = "true" type = "impl: ArrayOf_tns1_ResumeBatimentTo" />
</sequence>
</extension>
</complexContent>
</complexType>
All classes used must have the correct definitions getTypeDesc, getSerializer, and getDeserializer before they can be used.