Examples of RPCServiceClient


Examples of org.apache.axis2.rpc.client.RPCServiceClient

     * @return a ServiceClient, pre-initialized to talk using our local sender
     * @throws AxisFault if there's a problem
     */
    protected RPCServiceClient getRPCClient() throws AxisFault {
        Options opts = getOptions();
        RPCServiceClient client = new RPCServiceClient(clientCtx, null);
        client.setOptions(opts);
        return client;
    }
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

       this.setNamespaceURI(namespaceURI);
       this.init();
    }
    public void init() {
       try {
           serviceClient = new RPCServiceClient();
           Options options = serviceClient.getOptions();
           EndpointReference targetEPR = new EndpointReference(wsAddress);
           options.setTo(targetEPR);
       } catch (AxisFault e) {
           e.printStackTrace();
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

public class WeatherRPCClient {

    public static void main(String[] args1) throws AxisFault {

        RPCServiceClient serviceClient = new RPCServiceClient();

        Options options = serviceClient.getOptions();

        EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/WeatherService");

        options.setTo(targetEPR);

        // Setting the weather
        QName opSetWeather = new QName("http://service.pojo.sample/xsd", "setWeather");

        Weather w = new Weather();

        w.setTemperature((float)39.3);
        w.setForecast("Cloudy with showers");
        w.setRain(true);
        w.setHowMuchRain((float)4.5);

        Object[] opSetWeatherArgs = new Object[] { w };

        serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);


        // Getting the weather
        QName opGetWeather = new QName("http://service.pojo.sample/xsd", "getWeather");

        Object[] opGetWeatherArgs = new Object[] { };
        Class[] returnTypes = new Class[] { Weather.class };
       
       
        Object[] response = serviceClient.invokeBlocking(opGetWeather,
                opGetWeatherArgs, returnTypes);
       
        Weather result = (Weather) response[0];
       
        if (result == null) {
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

public class WeatherSpringRPCClient {

    public static void main(String[] args1) throws AxisFault {

        RPCServiceClient serviceClient = new RPCServiceClient();

        Options options = serviceClient.getOptions();

        EndpointReference targetEPR
                = new EndpointReference(
                "http://localhost:8080/axis2/services/WeatherSpringService");
       
        options.setTo(targetEPR);

        // Get the weather (no setting, the Spring Framework has already initialized it for us)
        QName opGetWeather = new QName("http://service.spring.sample/xsd", "getWeather");

        Object[] opGetWeatherArgs = new Object[] { };
        Class[] returnTypes = new Class[] { Weather.class };
       
       
        Object[] response = serviceClient.invokeBlocking(opGetWeather,
                opGetWeatherArgs, returnTypes);
       
        Weather result = (Weather) response[0];
       
        // display results
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

        assertEquals(((Company)value[0]).getName(), "MyCompany");
    }


    public void testEchoOM() throws AxisFault {
      RPCServiceClient sender = getRPCClient("EchoXMLService", "echoOM");

        ArrayList args = new ArrayList();
        args.add("1");
        OMElement response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoOM", "req"), args.toArray());
        assertEquals(Byte.parseByte(response.getFirstElement().getFirstElement().getText()), 1);
    }
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

        assertEquals(Byte.parseByte(response.getFirstElement().getFirstElement().getText()), 1);
    }

    public void testCalender() throws AxisFault {
        zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
        RPCServiceClient sender = getRPCClient("EchoXMLService", "echoCalander");

        ArrayList args = new ArrayList();
        Date date = Calendar.getInstance().getTime();
        args.add(zulu.format(date));
        OMElement response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoCalander", "req"), args.toArray());
        assertEquals(response.getFirstElement().getText(), zulu.format(date));
    }
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

    }


    ////////////////////////////////////////////////// Invoking by Passing Return types //////////
    public void testechoBean2() throws AxisFault {
      RPCServiceClient sender = getRPCClient("EchoXMLService", "echoBean");

        MyBean bean = new MyBean();
        bean.setAge(100);
        bean.setName("Deepal");
        bean.setValue(false);
        AddressBean ab = new AddressBean();
        ab.setNumber(1010);
        ab.setTown("Colombo3");
        bean.setAddress(ab);

        ArrayList args = new ArrayList();
        args.add(bean);

        ArrayList ret = new ArrayList();
        ret.add(MyBean.class);

        Object [] response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoBean", "req"), args.toArray(),
                                                   (Class[])ret.toArray(new Class[ret.size()]));
        MyBean resBean = (MyBean)response[0];
        assertNotNull(resBean);
        assertEquals(resBean.getAge(), 100);
    }
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

        assertNotNull(resBean);
        assertEquals(resBean.getAge(), 100);
    }

    public void testechoInt2() throws AxisFault {
      RPCServiceClient sender = getRPCClient("EchoXMLService", "echoInt");

        ArrayList args = new ArrayList();
        args.add("100");

        ArrayList ret = new ArrayList();
        ret.add(Integer.class);

        Object [] response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoInt", "req"), args.toArray(),
                                                   (Class[])ret.toArray(new Class[ret.size()]));
        assertEquals(((Integer)response[0]).intValue(), 100);
    }
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

public class WeatherRPCClient {

    public static void main(String[] args1) throws AxisFault {

        RPCServiceClient serviceClient = new RPCServiceClient();

        Options options = serviceClient.getOptions();

        EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/WeatherService");

        options.setTo(targetEPR);

        // Setting the weather
        QName opSetWeather = new QName("http://service.pojo.sample", "setWeather");

        Weather w = new Weather();

        w.setTemperature((float)39.3);
        w.setForecast("Cloudy with showers");
        w.setRain(true);
        w.setHowMuchRain((float)4.5);

        Object[] opSetWeatherArgs = new Object[] { w };

        serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);


        // Getting the weather
        QName opGetWeather = new QName("http://service.pojo.sample", "getWeather");

        Object[] opGetWeatherArgs = new Object[] { };
        Class[] returnTypes = new Class[] { Weather.class };
       
       
        Object[] response = serviceClient.invokeBlocking(opGetWeather,
                opGetWeatherArgs, returnTypes);
       
        Weather result = (Weather) response[0];
       
        if (result == null) {
View Full Code Here

Examples of org.apache.axis2.rpc.client.RPCServiceClient

//        assertEquals(((Integer) response[0]).intValue(), 10);
//        assertEquals(response[1], "foo");
//    }

    public void testStringArray() throws AxisFault {
      RPCServiceClient sender = getRPCClient("EchoXMLService", "handleStringArray");

        ArrayList args = new ArrayList();
        String [] values = new String[] { "abc", "cde", "efg" };
        args.add(values);
        ArrayList ret = new ArrayList();
        ret.add(Boolean.class);
        Object [] objs = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "handleStringArray", "req"), args.toArray(),
                                               (Class[])ret.toArray(new Class[ret.size()]));
        assertNotNull(objs);
        assertEquals(Boolean.TRUE, Boolean.valueOf(objs[0].toString()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.