Package org.springmodules.remoting.xmlrpc.support

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcArray


   */
  public final void testWriteResponseWithArrayParameters() {
    XmlRpcString firstValue = new XmlRpcString("Darth Vader");
    XmlRpcString secondValue = new XmlRpcString("Darth Sidius");

    XmlRpcArray xmlRpcArray = new XmlRpcArray();
    xmlRpcArray.add(firstValue);
    xmlRpcArray.add(secondValue);

    XmlRpcElement[] parameters = { xmlRpcArray };
    XmlRpcResponse response = new XmlRpcResponse(parameters);

    StringBuffer builder = new StringBuffer(256);
View Full Code Here


   * Verifies that the method
   * <code>{@link XmlRpcRequestParser#parseRequest(InputStream)}</code> parses
   * correctly a XML-RPC request containing array parameters.
   */
  public final void testParseRequestWithArrayParameters() {
    XmlRpcArray xmlRpcArray = new XmlRpcArray();
    xmlRpcArray.add(new XmlRpcString("Luke"));
    xmlRpcArray.add(new XmlRpcString("Leia"));

    XmlRpcElement[] parameters = { xmlRpcArray };

    XmlRpcRequest expected = new XmlRpcRequest(this.serviceName,
        this.methodName, parameters);

    StringBuffer builder = new StringBuffer();
    builder.append("<?xml version=\"1.0\"?>");
    builder.append("<methodCall><methodName>");
    builder.append(this.serviceAndMethodNames);
    builder.append("</methodName><params><param><value><array><data>");

    XmlRpcElement[] elements = xmlRpcArray.getElements();
    int memberCount = elements.length;
    for (int i = 0; i < memberCount; i++) {
      XmlRpcString element = (XmlRpcString) elements[i];

      builder.append("<value>");
View Full Code Here

   *          the XML element to parse.
   * @return the created XML-RPC array.
   * @see #parseValueElement(Element)
   */
  protected final XmlRpcArray parseDataElement(Element dataElement) {
    XmlRpcArray array = new XmlRpcArray();

    NodeList children = dataElement.getChildNodes();
    int childCount = children.getLength();

    for (int i = 0; i < childCount; i++) {
      Node child = children.item(i);

      if (child instanceof Element) {
        String childName = child.getNodeName();

        if (XmlRpcElementNames.VALUE.equals(childName)) {
          Element valueElement = (Element) child;
          XmlRpcElement element = parseValueElement(valueElement);
          array.add(element);
        }
      }
    }
    return array;
  }
View Full Code Here

   * @return the new array of <code>java.util.List</code>s.
   * @see #parseValueElement(XMLStreamReader)
   */
  protected final XmlRpcArray parseDataElement(XMLStreamReader reader)
      throws XMLStreamException {
    XmlRpcArray array = new XmlRpcArray();

    while (reader.hasNext()) {
      int event = reader.next();
      String localName = null;

      switch (event) {
        case XMLStreamConstants.START_ELEMENT:
          localName = reader.getLocalName();

          if (XmlRpcElementNames.VALUE.equals(localName)) {
            XmlRpcElement element = parseValueElement(reader);
            array.add(element);
          }
          break;

        case XMLStreamConstants.END_ELEMENT:
          localName = reader.getLocalName();
View Full Code Here

TOP

Related Classes of org.springmodules.remoting.xmlrpc.support.XmlRpcArray

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.