Debian Codegraph @

test/wsdl/jaxrpchandler2/JAXRPCHandler2TestCase.java

raw
1 package test.wsdl.jaxrpchandler2;
2
3 import junit.framework.TestCase;
4
5 import javax.xml.namespace.QName;
6 import javax.xml.rpc.Call;
7 import javax.xml.rpc.Service;
8 import javax.xml.rpc.ServiceFactory;
9 import java.rmi.RemoteException;
10
11 public class JAXRPCHandler2TestCase extends TestCase {
12
13 public JAXRPCHandler2TestCase(String arg0) {
14 super(arg0);
15 }
16
17 public void testJAXRPCHandler2() throws Exception {
18 String serviceEndpointUrl =
19 "http://localhost:8080/axis/services/EchoService2";
20 String qnameService = "EchoService2";
21 String qnamePort = "EchoServicePort";
22 Call call;
23 String echoString = "my echo string";
24 ServiceFactory serviceFactory = ServiceFactory.newInstance();
25 Service service = serviceFactory.createService(new QName(qnameService));
26 call = service.createCall(new QName(qnamePort));
27 call.setTargetEndpointAddress(serviceEndpointUrl);
28 call.setOperationName(new QName("http://soapinterop.org/", "echo"));
29 String returnString = null;
30 try {
31 returnString = (String) call.invoke(new Object[]{echoString});
32 } catch (RemoteException e) {
33 e.printStackTrace();
34 fail("Remote exception while calling invoke");
35 }
36 assertEquals("returnString does not match echoString",
37 echoString,
38 returnString);
39 }
40
41 public void testJAXRPCHandler3() throws Exception {
42 String serviceEndpointUrl =
43 "http://localhost:8080/axis/services/EchoService3";
44 String qnameService = "EchoService3";
45 String qnamePort = "EchoServicePort";
46 Call call;
47 String echoString = "Joe";
48 ServiceFactory serviceFactory = ServiceFactory.newInstance();
49 Service service = serviceFactory.createService(new QName(qnameService));
50 call = service.createCall(new QName(qnamePort));
51 call.setTargetEndpointAddress(serviceEndpointUrl);
52 call.setOperationName(new QName("http://soapinterop.org/", "echo"));
53 String returnString = null;
54 try {
55 returnString = (String) call.invoke(new Object[]{echoString});
56 } catch (RemoteException e) {
57 e.printStackTrace();
58 fail("Remote exception while calling invoke");
59 }
60 assertEquals(
61 "Sam",
62 returnString);
63 }
64
65 protected void setUp() throws Exception {
66 super.setUp();
67 }
68
69 }