Since axis supports automatic serialization and deserialization of JavaBean, Java object and xml soap message ing are realized, so the map object of Java is passed. net is the simplest way to implement a JavaBean array object:
File 1:
Public class mapentryvo {
Private object key;
Private object value;
Public mapentryvo (){
}
Public mapentryvo (Object key, object Value ){
This. Key = key;
This. value = value;
}
Public object getkey (){
Return key;
}
Public void setkey (object Value ){
Key = value;
}
Public object getvalue (){
Return value;
}
Public void setvalue (object Value ){
This. value = value;
}
}
File 2:
Import java. util .*;
Public class webservicesutils {
Public static mapentryvo [] convertmaptomapentryvo (MAP Conv ){
Mapentryvo [] result = new mapentryvo [Conv. Size ()];
Int I = 0;
Iterator iter = Conv. entryset (). iterator ();
While (ITER. hasnext ()){
Map. Entry item = (Map. Entry) ITER. Next ();
Result [I ++] = new mapentryvo (item. getkey (), item. getvalue ());
}
Return result;
}
}
File 3:
// Example WebService
Public class testservice {
Public mapentryvo [] testmethod (){
Java. util. MAP value = new java. util. hashmap ();
Value. Put ("Key 1", "value 1 ");
Value. Put ("Key 2", "value 2 ");
Return webservicesutils. convertmaptomapentryvo (value );
}
}
CodeAfter that, remember to configure the serialization of the JavaBean in the server-config.wsdd (or deployment file deploy. WSDD) to inform axis of the object you need to serialize automatically:
<Typemapping QNAME = "Java: mapentryvolist"
Type = "Java: mapentryvo []"
Serializer = "org. Apache. axis. encoding. Ser. arrayserializerfactory"
Deserializer = "org. Apache. axis. encoding. Ser. arraydeserializerfactory"
Encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/"/>
<Typemapping QNAME = "Java: mapentryvo"
Type = "Java: mapentryvo"
Serializer = "org. Apache. axis. encoding. Ser. beanserializerfactory"
Deserializer = "org. Apache. axis. encoding. Ser. beandeserializerfactory"
Encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/"/>
Refer:
Http://wiki.apache.org/ws/FrontPage/Axis/DotNetInteropMapInfo