com.echomine.xmlrpc
Class Response

java.lang.Object
  extended by com.echomine.xmlrpc.Response

public class Response
extends java.lang.Object

This is the object that will construct a response object.. It can used to parse an incoming response request or construct an response. The response is namespace aware, but by default, no namespace is associated with it unless you specifically set the namespace.


Constructor Summary
Response(Element elem, SerializerFactory factory)
          constructs a response from a dom element.
Response(int faultCode, java.lang.String faultString, SerializerFactory factory)
          constructs an error response with the provided fault code and error string
Response(java.lang.Object response, SerializerFactory factory)
          constructs a response with the proper return data
Response(SerializerFactory factory)
          an empty constructor that is useful when you want to set the data with object information
 
Method Summary
 Element getDOM()
           
 int getFaultCode()
           
 java.lang.String getFaultString()
           
 Namespace getNamespace()
           
 java.lang.Object getResponse()
          retrieves the response data if the message is not an error.
 boolean isFault()
          check if the response is a fault/error response
 void parse(Element elem)
          parses a response from the element.
 void setErrorResponse(int faultCode, java.lang.String faultString)
          sets the error response.
 void setNamespace(Namespace ns)
           
 void setResponse(java.lang.Object respData)
          sets the response to the indicated value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Response

public Response(SerializerFactory factory)
an empty constructor that is useful when you want to set the data with object information


Response

public Response(java.lang.Object response,
                SerializerFactory factory)
constructs a response with the proper return data


Response

public Response(int faultCode,
                java.lang.String faultString,
                SerializerFactory factory)
constructs an error response with the provided fault code and error string


Response

public Response(Element elem,
                SerializerFactory factory)
constructs a response from a dom element. This is normally used to parse an incoming message

Method Detail

parse

public void parse(Element elem)
parses a response from the element. This will reset all the internal data before parsing


setNamespace

public void setNamespace(Namespace ns)

getNamespace

public Namespace getNamespace()

isFault

public boolean isFault()
check if the response is a fault/error response


getFaultCode

public int getFaultCode()

getFaultString

public java.lang.String getFaultString()

getResponse

public java.lang.Object getResponse()
retrieves the response data if the message is not an error. Null is returned is no response is present. You should know exactly what the type of the response is being returned since you most likely submitted the call request to begin with. If the response is an error, this method will return a HashMap of the fault code/string (of course, you can also just retrieve it by calling the convenience methods). If this method returns a valid response, then it will contain the data you want.


setResponse

public void setResponse(java.lang.Object respData)
sets the response to the indicated value. The data should be one of the "core" types for the XMLRPC. In this case, they should be Double, Integer, Boolean, byte[], ArrayList, or HashMap. By setting the response, the fault data will be cleared.


setErrorResponse

public void setErrorResponse(int faultCode,
                             java.lang.String faultString)
sets the error response. By setting the response to an error, the response data will get set to the error response message.


getDOM

public Element getDOM()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2005 Echomine. All Rights Reserved.