Package org.apache.xmlrpc

Examples of org.apache.xmlrpc.XmlRpcRequest


    final Map map = new HashMap();
    map.put("2", new Integer(3));
    map.put("3", new Integer(5));
    final Object[] params = new Object[]{map};
    XmlRpcStreamRequestConfig config = getConfig();
    XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "mapParam", params);
    String got = writeRequest(config, request);
    String expect =
      "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
      + "<methodCall><methodName>mapParam</methodName>"
      + "<params><param><value><struct>"
View Full Code Here


        cal1.set(Calendar.MILLISECOND, 311);
        Calendar cal2 = Calendar.getInstance(TimeZone.getDefault());
        cal2.set(1933, 5, 12, 11, 7, 21);
        cal2.set(Calendar.MILLISECOND, 311);
        XmlRpcStreamRequestConfig config = getExConfig();
        XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "dateParam", new Object[]{cal1, cal2.getTime()});
        String got = writeRequest(config, request);
        String expect =
            "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
            + "<methodCall xmlns:ex=\"http://ws.apache.org/xmlrpc/namespaces/extensions\">"
            + "<methodName>dateParam</methodName><params>"
View Full Code Here

      throw new XmlRpcException("Failed to parse XML-RPC request: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new XmlRpcException("Failed to read XML-RPC request: " + e.getMessage(), e);
    }
    final List params = parser.getParams();
    return new XmlRpcRequest(){
      public XmlRpcRequestConfig getConfig() { return pConfig; }
      public String getMethodName() { return parser.getMethodName(); }
      public int getParameterCount() { return params == null ? 0 : params.size(); }
      public Object getParameter(int pIndex) { return params.get(pIndex); }
    };
View Full Code Here

      Object result;
      Throwable error;
      InputStream istream = null;
      try {
        istream = getInputStream(pConfig, pConnection);
        XmlRpcRequest request = getRequest(pConfig, istream);
        result = execute(request);
        istream.close();
        istream = null;
        error = null;
        log.debug("execute: Request performed successfully");
View Full Code Here

  /** Test serialization of a byte parameter.
   * @throws Exception The test failed.
   */
  public void testByteParam() throws Exception {
    XmlRpcStreamRequestConfig config = getExConfig();
    XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "byteParam", new Object[]{new Byte((byte)3)});
    String got = writeRequest(config, request);
    String expect =
      "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
      + "<methodCall xmlns:ex=\"http://ws.apache.org/xmlrpc/namespaces/extensions\">"
      + "<methodName>byteParam</methodName><params><param><value><ex:i1>3</ex:i1></value></param></params></methodCall>";
View Full Code Here

  /** Test serialization of an integer parameter.
   * @throws Exception The test failed.
   */
  public void testIntParam() throws Exception {
    XmlRpcStreamRequestConfig config = getConfig();
    XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "intParam", new Object[]{new Integer(3)});
    String got = writeRequest(config, request);
    String expect =
      "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
      + "<methodCall>"
      + "<methodName>intParam</methodName><params><param><value><i4>3</i4></value></param></params></methodCall>";
View Full Code Here

   * @throws Exception The test failed.
   */
  public void testByteArrayParam() throws Exception {
    byte[] bytes = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    XmlRpcStreamRequestConfig config = getConfig();
    XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "byteArrayParam", new Object[]{bytes});
    String got = writeRequest(config, request);
    String expect =
      "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
      + "<methodCall>"
      + "<methodName>byteArrayParam</methodName><params><param><value><base64>AAECAwQFBgcICQ==</base64></value></param></params></methodCall>";
View Full Code Here

    final Map map = new HashMap();
    map.put("2", new Integer(3));
    map.put("3", new Integer(5));
    final Object[] params = new Object[]{map};
    XmlRpcStreamRequestConfig config = getConfig();
    XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "mapParam", params);
    String got = writeRequest(config, request);
    String expect =
      "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
      + "<methodCall><methodName>mapParam</methodName>"
      + "<params><param><value><struct>"
View Full Code Here

        cal1.set(Calendar.MILLISECOND, 311);
        Calendar cal2 = Calendar.getInstance(TimeZone.getDefault());
        cal2.set(1933, 5, 12, 11, 7, 21);
        cal2.set(Calendar.MILLISECOND, 311);
        XmlRpcStreamRequestConfig config = getExConfig();
        XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "dateParam", new Object[]{cal1, cal2.getTime()});
        String got = writeRequest(config, request);
        String expect =
            "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
            + "<methodCall xmlns:ex=\"http://ws.apache.org/xmlrpc/namespaces/extensions\">"
            + "<methodName>dateParam</methodName><params>"
View Full Code Here

     */
    public void testIntegerKeyMap() throws Exception {
        Map map = new HashMap();
        map.put(new Integer(1), "one");
        XmlRpcStreamRequestConfig config = getExConfig();
        XmlRpcRequest request = new XmlRpcClientRequestImpl(config, "integerKeyMap", new Object[]{map});
        String got = writeRequest(config, request);
        String expect =
            "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"
            + "<methodCall xmlns:ex=\"http://ws.apache.org/xmlrpc/namespaces/extensions\">"
            + "<methodName>integerKeyMap</methodName><params>"
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.XmlRpcRequest

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.