Hi, I tried with @XmlSeeAlso and it works Thanks Gaëtan RUAULT Consultant - Business Consulting Atlantique Sopra group. 28, rue Léo Lagrange 79000 Niort Phone : +33 (0)5 49 77 38 20 [email protected] - www.sopragroup.com Ce message peut contenir des informations confidentielles dont la divulgation est à ce titre rigoureusement interdite en l'absence d'autorisation explicite de l'émetteur. Dans l'hypothèse où vous auriez reçu par erreur ce message, merci de le renvoyer à l'émetteur et de détruire toute copie.
P Pensez à l'environnement avant d'imprimer. ________________________________ De: Mike Edwards [mailto:[email protected]] Date: jeu. 9/16/2010 12:37 À: [email protected] Objet : Re: objects extends with binding.ws Ruault Gaetan wrote: > Hi, > > I have a problem to use Objects extends with Tuscany. > > This my classes organization: > > > public class Personne implements Serializable { > protected Set<CanalContact> setCanalContact; > } > > public class CanalContact implements Serializable { > .. > } > public class AdressePersonne extends CanalContact implements > Serializable { > .. > } > > > This is my destination Service : > @Service(ClientAm.class) > public class ClientAmImpl implements ClientAm { > public EntetePersonne modifierClient(Personne personne); > } > > And the associate composite : > <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" > xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance" > name="Client" > targetNamespace="http://am.client.xxx.com/"> > <component name="ClientComponent"> > <implementation.java > class="com.xxx.referentiel.client.am.ClientAmImpl" /> > <service name="ClientAm" > > <interface.java interface="com.xxx.referentiel.client.am.ClientAm" /> > </service> > </component> > <service name="ClientAm" requires="authentication" > promote="ClientComponent/ClientAm"> > <binding.ws > wsdlElement="http://am.client.xxx.com/ClientService#wsdl.service(ClientService)"/> > </service> > </composite> > > > > > then my problem : > > when i call my service from another compoiste like this : > > public class tes{ > > private ClientAm clientService; > > @Reference > public void setClientService (ClientAm clientService) { > this.clientService = clientService; > } > public void method(){ > Personne personne = new Personne(); > personne.setSetCanalContact(new HashSet<CanalContact>()); > AdressePersonne adresse = new AdressePersonne(); > adresse.setEntree(adrAnonyme); > adresse.setRue(adrAnonyme); > adresse.setLieuDit(""); > personne.getSetCanalContact().add(adresse); > > clientService.modifierClient(personne); > > } > } > > > In my modifierClient method, i don't receive an instance of > AdressePersonne but an CanalContact instance. > > How i can solve my problem ? > > thanks. > Gaetan Gaetan, To help further, I need to see more artifacts belonging to your application: 1) The declaration of the ClientAm interface 2) The WSDL file for the <binding.ws/> element for the "ClientAm" service I suspect that the problem is that the service interface is *only* defined in terms of the superclass and as a result, the Web services serialization code will only serialize the fields belonging to the superclass. To allow for the use of subclasses in the interface, you must add extra metadata in the interface definition to enable serialization of subclasses to take place, such as the JAXB @XmlSeeAlso annotation (effectively this is equivalent to tweaking the WSDL / XSD to indicate an extension point in the XML). This is an important aspect of Service interfaces - they must be EXPLICIT about all the types they are going to use. How else would the client even be aware that a subclass is a possible response type for a given operation? Yours, Mike.
