Here is a scenario;
public class CarManagerService {
public wraper.Car[] getCars(){
List<Car> carList = myDomainObject.getCars();
wrapper.Car cars = new wrapper.Cars[carlist.size()];
int i = 0;
for(Car car: carList){
wrapper.Car wrappedCar = new wrapper.Car();
wrappedCar.populate(car); // Will extract fields from Car and
populate the fields in wrapper.Car
cars[i] = wrappedCar;
}
return cars;
}
}
So Axis2 will not know anything about you domain objects, and will only see
the wrapper objects.
-
Azeez
On Mon, Apr 21, 2008 at 2:19 PM, stlecho <[EMAIL PROTECTED]> wrote:
>
> Azeez,
>
> Well, hand coding the WSDL is one of the things I would like to avoid. I
> would like to generate 95% of the WSDL based on existing services and then
> hand code the remaining 5% (changing maxOccurs, adding regular expressions,
> ...).
>
> About your proposed solution of using wrapper objects. I'm not sure if I
> understand it completely.
> -Should Axis2 be configured to use the wrapped objects, i.e. the objects
> used for the web services are objects from the domain model, but mapped to
> a
> specific wrapper object.
> -How does this solve the problem when the Car class contains a property of
> type List<Tyre> ?
>
> Regards, Stefan Lecho.
>
>
> Afkham Azeez wrote:
> >
> > One option is to write wrappers for all the objects that are going to be
> > exposed via a Web service interface. So your Car domain object can be
> > wrapped with a wrapper.Car object and so on. Now your domain model need
> > not
> > be changed.
> >
> > The other option is to hand code the WSDL.
> >
> > Azeez
> >
> > On Thu, Apr 17, 2008 at 5:34 PM, Stefan Lecho <[EMAIL PROTECTED]> wrote:
> >
> >> Hi Azeez,
> >>
> >> The idea that I have is based on a Domain Model (i.e. a model that is
> >> "webservices-free") build some webservices. The solution you propose to
> >> change List<Car> to Car[] works perfectly for the message signature, but
> >> what if the Car domain class contains a property of type List<String> ?
> >> In
> >> that case I would prefer not to change my Domain Model. How can I
> proceed
> >> in
> >> this case ?
> >>
> >> Regards, Stefan Lecho.
> >>
> >>
> >> On Thu, Apr 17, 2008 at 1:11 PM, Afkham Azeez <[EMAIL PROTECTED]> wrote:
> >>
> >> > Axis2 does not support WSDL generation for code containing generics.
> >> > Hence the answer is no. However, you could change you Java method to;
> >> >
> >> > public Car[] getAllCars();
> >> >
> >> > and then this will generate the proper WSDL.
> >> >
> >> > HTH
> >> > Azeez
> >> >
> >> >
> >> > On Thu, Apr 17, 2008 at 4:04 PM, stlecho <[EMAIL PROTECTED]> wrote:
> >> >
> >> > >
> >> > > Hi,
> >> > >
> >> > > I would like to generate a WSDL for the following methods: 'public
> >> > > List<Car>
> >> > > getAllCars();' and 'public Car getOneCar();'. In the generated WSDL
> I
> >> > > expect
> >> > > to have something similar to '<xs:element
> >> > > name="getAllCarsResponse"><xs:complexType><xs:sequence><xs:element
> >> > > minOccurs="0" name="return" nillable="true"
> >> > > type="xxx:Car"/></xs:sequence></xs:complexType></xs:element>'.
> >> > >
> >> > > When using WSDL View, the generated WSDL contains '<xs:element
> >> > > name="getOneCarResponse"><xs:complexType><xs:sequence><xs:element
> >> > > minOccurs="0" name="return" nillable="true"
> >> > >
> >> > >
> >> type="ns0:Car"/></xs:sequence></xs:complexType></xs:element><xs:element
> >> > > name="getAllCarsResponse"><xs:complexType><xs:sequence><xs:element
> >> > > minOccurs="0" name="return" nillable="true"
> >> > > type="xs:anyType"/></xs:sequence></xs:complexType></xs:element>'.
> The
> >> > > getAllCarsResponse element does not contain a reference to the 'Car'
> >> > > element
> >> > > :o(.
> >> > >
> >> > > Based on this experience I was wondering if WSDL View supports
> >> > > generics or
> >> > > should I specify an additional parameter to generate a reference to
> >> > > the
> >> > > 'Car' element in the 'getAllCarsResponse' element ?
> >> > >
> >> > > Regards, Stefan Lecho.
> >> > >
> >> > > --
> >> > > View this message in context:
> >> > >
> >>
> http://www.nabble.com/Does-WSDL-View-support-generics---tp16743209p16743209.html
> >> > > Sent from the WSO2 WSAS Users mailing list archive at Nabble.com.
> >> > >
> >> > >
> >> > > _______________________________________________
> >> > > Wsas-java-user mailing list
> >> > > [email protected]
> >> > > http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Thanks
> >> > Afkham Azeez
> >> >
> >> > http://azeez78.blogspot.com
> >> > http://www.wso2.org
> >> > GPG Fingerprint: 643F C2AF EB78 F886 40C9 B2A2 4AE2 C887 665E 0760
> >> > _______________________________________________
> >> > Wsas-java-user mailing list
> >> > [email protected]
> >> > http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user
> >> >
> >> >
> >>
> >> _______________________________________________
> >> Wsas-java-user mailing list
> >> [email protected]
> >> http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user
> >>
> >>
> >
> >
> > --
> > Thanks
> > Afkham Azeez
> >
> > http://azeez78.blogspot.com
> > http://www.wso2.org
> > GPG Fingerprint: 643F C2AF EB78 F886 40C9 B2A2 4AE2 C887 665E 0760
> >
> > _______________________________________________
> > Wsas-java-user mailing list
> > [email protected]
> > http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Does-WSDL-View-support-generics---tp16743209p16804916.html
> Sent from the WSO2 WSAS Users mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Wsas-java-user mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user
>
--
Thanks
Afkham Azeez
http://azeez78.blogspot.com
http://www.wso2.org
GPG Fingerprint: 643F C2AF EB78 F886 40C9 B2A2 4AE2 C887 665E 0760
_______________________________________________
Wsas-java-user mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user