axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Suriarachchi" <amilasuriarach...@gmail.com>
Subject Re: Problem with return HashMap.
Date Tue, 02 Oct 2007 09:45:44 GMT
On 10/1/07, Anne Thomas Manes <atmanes@gmail.com> wrote:
>
> Perhaps -- but if the application consuming the service doesn't
> understand Maps, the whole idea of the Map is lost anyway.


what I mean is something like this

Lets say we have a service interface like this
 public void method1(HashMap param1){

    }

where there is a map and the generated schema in the wsdl would be like
this,

<xsd:schema targetNamespace="urn:org.apache.axis2.rmi.metadata.service"
xmlns:ns3="http://ws.apache.org/rmi/types"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="method1">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element form="unqualified" maxOccurs="unbounded"
minOccurs="0" name="param0" nillable="true"
                             type="ns3:MapType"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="method1Response">
        <xsd:complexType>
            <xsd:sequence/>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>
<xsd:schema targetNamespace="http://ws.apache.org/rmi/types" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
    <xsd:complexType name="MapType">
        <xsd:sequence>
            <xsd:element form="unqualified" minOccurs="0" name="key"
nillable="true" type="xsd:anyType"/>
            <xsd:element form="unqualified" minOccurs="0" name="value"
nillable="true" type="xsd:anyType"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

so any client can code gen for this schema and invoke the service. upon
receing the
request axis2 must be able to produce the hashMap and calls to the method.

So the client no needs to know the hash Maps. The only thing it has to do is
to send the
request according to the wsdl.

On the other hand if a user has the same client code he can create the
request using it.


A good approach is to maintain a clean separation between your
> external XML-based interface and your internal object model -- just as
> you use a DAO to maintain a clean separation between your internal
> object model and a database.


yes this is a  possible approach. but isn't it better to provide  correct
support?

This method has following disadvantages.
1. since we have to create a extra layer it gives a performance issue.
2. we have to maintain two seperate object hierachies. so the code
duplication and problems with
maintance.

Maybe we should be thinking about creating a more formal interface
> abstraction model -- EIO (external interface object)...
>
> Anne
>
> On 9/28/07, Bhojraj, Santosh <Santosh_Bhojraj@ustrust.com> wrote:
> > Nah. The whole idea of the Map would be lost then.
> > This was supported in Axis 1.2. So why can't it be done in Axis2 ?
> >
> >
> >
> > -----Original Message-----
> > From: Anne Thomas Manes [mailto:atmanes@gmail.com]
> > Sent: Friday, September 28, 2007 4:02 PM
> > To: axis-user@ws.apache.org
> > Subject: Re: Problem with return HashMap.
> >
> > A better solution is to convert a hashmap to an array.
> >
> > On 9/28/07, Bhojraj, Santosh <Santosh_Bhojraj@ustrust.com> wrote:
> > > Will it at least work if JIBX is used for data binding ?
> > >
> > >
> > > -----Original Message-----
> > > From: Deepal Jayasinghe [mailto:deepal@opensource.lk]
> > > Sent: Friday, September 28, 2007 9:28 AM
> > > To: axis-user@ws.apache.org
> > > Subject: Re: Problem with return HashMap.
> > >
> > > Axis2 does not support hasmap in 1.3 release. May be we will provide
> > > that in a future release.
> > >
> > > Thanks
> > > Deepal
> > >
> > > cszczotka@interia.pl wrote:
> > > > Hi,
> > > > I have simple web service ( Axis2-1.3 ) which has method return
> > > > java.util.HashMap:
> > > >
> > > > public class SimpleWebService {
> > > >
> > > >       private HashMap<String, String> _map;
> > > >       public SimpleWebService() {
> > > >               _map = new HashMap<String, String>();
> > > >
> > > >       }
> > > >       public HashMap<String, String> getMap() {
> > > >               _map.put("AA", "BB");
> > > >               _map.put("BB", "BB");
> > > >               _map.put("CC", "BB");
> > > >               _map.put("DD", "BB");
> > > >               _map.put("EE", "BB");
> > > >               return _map;
> > > >       }
> > > > }
> > > >
> > > > I use RPCServiceClient. Problem occurred when I try obtain values in
> > > HashMap.
> > > > >From client I have gotten empty hash map.
> > > > Do you have any experience with serialization HashMap or other java
> > > collections ? Do you know where can I find any samples ?
> > > > Regards,
> > > >
> > > >
> > > > --------------------------------------------------------------------
> > > > -- Fajne i smieszne. Zobacz najlepsze filmiki!
> > > >
> > > >
> > > >>>> http://link.interia.pl/f1bbb
> > > >>>>
> > > >
> > > >
> > > > --------------------------------------------------------------------
> > > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Mime
View raw message