1 package test.wsdl.interop3.docLitParam; 2 3 4 import test.wsdl.interop3.docLitParam.xsd.ArrayOfstring_Literal; 5 import test.wsdl.interop3.docLitParam.xsd.SOAPStruct; 6 7 import java.net.URL ; 8 9 28 29 public class DocLitParamTestCase extends junit.framework.TestCase { 30 static URL url; 31 32 public DocLitParamTestCase(String name) { 33 super(name); 34 } 35 36 protected void setUp() throws Exception { 37 } 38 39 public void testStep3() throws Exception { 40 WSDLInteropTestDocLitPortType binding; 41 try { 42 if (url != null) { 43 binding = new WSDLInteropTestDocLitServiceLocator().getWSDLInteropTestDocLitParamPort(url); 44 } else { 45 binding = new WSDLInteropTestDocLitServiceLocator().getWSDLInteropTestDocLitParamPort(); 46 } 47 } 48 catch (javax.xml.rpc.ServiceException jre) { 49 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 50 } 51 assertNotNull("binding is null", binding); 52 53 String str = "Hello there!"; 54 String [] strArray = new String [] { "1", "two", "trois" }; 55 ArrayOfstring_Literal param = new ArrayOfstring_Literal(); 56 param.setString(strArray); 57 58 assertEquals("echoString results differ", binding.echoString(str), str); 59 60 String [] resArray = binding.echoStringArray(param).getString(); 61 assertEquals("String array lengths differ", 62 strArray.length, 63 resArray.length); 64 for (int i = 0; i < strArray.length; i++) { 65 assertEquals("Array members at index " + i + " differ", 66 strArray[i], 67 resArray[i]); 68 } 69 70 SOAPStruct struct = new SOAPStruct(); 71 struct.setVarFloat(3.14159F); 72 struct.setVarInt(69); 73 struct.setVarString("Struct-o-rama"); 74 75 assertTrue("Structs weren't equal", 76 struct.equals(binding.echoStruct(struct))); 77 } 78 79 80 81 public static void main(String [] args) { 82 if (args.length == 1) { 83 try { 84 url = new URL (args[0]); 85 } catch (Exception e) { 86 } 87 } 88 89 junit.textui.TestRunner.run(new junit.framework.TestSuite(DocLitParamTestCase.class)); 90 } } 92 93 | Popular Tags |