⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polymorphismtest_servicetestcase.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
字号:
/** * PolymorphismTest_ServiceTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */package test.wsdl.polymorphism;public class PolymorphismTest_ServiceTestCase extends junit.framework.TestCase {    public PolymorphismTest_ServiceTestCase(String name) {        super(name);    }    public void testPolymorphismTestWSDL() throws Exception {        javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();        java.net.URL url = new java.net.URL(new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTestAddress() + "?WSDL");        javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getServiceName());        assertTrue(service != null);    }    public void test1PolymorphismTestGetBAsA() {        test.wsdl.polymorphism.PolymorphismTest_PortType binding;        try {            binding = new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest();        }        catch (javax.xml.rpc.ServiceException jre) {            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertTrue("binding is null", binding != null);        try {            test.wsdl.polymorphism.A value = null;            // Passing false here gets us a "B"            value = binding.getBAsA(false);            // Check out the return value for correctness.            assertTrue("Return value wasn't a 'B'!", value instanceof B);            B myB = (B)value;            assertEquals("B field didn't match",                         PolymorphismTestSoapImpl.B_TEXT,                         myB.getB());            assertEquals("A field didn't match",                         PolymorphismTestSoapImpl.A_TEXT,                         myB.getA());        }        catch (java.rmi.RemoteException re) {            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);        }    }    public void test1PolymorphismTestGetCAsA() {        test.wsdl.polymorphism.PolymorphismTest_PortType binding;        try {            binding = new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest();        }        catch (javax.xml.rpc.ServiceException jre) {            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertTrue("binding is null", binding != null);        try {            test.wsdl.polymorphism.A value = null;            // Passing true here gets us a "C" on the server side, but since            // there's no type mapping for that we should just get the "A"            // part.            value = binding.getBAsA(true);            // Check out the return value for correctness.            assertTrue("Return value wasn't an 'A'!", value instanceof A);            assertEquals("A field didn't match",                         PolymorphismTestSoapImpl.A_TEXT,                         value.getA());        }        catch (java.rmi.RemoteException re) {            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -