1 22 package org.jboss.test.webservice.encstyle; 23 24 import javax.naming.InitialContext ; 25 import javax.xml.rpc.Service ; 26 27 import org.jboss.test.webservice.WebserviceTestBase; 28 29 35 public class EncStyleTestCase extends WebserviceTestBase 36 { 37 public EncStyleTestCase(String name) 38 { 39 super(name); 40 } 41 42 43 public void testDocStyle() throws Exception 44 { 45 deploy("ws4ee-encstyle-doc.war"); 46 deploy("ws4ee-encstyle-doc-client.jar"); 47 try 48 { 49 InitialContext iniCtx = getClientContext(); 50 Service service = (Service )iniCtx.lookup("java:comp/env/service/SampleService"); 51 SampleEndpointDOC port = (SampleEndpointDOC)service.getPort(SampleEndpointDOC.class); 52 53 UserType user = new UserType(); 54 user.setFirstName("John"); 55 user.setLastName("Smith"); 56 SampleEndpoint_changeSalary_RequestStruct req = new SampleEndpoint_changeSalary_RequestStruct(user, new Integer (5000)); 57 SampleEndpoint_changeSalary_ResponseStruct res = port.changeSalary(req); 58 assertEquals("Hello John Smith! Your salary is: 5000", res.result); 59 } 60 finally 61 { 62 undeploy("ws4ee-encstyle-doc-client.jar"); 63 undeploy("ws4ee-encstyle-doc.war"); 64 } 65 } 66 67 68 public void testRpcStyle() throws Exception 69 { 70 deploy("ws4ee-encstyle-rpc.war"); 71 deploy("ws4ee-encstyle-rpc-client.jar"); 72 try 73 { 74 InitialContext iniCtx = getClientContext(); 75 Service service = (Service )iniCtx.lookup("java:comp/env/service/SampleService"); 76 SampleEndpoint port = (SampleEndpoint)service.getPort(SampleEndpoint.class); 77 78 UserType user = new UserType(); 79 user.setFirstName("John"); 80 user.setLastName("Smith"); 81 String retStr = port.changeSalary(user, new Integer (5000)); 82 assertEquals("Hello John Smith! Your salary is: 5000", retStr); 83 } 84 finally 85 { 86 undeploy("ws4ee-encstyle-rpc-client.jar"); 87 undeploy("ws4ee-encstyle-rpc.war"); 88 } 89 } 90 } 91 | Popular Tags |