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

📄 whitemesasoap12testsvctestcase.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/** * WhiteMesaSoap12TestSvcTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */package test.wsdl.soap12.assertion;import org.apache.axis.message.SOAPHeaderElement;import org.apache.axis.message.SOAPEnvelope;import org.apache.axis.Constants;import org.apache.axis.MessageContext;import org.apache.axis.AxisFault;import org.apache.axis.soap.SOAPConstants;import org.apache.axis.constants.Style;import org.apache.axis.client.Call;import org.apache.axis.client.Service;import java.util.Arrays;import java.util.TimeZone;import java.util.Calendar;import java.util.ArrayList;import java.util.Iterator;public class WhiteMesaSoap12TestSvcTestCase extends junit.framework.TestCase {    public final String TEST_NS = "http://example.org/ts-tests";    public final String DOC_ENDPOINT = "http://www.whitemesa.net/soap12/test-doc";    public final String INTERMEDIARY_ENDPOINT = "http://www.whitemesa.net/soap12/test-intermediary";    public final String ROLE_A = "http://example.org/ts-tests/A";    public final String ROLE_B = "http://example.org/ts-tests/B";    public final String ROLE_C = "http://example.org/ts-tests/C";    public WhiteMesaSoap12TestSvcTestCase(java.lang.String name) {        super(name);    }    public void testSoap12TestDocPortWSDL() throws Exception {        javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();        java.net.URL url = new java.net.URL(new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestDocPortAddress() + "?WSDL");        javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getServiceName());        assertTrue(service != null);    }    public void testSoap12TestRpcPortWSDL() throws Exception {        javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();        java.net.URL url = new java.net.URL(new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPortAddress() + "?WSDL");        javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getServiceName());        assertTrue(service != null);    }    public void test1Soap12TestRpcPortReturnVoid() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        // Test operation        binding.returnVoid();        // TBD - validate results    }    public void test2Soap12TestRpcPortEchoStruct() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        test.wsdl.soap12.assertion.xsd.SOAPStruct input = new test.wsdl.soap12.assertion.xsd.SOAPStruct();        input.setVarFloat(-5);        input.setVarInt(10);        input.setVarString("EchoStruct");                // Test operation        test.wsdl.soap12.assertion.xsd.SOAPStruct output = null;        output = binding.echoStruct(input);        // TBD - validate results        assertEquals(input, output);    }    public void test3Soap12TestRpcPortEchoStructArray() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        test.wsdl.soap12.assertion.xsd.SOAPStruct[] input = new test.wsdl.soap12.assertion.xsd.SOAPStruct[1];        input[0] = new test.wsdl.soap12.assertion.xsd.SOAPStruct();        input[0].setVarFloat(-5);        input[0].setVarInt(10);        input[0].setVarString("EchoStruct");        // Test operation        test.wsdl.soap12.assertion.xsd.SOAPStruct[] output = null;        output = binding.echoStructArray(input);        // TBD - validate results        assertTrue(Arrays.equals(input,output));    }    public void test4Soap12TestRpcPortEchoStructAsSimpleTypes() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        test.wsdl.soap12.assertion.xsd.SOAPStruct input = new test.wsdl.soap12.assertion.xsd.SOAPStruct();        input.setVarFloat(-5);        input.setVarInt(10);        input.setVarString("EchoStructAsSimpleTypes");                javax.xml.rpc.holders.StringHolder out1 = new javax.xml.rpc.holders.StringHolder();        javax.xml.rpc.holders.IntHolder out2 = new javax.xml.rpc.holders.IntHolder();        javax.xml.rpc.holders.FloatHolder out3 = new javax.xml.rpc.holders.FloatHolder();        // Test operation        binding.echoStructAsSimpleTypes(input, out1, out2, out3);        // TBD - validate results        assertEquals(out1.value, input.getVarString());        assertEquals(out2.value, input.getVarInt());        assertTrue(out3.value == input.getVarFloat());    }    public void test5Soap12TestRpcPortEchoSimpleTypesAsStruct() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        String input1 = new String("EchoSimpleTypesAsStruct");        int    input2 = 50;        float  input3 = 45.5F;        // Test operation        test.wsdl.soap12.assertion.xsd.SOAPStruct output = null;        output = binding.echoSimpleTypesAsStruct(input1, input2, input3);                // TBD - validate results        assertEquals(input1, output.getVarString());        assertEquals(input2, output.getVarInt());        assertTrue(input3 == output.getVarFloat());    }    public void test6Soap12TestRpcPortEchoNestedStruct() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        test.wsdl.soap12.assertion.xsd.SOAPStructStruct input = new test.wsdl.soap12.assertion.xsd.SOAPStructStruct();        input.setVarFloat(-5);        input.setVarInt(10);        input.setVarString("EchoNestedStruct1");        test.wsdl.soap12.assertion.xsd.SOAPStruct inputInner = new test.wsdl.soap12.assertion.xsd.SOAPStruct();        inputInner.setVarFloat(-5);        inputInner.setVarInt(10);        inputInner.setVarString("EchoNestedStruct2");                input.setVarStruct(inputInner);                // Test operation        test.wsdl.soap12.assertion.xsd.SOAPStructStruct output = null;        output = binding.echoNestedStruct(input);                // TBD - validate results        assertEquals(input, output);    }    public void test7Soap12TestRpcPortEchoNestedArray() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        test.wsdl.soap12.assertion.xsd.SOAPArrayStruct input = new test.wsdl.soap12.assertion.xsd.SOAPArrayStruct();        input.setVarFloat(-5);        input.setVarInt(10);        input.setVarString("EchoNestedArray1");        input.setVarArray(new String[] {"EchoNestedArray2","EchoNestedArray3","EchoNestedArray4"});        // TODO: This does not work :(        //// Test operation        //test.wsdl.soap12.assertion.xsd.SOAPArrayStruct output = null;        //output = binding.echoNestedArray(input);        //// TBD - validate results        //assertEquals(input, output);    }    public void test8Soap12TestRpcPortEchoFloatArray() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        float[] input = new float[] {            1.1F,            1.2F,            1.3F        };        // Test operation        float[] output = null;        output = binding.echoFloatArray(input);                // TBD - validate results        assertTrue(Arrays.equals(input,output));    }    public void test9Soap12TestRpcPortEchoStringArray() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        String[] input = new String[] {            "1.1F",            "1.2F",            "1.3F"        };        // Test operation        java.lang.String[] output = null;        output = binding.echoStringArray(input);        // TBD - validate results        assertTrue(Arrays.equals(input,output));    }    public void test10Soap12TestRpcPortEchoIntegerArray() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);        // Time out after a minute        binding.setTimeout(60000);        int[] input = new int[] {            1,            2,            3        };        // Test operation        int[] output = null;        output = binding.echoIntegerArray(input);        // TBD - validate results        assertTrue(Arrays.equals(input,output));    }    public void test11Soap12TestRpcPortEchoBase64() throws Exception {        test.wsdl.soap12.assertion.Soap12TestRpcBindingStub binding;        try {            binding = (test.wsdl.soap12.assertion.Soap12TestRpcBindingStub)                          new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort();        }        catch (javax.xml.rpc.ServiceException jre) {            if(jre.getLinkedCause()!=null)                jre.getLinkedCause().printStackTrace();            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);        }        assertNotNull("binding is null", binding);

⌨️ 快捷键说明

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