I m implementing web service using axis2. The problem i m facing is with returning a complex structure in one of the methods. Here is what i want to do:
as a return type - Map<String, Pair[]>
where Pair is
public class Pair {
private String key;
private String value;
...........
}
i m testing it with SoapUI
and the return is always empty here is a simple response i got
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getSNSTrendsResponse xmlns:ns="http://soap.sso.vwdcrm.app.mailprofiler.com">
<ns:return xsi:type="ax211:SNSData" xmlns:ax212="http://util.java/xsd" xmlns:ax211="http://objects.soap.sso.vwdcrm.app.mailprofiler.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax211:errorCode>1</ax211:errorCode>
<ax211:errorMessage xsi:nil="true"/>
<ax211:pairsResponse xsi:type="axis2ns2:anyType">
<empty xmlns="http://www.w3.org/2001/XMLSchema">false</empty>
</ax211:pairsResponse>
<ax211:response xsi:nil="true"/>
</ns:return>
</ns:getSNSTrendsResponse>
</soapenv:Body>
</soapenv:Envelope
where pairResponse should contains the result...
Java generics (contrary to arrays types for instance) are erased during compilation, thus for Axis
Map<String, Pair[]>
is the same thing asMap
.The usual way of representing key-to-object mapping in Java SOAP is to use an array where objects contain their key.
In your case, if your Map is indexed by
Pair.key
value, then using aPair[]
should work.