Package org.apache.xmlrpc

Examples of org.apache.xmlrpc.XmlRpcRequest


    public static XmlRpcRequest toXmlRpcRequest(final Object[] parameters, Exchange exchange) {
        // get the message operation name
        String operationName = exchange.getIn().getHeader(XmlRpcConstants.METHOD_NAME, String.class);
       
        // create the request object here
        XmlRpcRequest request = new XmlRpcRequestImpl(operationName, parameters);
       
        return request;
    }
View Full Code Here


    public static XmlRpcRequest toXmlRpcRequest(final List<?> parameters, Exchange exchange) {
        // get the message operation name
        String operationName = exchange.getIn().getHeader(XmlRpcConstants.METHOD_NAME, String.class);
       
        // create the request object here
        XmlRpcRequest request = new XmlRpcRequestImpl(operationName, parameters);
       
        return request;
    }
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

      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.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

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.