Skip navigation
2184 Views 2 Replies Latest reply: Jun 21, 2012 4:17 AM by Gioacchino Del Prete RSS
Gioacchino Del Prete Rank: White Belt 9 posts since
Jun 19, 2012
Currently Being Moderated

Jun 20, 2012 10:43 AM

Java web service

Hi,

send this request from the browser:

http://192.168.0.41:8080/zport/dmd/ZenEventManager/getSeverities

 

and the resulst is:

 

(('Critical', 5), ('Error', 4), ('Warning', 3), ('Info', 2), ('Debug', 1), ('Clear', 0))

 

Now I try to do the same thing to a little program Java.

 

But I can not cast the response of the web service. How can I do?

 

The source is:

 

public class Main {

 

 

    /**

     * @param args

     */

    public static void main(String[] args) {

        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

        String url= "http://192.168.0.41:8080/zport/dmd/ZenEventManager";

        String urlSever="http://192.168.0.41:8080/zport/dmd/ZenEventManager/getSeverities";

        try {

            config.setServerURL(new URL(url));

        } catch (MalformedURLException e1) {

            e1.printStackTrace();

        }

        config.setBasicUserName("admin");

        config.setBasicPassword("root");

 

 

        XmlRpcClient client = new XmlRpcClient();

        client.setConfig(config);

 

 

        try {

 

            System.out.println(client.execute("getSeverities", new Object[]{}));

        } catch (XmlRpcException e) {

            e.printStackTrace();

        }

    }

 

 

}

 

Thanks for the answers.

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points