Here is what I've done :

I'm using a map to store attributes values during child processing, and build deserialized object on element end. Is there a "cleaner" method ?

public class SiteBaseKeyDeserializer extends DeserializerImpl
{
   private Map values = new HashMap();

public SOAPHandler onStartChild(String namespace, final String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException { return new SimpleDeserializer(String.class, new QName("soapenc:string")) {
           public Object makeValue(String source) throws Exception {
               Object object = super.makeValue(source);
               values.put(localName, object);
               return object;
           };
       };
   }

public void onEndElement(String namespace, String localName, DeserializationContext context) throws SAXException {
       String idSite = (String) values.get("idSite");
       value = new SiteBase.Key(idSite);
   }
}

Nico.

Nicolas De Loof a écrit :


Hello,

I'm trying to setup a BeanDeserializer for a non-javabean compliant object : it's properties are read-only and have to be set using constructor

public class Key{
   public Key(String id, String code) {this.id= id; this.code= code;}

   pulic getId() {.}
   public getCode() {.}
}

This object is a business Key and is immutable, but has to be used in a web service.

Extending DeserializerImpl, I can override onStartChild ands use a basic Deserializer for every String attribute, but how to retrieves values in onEndElement ?

Can someone tell me how to setup a BeanDeserializer for this ?

Nico.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.

Reply via email to