Package org.apache.hello_world_rpclit

Examples of org.apache.hello_world_rpclit.GreeterRPCLit


        assertNotNull(service);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
            updateAddressPort(greeter, PORT);
            for (int idx = 0; idx < 1; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                String exResponse = response1 + idx;
                assertEquals(exResponse, greeting);

                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);
                try {
                    greeter.greetMe("return null");
                    fail("should catch WebServiceException");
                } catch (WebServiceException e) {
                    //do nothing
                } catch (Exception e) {
                    fail("should catch WebServiceException");
                    throw e;
                }
               
                try {
                    greeter.greetMe(null);
                    fail("should catch WebServiceException");
                } catch (WebServiceException e) {
                    //do nothing
                } catch (Exception e) {
                    fail("should catch WebServiceException");
View Full Code Here


    @Test
    public void testComplexType() throws Exception {
        SOAPServiceRPCLit service = new SOAPServiceRPCLit();
        assertNotNull(service);

        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
        updateAddressPort(greeter, PORT);

        MyComplexStruct in = new MyComplexStruct();
        in.setElem1("elem1");
        in.setElem2("elem2");
        in.setElem3(45);

        try {           
            ((BindingProvider)greeter).getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
            MyComplexStruct out = greeter.sendReceiveData(in);
            assertNotNull("no response received from service", out);
            assertEquals(in.getElem1(), out.getElem1());
            assertEquals(in.getElem2(), out.getElem2());
            assertEquals(in.getElem3(), out.getElem3());
           
           
           
        } catch (UndeclaredThrowableException ex) {
            throw (Exception) ex.getCause();
        }
       
        try {
            in.setElem2("invalid");
            greeter.sendReceiveData(in);
        } catch (SOAPFaultException f) {
            assertTrue(f.getCause() instanceof UnmarshalException);
        }
    }
View Full Code Here

        assertNotNull(service);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            for (int idx = 0; idx < 1; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                String exResponse = response1 + idx;
                assertEquals(exResponse, greeting);

                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);
            }
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
View Full Code Here

    @Test
    public void testComplexType() throws Exception {
        SOAPServiceRPCLit service = new SOAPServiceRPCLit();
        assertNotNull(service);

        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);

        MyComplexStruct in = new MyComplexStruct();
        in.setElem1("elem1");
        in.setElem2("elem2");
        in.setElem3(45);

        try {           
            MyComplexStruct out = greeter.sendReceiveData(in);
            assertNotNull("no response received from service", out);
            assertEquals(in.getElem1(), out.getElem1());
            assertEquals(in.getElem2(), out.getElem2());
            assertEquals(in.getElem3(), out.getElem3());
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

                                 int count,
                                 boolean doFault) throws Exception {
        String response1 = new String("TestGreetMeResponse");
        String response2 = new String("TestSayHiResponse");
        try {
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            for (int idx = 0; idx < count; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                assertEquals(response1, greeting);

                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);
               
                if (doFault) {
                    try {
                        greeter.greetMe("throwFault");
                    } catch (SOAPFaultException ex) {
                        assertNotNull(ex.getFault().getDetail());
                        assertTrue(ex.getFault().getDetail().getDetailEntries().hasNext());
                    }
                }
View Full Code Here

        assertNotNull(service);

       
        String response1 = new String("TestGreetMeResponseServerLogicalHandlerServerSOAPHandler");
        try {
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            String greeting = greeter.greetMe("Milestone-0");
            assertNotNull("no response received from service", greeting);
            assertEquals(response1, greeting);
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
        }
View Full Code Here

        assertNotNull(service);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            for (int idx = 0; idx < 1; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                String exResponse = response1 + idx;
                assertEquals(exResponse, greeting);

                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);
            }
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
View Full Code Here

   
    public void testComplexType() throws Exception {
        SOAPServiceRPCLit service = new SOAPServiceRPCLit();
        assertNotNull(service);

        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);

        MyComplexStruct in = new MyComplexStruct();
        in.setElem1("elem1");
        in.setElem2("elem2");
        in.setElem3(45);

        try {           
            MyComplexStruct out = greeter.sendReceiveData(in);
            assertNotNull("no response received from service", out);
            assertEquals(in.getElem1(), out.getElem1());
            assertEquals(in.getElem2(), out.getElem2());
            assertEquals(in.getElem3(), out.getElem3());
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

    private void doGreeterRPCLit(SOAPServiceRPCLit service, QName portName, int count) throws Exception {
        String response1 = new String("TestGreetMeResponse");
        String response2 = new String("TestSayHiResponse");
        try {
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            for (int idx = 0; idx < count; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                assertEquals(response1, greeting);

                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);
            }
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
View Full Code Here

        } else {
            wsdlURL = new URL(args[0]);
        }
       
        SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdlURL, SERVICE_NAME);
        GreeterRPCLit greeter = (GreeterRPCLit)service.getPort(PORT_NAME, GreeterRPCLit.class);

        System.out.println("Invoking sayHi...");
        System.out.println("server responded with: " + greeter.sayHi());
        System.out.println();

        System.out.println("Invoking greetMe...");
        System.out.println("server responded with: " + greeter.greetMe(System.getProperty("user.name")));
        System.out.println();
       
        MyComplexStruct argument = new MyComplexStruct();
        MyComplexStruct retVal = null;

        String str1 = "this is element 1";
        String str2 = "this is element 2";
        int int1 = 42;

        argument.setElem1(str1);
        argument.setElem2(str2);
        argument.setElem3(int1);
        System.out.println("Invoking sendReceiveData...");

        retVal = greeter.sendReceiveData(argument);

        System.out.println("Response from sendReceiveData operation :");
        System.out.println("Element-1 : " + retVal.getElem1());
        System.out.println("Element-2 : " + retVal.getElem2());
        System.out.println("Element-3 : " + retVal.getElem3());
View Full Code Here

TOP

Related Classes of org.apache.hello_world_rpclit.GreeterRPCLit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.