| 1 |
/** |
| 2 |
* ComplexEchoServiceTestCase.java |
| 3 |
* |
| 4 |
* This file was auto-generated from WSDL |
| 5 |
* by the Apache Axis WSDL2Java emitter. |
| 6 |
*/ |
| 7 |
|
| 8 |
package test.wsdl.echo; |
| 9 |
|
| 10 |
public class ComplexEchoServiceTestCase extends junit.framework.TestCase { |
| 11 |
public ComplexEchoServiceTestCase(String name) { |
| 12 |
super(name); |
| 13 |
} |
| 14 |
|
| 15 |
public void testComplexEchoServiceWSDL() throws Exception { |
| 16 |
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); |
| 17 |
java.net.URL url = new java.net.URL(new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoServiceAddress() + "?WSDL"); |
| 18 |
javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.echo.ComplexEchoServiceLocator().getServiceName()); |
| 19 |
assertTrue(service != null); |
| 20 |
} |
| 21 |
|
| 22 |
public void test1ComplexEchoServiceEcho() { |
| 23 |
test.wsdl.echo.Echo binding; |
| 24 |
try { |
| 25 |
binding = new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoService(); |
| 26 |
} |
| 27 |
catch (javax.xml.rpc.ServiceException jre) { |
| 28 |
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); |
| 29 |
} |
| 30 |
assertTrue("binding is null", binding != null); |
| 31 |
|
| 32 |
try { |
| 33 |
test.wsdl.echo.MyComplexType complexType = new test.wsdl.echo.MyComplexType(); |
| 34 |
test.wsdl.echo.holders.MyComplexTypeHolder complexTypeHolder = |
| 35 |
new test.wsdl.echo.holders.MyComplexTypeHolder(complexType); |
| 36 |
binding.echo(complexTypeHolder); |
| 37 |
assertTrue(complexTypeHolder.value.getSimpleItem().equals("MY_SIMPLE_ITEM")); |
| 38 |
} |
| 39 |
catch (java.rmi.RemoteException re) { |
| 40 |
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
public void test2ComplexEchoServiceEcho2() throws Exception { |
| 45 |
test.wsdl.echo.ComplexEchoServiceSoapBindingStub binding; |
| 46 |
try { |
| 47 |
binding = (test.wsdl.echo.ComplexEchoServiceSoapBindingStub) |
| 48 |
new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoService(); |
| 49 |
} |
| 50 |
catch (javax.xml.rpc.ServiceException jre) { |
| 51 |
if (jre.getLinkedCause() != null) |
| 52 |
jre.getLinkedCause().printStackTrace(); |
| 53 |
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); |
| 54 |
} |
| 55 |
assertNotNull("binding is null", binding); |
| 56 |
// Time out after a minute |
| 57 |
binding.setTimeout(60000); |
| 58 |
test.wsdl.echo.MyComplexType2 request = new test.wsdl.echo.MyComplexType2(); |
| 59 |
request.setUsername("xxx"); |
| 60 |
request.setPassword("yyy"); |
| 61 |
request.setOptions(new NamedValue[]{ |
| 62 |
new NamedValue("dummy1", "dummy_val1"), |
| 63 |
new NamedValue("dummy2", |
| 64 |
new NamedValueSet (new NamedValue[]{ |
| 65 |
new NamedValue("dummy2-1", "val2-1"), |
| 66 |
new NamedValue("dummy2-2", new Integer(314)) |
| 67 |
})) |
| 68 |
}); |
| 69 |
// Test operation |
| 70 |
test.wsdl.echo.NamedValue[] value = null; |
| 71 |
value = binding.echo2(request); |
| 72 |
// TBD - validate results |
| 73 |
} |
| 74 |
|
| 75 |
public void test2ComplexEchoServiceEcho21() throws Exception { |
| 76 |
test.wsdl.echo.ComplexEchoServiceSoapBindingStub binding; |
| 77 |
try { |
| 78 |
binding = (test.wsdl.echo.ComplexEchoServiceSoapBindingStub) |
| 79 |
new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoService(); |
| 80 |
} |
| 81 |
catch (javax.xml.rpc.ServiceException jre) { |
| 82 |
if (jre.getLinkedCause() != null) |
| 83 |
jre.getLinkedCause().printStackTrace(); |
| 84 |
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); |
| 85 |
} |
| 86 |
assertNotNull("binding is null", binding); |
| 87 |
// Time out after a minute |
| 88 |
binding.setTimeout(60000); |
| 89 |
test.wsdl.echo.MyComplexType2 request = new test.wsdl.echo.MyComplexType2(); |
| 90 |
request.setUsername("xxx"); |
| 91 |
request.setPassword("yyy"); |
| 92 |
request.setOptions(new NamedValue[]{ |
| 93 |
new NamedValue("dummy1", "dummy_val1"), |
| 94 |
new NamedValue("dummy2", new NamedValue[]{ |
| 95 |
new NamedValue("dummy2-1", "val2-1"), |
| 96 |
new NamedValue("dummy2-2", new Integer(314)) |
| 97 |
}) |
| 98 |
}); |
| 99 |
// Test operation |
| 100 |
test.wsdl.echo.NamedValue[] value = null; |
| 101 |
|
| 102 |
value = binding.echo2(request); |
| 103 |
// TBD - validate results |
| 104 |
} |
| 105 |
} |