public class

XmlRpcHelper

extends Object
java.lang.Object
   ↳ com.android.tradefed.util.net.XmlRpcHelper

Class Overview

A mechanism to simplify writing XmlRpc. Deals with XML and XmlRpc boilerplate.

Call semantics:

  1. Call an "Open" method
  2. Construct the value on the serializer. This may involve calling other helper methods, perhaps recursively.
  3. Call a respective "Close" method

It is the caller's responsibility to ensure that "Open" and "Close" calls are matched properly. The helper methods do not check this.

Summary

Constants
String FALSE_VAL
String TRUE_VAL
Public Constructors
XmlRpcHelper()
Public Methods
static List<String> parseResponseTuple(InputStream input)
Parses an XmlRpc response document.
static void writeCloseMethodArg(KXmlSerializer serializer, String ns, String valueType)
Write the end of a method argument to the serializer.
static void writeCloseMethodCall(KXmlSerializer serializer, String ns)
Write the end of a method call to the serializer.
static void writeCloseStructMember(KXmlSerializer serializer, String ns, String valueType)
Write the end of a struct member to the serializer.
static void writeFullMethodArg(KXmlSerializer serializer, String ns, String valueType, String value)
Write a full method argument to the serializer.
static void writeOpenMethodArg(KXmlSerializer serializer, String ns, String valueType)
Write the opening of a method argument to the serializer.
static void writeOpenMethodCall(KXmlSerializer serializer, String ns, String name)
Write the opening of a method call to the serializer.
static void writeOpenStructMember(KXmlSerializer serializer, String ns, String name, String valueType)
Write the opening of a struct member to the serializer.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String FALSE_VAL

Constant Value: "0"

public static final String TRUE_VAL

Constant Value: "1"

Public Constructors

public XmlRpcHelper ()

Public Methods

public static List<String> parseResponseTuple (InputStream input)

Parses an XmlRpc response document. Returns a flat list of pairs; the even elements are datatype names, and the odds are string representations of the values, as passed over the wire.

Parameters
input An InputStream from which the parser can read the XmlRpc response document.
Returns
  • A flat List containing datatype/value pairs, or null if there was a parse error.

public static void writeCloseMethodArg (KXmlSerializer serializer, String ns, String valueType)

Write the end of a method argument to the serializer.

Parameters
serializer the KXmlSerializer
ns the namespace
valueType the XmlRpc type of the method argument
Throws
IOException

public static void writeCloseMethodCall (KXmlSerializer serializer, String ns)

Write the end of a method call to the serializer.

Parameters
serializer the KXmlSerializer
ns the namespace
Throws
IOException

public static void writeCloseStructMember (KXmlSerializer serializer, String ns, String valueType)

Write the end of a struct member to the serializer.

Parameters
serializer the KXmlSerializer
ns the namespace
valueType the XmlRpc type of the member
Throws
IOException

public static void writeFullMethodArg (KXmlSerializer serializer, String ns, String valueType, String value)

Write a full method argument to the serializer. This function is not paired with any other function.

Parameters
serializer the KXmlSerializer
ns the namespace
valueType the XmlRpc type of the method argument
value the value of the method argument
Throws
IOException

public static void writeOpenMethodArg (KXmlSerializer serializer, String ns, String valueType)

Write the opening of a method argument to the serializer. After calling this function, the caller should send the argument value directly to the serializer.

Parameters
serializer the KXmlSerializer
ns the namespace
valueType the XmlRpc type of the method argument
Throws
IOException

public static void writeOpenMethodCall (KXmlSerializer serializer, String ns, String name)

Write the opening of a method call to the serializer.

Parameters
serializer the KXmlSerializer
ns the namespace
name the name of the XmlRpc method to invoke
Throws
IOException

public static void writeOpenStructMember (KXmlSerializer serializer, String ns, String name, String valueType)

Write the opening of a struct member to the serializer. After calling this function, the caller should send the member value directly to the serializer.

Parameters
serializer the KXmlSerializer
ns the namespace
name the name of the XmlRpc member
valueType the XmlRpc type of the member
Throws
IOException