Examples of XmlRpcClient


Examples of org.apache.xmlrpc.client.XmlRpcClient

        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
        config.setServerURL(url);
        config.setBasicUserName(args[1]);
        config.setBasicPassword(args[2]);

        XmlRpcClient client = new XmlRpcClient();
        client.setConfig(config);

        try {
            execute(client, "getServerVersion");
        } catch (Exception e) {
            throw new RuntimeException("Unable to contact server " + baseUrl
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

    protected XmlRpcClient openConnectionImpl() throws ErrorDataValueException {
        // assume the most recent version of the server, and try to connect.
        this.urlSuffix = new DynamicAttributeValue(URL_SUFFIX_4);
        this.namespace = NAMESPACE4;
        this.testMethodName = NAMESPACE4 + TEST_METHOD_NAME;
        XmlRpcClient result = super.openConnectionImpl(true);

        // if that fails, try connecting to the older server API.
        if (result == null) {
            this.urlSuffix = new DynamicAttributeValue(URL_SUFFIX_3);
            this.namespace = NAMESPACE3;
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

    {
        config.setTimeZone(TimeZone.getTimeZone("UTC"));
        config.setServerURL(url);
        config.setReplyTimeout(_wait * 1000);
        config.setConnectionTimeout(5000);
        XmlRpcClient client = new XmlRpcClient();
        client.setConfig(config);
        return client;
    }
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

    public void initialize() throws QTasteException {
        TestBedConfiguration tb = TestBedConfiguration.getInstance();
        this.host = tb.getString("singleton_components.Windows.host");
        this.port = tb.getInt("singleton_components.Windows.port");
        this.client = new XmlRpcClient();
        try {
            XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
           
            config.setServerURL(new URL("http://" + host + ":" + port));
            client.setConfig(config);
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

            throw new XmlRpcException(pCode, "Message: " + pCode);
        }
    }

    private void testXMLRPC113(ClientProvider pProvider) throws Exception {
        XmlRpcClient client = pProvider.getClient();
        client.setConfig(getConfig(pProvider));
        XMLRPC113Handler handler = (XMLRPC113Handler) new ClientFactory(client).newInstance(XMLRPC113Handler.class);
        for (int i = 0;  i < 5;  i++) {
            try {
                client.execute(XMLRPC113Handler.class.getName() + ".throwCode", new Object[]{new Integer(i)});
                fail("Excpected exception");
            } catch (XmlRpcException e) {
                assertEquals(i, e.code);
            }
            try {
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

        }
    }

    private void testXMLRPC115(ClientProvider pProvider) throws Exception {
        if (pProvider instanceof SunHttpTransportProvider) {
            XmlRpcClient client = pProvider.getClient();
            client.setConfig(getConfig(pProvider));
            URL url = ((XmlRpcHttpClientConfig) client.getConfig()).getServerURL();
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("content-type", "text/xml");
            OutputStream ostream = conn.getOutputStream();
            Writer w = new OutputStreamWriter(ostream, "UTF-8");
            w.write("<methodCall><methodName>" + XMLRPC115Handler.class.getName() + ".ping"
                    + "</methodName></methodCall>");
            w.close();
            InputStream istream = conn.getInputStream();
            XmlRpcResponseParser parser = new XmlRpcResponseParser((XmlRpcStreamRequestConfig) client.getClientConfig(), client.getTypeFactory());
            XMLReader xr = SAXParsers.newXMLReader();
            xr.setContentHandler(parser);
            xr.parse(new InputSource(istream));
            istream.close();
            assertTrue(parser.getResult() instanceof Object[]);
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

            return sb.toString();
        }
    }

    private void testXMLRPC119(ClientProvider pProvider) throws Exception {
        XmlRpcClient client = pProvider.getClient();
        client.setConfig(getConfig(pProvider));
        for (int i = 0;  i < 100;  i+= 10) {
            String s = (String) client.execute(XMLRPC119Handler.class.getName() + ".getString", new Object[]{new Integer(i)});
            assertEquals(i*1024, s.length());
        }
    }
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

            iterations = pIterations;
            port = pPort;
        }
        public void run() {
            try {
                XmlRpcClient client = new XmlRpcClient();
                XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
                config.setServerURL(new URL("http://127.0.0.1:" + port + "/"));
                client.setConfig(config);
                for (int i = 0;  i < iterations;  i++) {
                    assertEquals(EIGHT, client.execute("Adder.add", new Object[]{THREE, FIVE}));
                }
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

            testAdder(providers[i]);
        }
    }

    private void testAdder(ClientProvider pProvider) throws Exception {
        XmlRpcClient client = pProvider.getClient();
        XmlRpcClientConfig config = getConfig(pProvider);
        client.setConfig(config);
        Object o = client.execute("Adder.add", new Object[]{new Integer(3), new Integer(5)});
        assertEquals(new Integer(8), o);
    }
View Full Code Here

Examples of org.apache.xmlrpc.client.XmlRpcClient

            testListMethods(providers[i]);
        }
    }

    private void testListMethods(ClientProvider pProvider) throws Exception {
        XmlRpcClient client = pProvider.getClient();
        XmlRpcClientConfig config = getConfig(pProvider);
        client.setConfig(config);
        Object o = client.execute("system.listMethods", new Object[0]);
        Object[] methodList = (Object[]) o;
        Arrays.sort(methodList, Collator.getInstance(Locale.US));
        assertEquals(4, methodList.length);
        assertEquals("Adder.add", methodList[0]);
        assertEquals("system.listMethods", methodList[1]);
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.