1 16 17 package test.encoding; 18 19 import org.apache.axis.client.Call; 20 import org.apache.axis.encoding.TypeMapping; 21 import org.apache.axis.encoding.ser.BeanDeserializerFactory; 22 import org.apache.axis.encoding.ser.BeanSerializerFactory; 23 import org.apache.axis.constants.Style; 24 import test.GenericLocalTest; 25 26 import javax.xml.namespace.QName ; 27 import javax.xml.rpc.ParameterMode ; 28 29 35 public class TestGlobalTypeMappings extends GenericLocalTest { 36 private QName TYPE_QNAME = new QName ("ns", "dataType"); 37 38 public TestGlobalTypeMappings() { 39 super("service"); 40 } 41 42 public TestGlobalTypeMappings(String s) { 43 super(s); 44 } 45 46 protected void setUp() throws Exception { 47 super.setUp(false); TypeMapping tm = (TypeMapping)config.getTypeMappingRegistry(). 49 getDefaultTypeMapping(); 50 tm.register(Data.class, TYPE_QNAME, 51 new BeanSerializerFactory(Data.class, TYPE_QNAME), 52 new BeanDeserializerFactory(Data.class, TYPE_QNAME)); 53 } 54 55 public void testDocLit() throws Exception { 56 deploy("service", this.getClass(), Style.WRAPPED); 57 Call call = getCall(); 58 call.setOperationStyle("wrapped"); 59 call.setOperationUse("literal"); 60 call.setEncodingStyle(""); 61 call.registerTypeMapping(Data.class, TYPE_QNAME, 62 new BeanSerializerFactory(Data.class, TYPE_QNAME), 63 new BeanDeserializerFactory(Data.class, TYPE_QNAME)); 64 call.setReturnClass(Data.class); 65 call.addParameter("arg0", TYPE_QNAME, ParameterMode.IN); 66 Data data = new Data(); 67 data.stringMember = "doc lit test"; 68 data.floatMember = new Float (451.0F); 69 call.invoke("echoData", new Object [] { data }); 70 } 71 72 78 public Data echoData(Data data) { 79 return data; 80 } 81 } 82 | Popular Tags |