Debian Codegraph @

test/wsdl/axis2098/MyServiceTestCase.java

raw
1 /**
2 * MyServiceTestCase.java
3 *
4 * This file was auto-generated from WSDL
5 * by the Apache Axis 1.3 Jul 05, 2005 (04:50:41 KST) WSDL2Java emitter.
6 */
7
8 package test.wsdl.axis2098;
9
10 public class MyServiceTestCase extends junit.framework.TestCase {
11 public MyServiceTestCase(java.lang.String name) {
12 super(name);
13 }
14
15 public void testHelloWorldWSDL() 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.axis2098.MyServiceLocator().getHelloWorldAddress() + "?WSDL");
18 javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.axis2098.MyServiceLocator().getServiceName());
19 assertTrue(service != null);
20 }
21
22 public void test1HelloWorldHelloWorld() throws Exception {
23 test.wsdl.axis2098.MySOAPBindingStub binding;
24 try {
25 binding = (test.wsdl.axis2098.MySOAPBindingStub)
26 new test.wsdl.axis2098.MyServiceLocator().getHelloWorld();
27
28 }
29 catch (javax.xml.rpc.ServiceException jre) {
30 if(jre.getLinkedCause()!=null)
31 jre.getLinkedCause().printStackTrace();
32 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
33 }
34 assertNotNull("binding is null", binding);
35
36 // Time out after a minute
37 binding.setTimeout(60000);
38
39 // Thread.sleep(10*1000);
40
41 MyRequestType request = new MyRequestType();
42
43 // Test operation
44 MyResponseType value = null;
45
46 XsiTestType test = new XsiTestType();
47
48 test.setString("Hello World --------------------------!");
49
50 // Will give a validation error: cvc-elt.4.3: Type 'xsd:boolean' is not validly derived from the type definition, 'LogicType', of element 'Logic'.
51 // It will add a xsi:type boolean but should not: <Logic xsi:type="xsd:boolean">true</Logic>
52 test.setLogic(true);
53
54 RestrictionType r = new RestrictionType();
55 // r.setFirstName("Hello"); //we do not set this but <firstName xsi:nil="true"/> is still sent over the wire
56 r.setLastName("World");
57 test.setRestriction(r);
58
59 test.setStringElem("String Ref");
60
61 request.setHelloworld(test);
62
63 // Invoke webservice
64 MyResponseType response = binding.helloWorld(request);
65
66 System.out.println("Response from the webservice:");
67 System.out.println("\t"+response.getHelloworld());
68 // TBD - validate results
69 }
70
71 }