Package org.apache.sandesha

Examples of org.apache.sandesha.SandeshaContext


        System.out.println("          Synchronous Ping Test Started");

        Service service = new Service();
        Call call = (Call) service.createCall();

        SandeshaContext ctx = new SandeshaContext(Constants.SYNCHRONOUS);
        ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

        call.setOperationName(new QName("http://tempuri.org/", "Ping"));
        call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);


        call.invoke(new Object[]{"Ping One"});
        ctx.setLastMessage(call);
        call.invoke(new Object[]{"Ping Two"});

        RMReport report = ctx.endSequence();

        assertEquals(report.isAllAcked(), true);
        assertEquals(report.getNumberOfReturnMessages(), 0);
        testCount--;
        System.out.println("          Synchronous Ping Test Finished");
View Full Code Here


        System.out.println("          Asynchronous Ping Test Started");

        Service service = new Service();
        Call call = (Call) service.createCall();

        SandeshaContext ctx = new SandeshaContext();

        ctx.setAcksToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.initCall(call, targetURL, "urn:wsrm:ping", Constants.ClientProperties.IN_ONLY);

        call.setOperationName(new QName("http://tempuri.org", "Ping"));
        call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);

        call.invoke(new Object[]{"Ping One"});
        ctx.setLastMessage(call);
        call.invoke(new Object[]{"Ping Two"});

        RMReport report = ctx.endSequence();

        assertEquals(report.isAllAcked(), true);
        assertEquals(report.getNumberOfReturnMessages(), 0);
        testCount--;
        System.out.println("          Asynchronous Ping Test Finished");
View Full Code Here

        String str = uuidGen.nextUUID();

        Service service = new Service();
        Call call = (Call) service.createCall();

        SandeshaContext ctx = new SandeshaContext();

        ctx.setAcksToURL(Constants.WSA.NS_ADDRESSING_ANONYMOUS);
        ctx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.setSendOffer(true);

        ctx.initCall(call, targetURL, "urn:wsrm:echoString", Constants.ClientProperties.IN_OUT);

        call.setOperationName(new QName("http://tempuri.org/", "echoString"));

        call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

        String ret = (String) call.invoke(new Object[]{" Echo 1 ", str});
        System.out.println("          The Response for First Messsage is  :" + ret);

        ctx.setLastMessage(call);
        ret = (String) call.invoke(new Object[]{" Echo 2 ", str});
        System.out.println("          The Response for Second Messsage is  :" + ret);

        RMReport report = ctx.endSequence();

        assertEquals(report.isAllAcked(), true);
        assertEquals(report.getNumberOfReturnMessages(), 2);
        testCount--;
        System.out.println("          Echo(Sync Ack) Test Finished");
View Full Code Here

        String str = uuidGen.nextUUID();

        Service service = new Service();
        Call call = (Call) service.createCall();

        SandeshaContext ctx = new SandeshaContext();

        ctx.setAcksToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.setSendOffer(true);

        ctx.initCall(call, targetURL, "urn:wsrm:echoString", Constants.ClientProperties.IN_OUT);

        call.setOperationName(new QName("http://tempuri.org/", "echoString"));

        call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

        String ret = (String) call.invoke(new Object[]{" Echo 1 ", str});
        System.out.println("          The Response for First Messsage is  :" + ret);

        ctx.setLastMessage(call);
        ret = (String) call.invoke(new Object[]{" Echo 2 ", str});
        System.out.println("          The Response for Second Messsage is  :" + ret);

        RMReport report = ctx.endSequence();

        assertEquals(report.isAllAcked(), true);
        assertEquals(report.getNumberOfReturnMessages(), 2);
        testCount--;
        System.out.println("          Echo(Async Ack) Test Finished");
