KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > nested > Nested2ServiceTestCase


1 /**
2  * Nested2ServiceTestCase.java
3  *
4  * This file was auto-generated from WSDL
5  * by the Apache Axis Wsdl2java emitter.
6  */

7
8 package test.wsdl.nested;
9 import org.apache.axis.message.MessageElement;
10 import test.wsdl.nested.holders._PE_ADDRESSHolder;
11 import test.wsdl.nested.holders._RETURNHolder;
12
13 public class Nested2ServiceTestCase extends junit.framework.TestCase {
14     public Nested2ServiceTestCase(String JavaDoc name) {
15         super(name);
16     }
17
18     /* FIXME: RUNTIME WSDL broken.
19     public void testNestedWSDL() throws Exception {
20         javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
21         java.net.URL url = new java.net.URL(new test.wsdl.nested.Nested2ServiceLocator().getNestedAddress() + "?WSDL");
22         javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.nested.Nested2ServiceLocator().getServiceName());
23         assertTrue(service != null);
24     }
25     */

26
27     public void test1NestedNestedSvc2() {
28         test.wsdl.nested.Nested2PortType binding;
29         try {
30             binding = new test.wsdl.nested.Nested2ServiceLocator().getNested();
31         }
32         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
33             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
34         }
35         assertTrue("binding is null", binding != null);
36
37         try {
38             _PE_ADDRESSHolder pE_ADDRESS = new _PE_ADDRESSHolder();
39             _RETURNHolder rETURN = new _RETURNHolder();
40             binding.nestedSvc2(new java.lang.String JavaDoc("0000001000"),
41                                new java.lang.String JavaDoc("01"),
42                                new java.lang.String JavaDoc("00"),
43                                new java.lang.String JavaDoc(""),
44                                new java.lang.String JavaDoc("1000"),
45                                pE_ADDRESS,
46                                rETURN);
47             _PE_ADDRESS address = pE_ADDRESS.value;
48             _RETURN ret = rETURN.value;
49             assertTrue("NAME is wrong", address.getNAME().equals("Becker Berlin"));
50             assertTrue("LOGMSGNO is wrong", ret.getLOG_MSG_NO().equals("123456"));
51             MessageElement [] any = address.get_any();
52             assertNotNull("No 'any' content", any);
53             assertTrue("any is wrong:" + any[0],
54                        any[0].getObjectValue().equals("Test Any"));
55         }
56         catch (java.rmi.RemoteException JavaDoc re) {
57             throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
58         }
59     }
60
61     public static void main(String JavaDoc[] args){
62         Nested2ServiceTestCase testcase = new Nested2ServiceTestCase("Nested2ServiceTestCase");
63         testcase.test1NestedNestedSvc2();
64     }
65 }
66
67
Popular Tags