XmlRpcHelper

public class XmlRpcHelper
extends Object

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


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

Fields

public static final String FALSE_VAL

public static final String TRUE_VAL

Public constructors

XmlRpcHelper()

Public methods

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

Fields

FALSE_VAL

public static final String FALSE_VAL

TRUE_VAL

public static final String TRUE_VAL

Public constructors

XmlRpcHelper

public XmlRpcHelper ()

Public methods

parseResponseTuple

public static  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 InputStream: An ERROR(/InputStream) from which the parser can read the XmlRpc response document.

Returns
A flat List<String> containing datatype/value pairs, or null if there was a parse error.

writeCloseMethodArg

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

Write the end of a method argument to the serializer.

Parameters
serializer KXmlSerializer: the KXmlSerializer

ns String: the namespace

valueType String: the XmlRpc type of the method argument

writeCloseMethodCall

public static void writeCloseMethodCall (KXmlSerializer serializer, 
                String ns)

Write the end of a method call to the serializer.

Parameters
serializer KXmlSerializer: the KXmlSerializer

ns String: the namespace

writeCloseStructMember

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

Write the end of a struct member to the serializer.

Parameters
serializer KXmlSerializer: the KXmlSerializer

ns String: the namespace

valueType String: the XmlRpc type of the member

writeFullMethodArg

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 KXmlSerializer: the KXmlSerializer

ns String: the namespace

valueType String: the XmlRpc type of the method argument

value String: the value of the method argument

writeOpenMethodArg

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 KXmlSerializer: the KXmlSerializer

ns String: the namespace

valueType String: the XmlRpc type of the method argument

writeOpenMethodCall

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

Write the opening of a method call to the serializer.

Parameters
serializer KXmlSerializer: the KXmlSerializer

ns String: the namespace

name String: the name of the XmlRpc method to invoke

writeOpenStructMember

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 KXmlSerializer: the KXmlSerializer

ns String: the namespace

name String: the name of the XmlRpc member

valueType String: the XmlRpc type of the member