View Full Code Here

        String str = uuidGen.nextUUID();

        Service service = new Service();
        Call echoCall = (Call) service.createCall();

        SandeshaContext ctx = new SandeshaContext();
        //------------------------ECHO--------------------------------------------

        ctx.setAcksToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        ctx.setSendOffer(true);
        ctx.initCall(echoCall, targetURL, "urn:wsrm:echoString", Constants.ClientProperties.IN_OUT);

        echoCall.setOperationName(new QName("http://tempuri.org/", "echoString"));

        echoCall.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
        echoCall.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN);
        echoCall.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
        //----------------------ECHO------------------------------------------------

        //------------------------PING--------------------------------------------
        Service pingService = new Service();
        Call pingCall = (Call) pingService.createCall();
        SandeshaContext pingCtx = new SandeshaContext();
        pingCtx.setAcksToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");
        pingCtx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService");

        pingCtx.initCall(pingCall, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

        pingCall.setOperationName(new QName("http://tempuri.org/", "ping"));
        pingCall.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN);
        //----------------------PING------------------------------------------------


        String ret = (String) echoCall.invoke(new Object[]{" Echo 1 ", str});
        System.out.println("          The Response for First Messsage is  :" + ret);
        pingCall.invoke(new Object[]{ret});

        ctx.setLastMessage(echoCall);
        ret = (String) echoCall.invoke(new Object[]{" Echo 2 ", str});
        System.out.println("          The Response for Second Messsage is  :" + ret);
        pingCall.invoke(new Object[]{ret});

        pingCtx.setLastMessage(pingCall);
        pingCall.invoke(new Object[]{ret});

        RMReport echoReport = ctx.endSequence();
        RMReport pingReport = pingCtx.endSequence();

        assertEquals(echoReport.isAllAcked(), true);
        assertEquals(echoReport.getNumberOfReturnMessages(), 2);

        assertEquals(pingReport.isAllAcked(), true);
View Full Code Here

        try {

            Service service = new Service();
            Call call = (Call) service.createCall();

            SandeshaContext ctx = new SandeshaContext(Constants.SYNCHRONOUS);

            ctx.setToURL("http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
            ctx.setAcksToURL(Constants.WSA.NS_ADDRESSING_ANONYMOUS);
            ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

            call.setOperationName(new QName("http://tempuri.org/", "Ping"));

            call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);

            call.invoke(new Object[]{"Ping Message Number One"});
            call.invoke(new Object[]{"Ping Message Number Two"});
            ctx.setLastMessage(call);
            call.invoke(new Object[]{"Ping Message Number Three"});

            ctx.endSequence();

        } catch (Exception e) {
            //System.err.println(e.toString());
            e.printStackTrace();
        }
View Full Code Here

        try {

            Service service = new Service();
            Call call = (Call) service.createCall();

            SandeshaContext ctx = new SandeshaContext(Constants.SYNCHRONOUS);

            ctx.setToURL("http://soap.systinet.net:6064/Service");
            ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

            call.setTargetEndpointAddress(targetURL);
            call.setOperationName(new QName("http://tempuri.org/", "Ping"));


            call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);

            call.invoke(new Object[]{"Ping Message Number One"});
            call.invoke(new Object[]{"Ping Message Number Two"});
            ctx.setLastMessage(call);
            call.invoke(new Object[]{"Ping Message Number Three"});

            ctx.endSequence();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        try {

            Service service = new Service();
            Call call = (Call) service.createCall();

            SandeshaContext ctx = new SandeshaContext(Constants.SYNCHRONOUS);

            ctx.setToURL("http://131.107.153.195/SecureReliableMessaging/ReliableOneWay.svc");
            //We really do not want to send wsa:ReplyTo header for a synchronous operation.
            //But Microsoft endpoint expects it for all the messages. So let's set that manually.
            ctx.setReplyToURL(Constants.WSA.NS_ADDRESSING_ANONYMOUS);

            ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

            call.setOperationName("Ping");

            call.invoke(new Message(getSOAPEnvelope(1)));
            call.invoke(new Message(getSOAPEnvelope(2)));
            ctx.setLastMessage(call);
            call.invoke(new Message(getSOAPEnvelope(3)));

            ctx.endSequence();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        try {

            Service service = new Service();
            Call call = (Call) service.createCall();

            SandeshaContext ctx = new SandeshaContext();

            ctx.setToURL("http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
            ctx.setFaultToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
            ctx.setAcksToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
            ctx.setFromURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");

            ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

            call.setOperationName(new QName("http://tempuri.org/", "Ping"));

            call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);

            call.invoke(new Object[]{"Ping Message Number One"});
            call.invoke(new Object[]{"Ping Message Number Two"});
            ctx.setLastMessage(call);
            call.invoke(new Object[]{"Ping Message Number Three"});

            ctx.endSequence();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        try {

            Service service = new Service();
            Call call = (Call) service.createCall();

            SandeshaContext ctx = new SandeshaContext(true);
            ctx.setSourceURL(bean.getSourceURL());
            configureContext(ctx, bean);
            ctx.initCall(call, target, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);

            for (int i = 1; i <= msgs; i++) {
                if (i == msgs) {
                    ctx.setLastMessage(call);
                }
                call.invoke(new Message(getPingSOAPEnvelope(i)));
            }

            //InteropStub.stopClient();
            ctx.endSequence();

        } catch (Exception e) {
            if (callback != null)
                callback.onError(e);
            log.error(e);
View Full Code Here

TOP

Related Classes of org.apache.sandesha.SandeshaContext

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.