1 16 17 20 package test.functional; 21 22 import junit.framework.TestCase; 23 import org.apache.axis.client.AdminClient; 24 import org.apache.axis.client.Call; 25 import org.apache.axis.deployment.wsdd.WSDDConstants; 26 import org.apache.axis.encoding.ser.BeanDeserializerFactory; 27 import org.apache.axis.encoding.ser.BeanSerializerFactory; 28 import org.apache.axis.utils.Options; 29 30 import javax.xml.namespace.QName ; 31 import java.io.ByteArrayInputStream ; 32 33 public class TestJWSGlobalTypes extends TestCase { 34 private static final String TYPEMAPPING_WSDD = 35 "<deployment xmlns=\"" + WSDDConstants.URI_WSDD + "\" " + 36 "xmlns:java=\"" + WSDDConstants.URI_WSDD_JAVA + "\" " + 37 "xmlns:ns=\"http://globalTypeTest\">\n" + 38 " <beanMapping type=\"java:test.functional.GlobalBean\" " + 39 "qname=\"ns:GlobalType\"/>\n" + 40 "</deployment>"; 41 42 public TestJWSGlobalTypes(String s) { 43 super(s); 44 } 45 46 protected void setUp() throws Exception { 47 AdminClient client = new AdminClient(); 49 Options opts = new Options(null); 50 ByteArrayInputStream bis = 51 new ByteArrayInputStream (TYPEMAPPING_WSDD.getBytes()); 52 client.process(opts, bis); 53 } 54 55 public void testGlobalTypes() throws Exception { 56 Call call = new Call("http://localhost:8080/jws/GlobalTypeTest.jws"); 57 QName qname = new QName ("http://globalTypeTest", "GlobalType"); 58 call.registerTypeMapping(GlobalBean.class, qname, 59 new BeanSerializerFactory(GlobalBean.class, qname), 60 new BeanDeserializerFactory(GlobalBean.class, qname)); 61 GlobalBean bean = new GlobalBean(); 62 bean.setIntValue(4); 63 GlobalBean ret = (GlobalBean)call.invoke("echo", new Object [] { bean }); 64 assertEquals(4, ret.getIntValue()); 65 } 66 } 67 | Popular Tags |