1 package tableapp.business.axis; 2 3 11 12 import org.apache.axis.Constants; 13 import org.apache.axis.encoding.DeserializationContext; 14 import org.apache.axis.encoding.Deserializer; 15 import org.apache.axis.encoding.DeserializerImpl; 16 import org.apache.axis.encoding.FieldTarget; 17 import org.apache.axis.message.SOAPHandler; 18 import org.xml.sax.Attributes ; 19 import org.xml.sax.SAXException ; 20 21 import javax.xml.namespace.QName ; 22 import java.util.Hashtable ; 23 import tableapp.spec.Access; 24 import tableapp.business.AccessImpl; 25 26 import java.util.Date ; 27 28 public class AccessDeser 29 extends DeserializerImpl { 30 31 public static final String INTMEMBER = "noAccesses"; 32 public static final String DATEMEMBER = "sDate"; 33 34 private Hashtable typesByMemberName = new Hashtable (); 35 36 public AccessDeser() { 37 typesByMemberName.put(INTMEMBER, Constants.SOAP_INT); 38 typesByMemberName.put(DATEMEMBER, Constants.XSD_STRING); 39 value = (Access)new AccessImpl(); 40 ( (Access) value).setNoAccesses(9); 41 } 43 44 46 47 55 public SOAPHandler onStartChild(String namespace, 56 String localName, 57 String prefix, 58 Attributes attributes, 59 DeserializationContext context) throws 60 SAXException { 61 QName typeQName = (QName ) typesByMemberName.get(localName); 62 if (typeQName == null) 63 throw new SAXException ("Invalid element in Data struct - " + localName); 64 65 Deserializer dSer = context.getDeserializerForType(typeQName); 67 try { 68 dSer.registerValueTarget(new FieldTarget(value, localName)); 69 } 70 catch (NoSuchFieldException e) { 71 throw new SAXException (e); 72 } 73 74 if (dSer == null) 75 throw new SAXException ("No deserializer for a " + typeQName + "???"); 76 77 return (SOAPHandler) dSer; 78 } 79 } | Popular Tags |