ulxr::MethodResponse Class Reference
[XML-RPC handling]

Abstraction of a response from a remote server. More...

#include <ulxr_response.h>

Collaboration diagram for ulxr::MethodResponse:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MethodResponse ()
 Default constructor for an empty response.
virtual ~MethodResponse ()
 Destroys the method response.
 MethodResponse (int fval, const CppString &fstr)
 Constructs a "fault reponse" to indicate RPC problems.
 MethodResponse (const Value &val)
 Constructs a return value from the remote method.
 MethodResponse (const Void &val)
 Constructs an empty return value from the remote method.
virtual CppString getSignature (bool deep=false) const
 Returns the signature of this call.
virtual std::string getWbXml () const
 Returns the call as binary xml string.
virtual CppString getXml (int indent=0) const
 Returns the call as xml string.
void setFault (int fval, const CppString &fstr)
 Constructs a "fault reponse" to indicate RPC problems.
void setResult (const Value &val)
 Sets the return value from the remote method.
const ValuegetResult () const
 Gets the return value from the remote method.
bool isOK () const
 Tests the method response state.

Private Attributes

bool wasOk
Value respval

Detailed Description

Abstraction of a response from a remote server.

You should take care to interpret the data correctly as XML-RPC distinguishes between "normal" return values from the remote method and error messages that indicate problems while transporting and invoking the call.

Definition at line 50 of file ulxr_response.h.


Constructor & Destructor Documentation

ulxr::MethodResponse::MethodResponse (  )  [explicit]

Default constructor for an empty response.

Definition at line 47 of file ulxr_response.cpp.

ulxr::MethodResponse::~MethodResponse (  )  [virtual]

Destroys the method response.

Definition at line 72 of file ulxr_response.cpp.

ulxr::MethodResponse::MethodResponse ( int  fval,
const CppString fstr 
)

Constructs a "fault reponse" to indicate RPC problems.

The number and string are system dependent.

Parameters:
fval error code
fstr human readable desciption of the error

Definition at line 59 of file ulxr_response.cpp.

References setFault().

ulxr::MethodResponse::MethodResponse ( const Value val  ) 

Constructs a return value from the remote method.

the value can be of any type. To return more than one Value at once use an array or a Struct.

Parameters:
val the return value.

Definition at line 66 of file ulxr_response.cpp.

References setResult().

ulxr::MethodResponse::MethodResponse ( const Void val  ) 

Constructs an empty return value from the remote method.

Only exists for completeness and yields the same as the default constructor.

Parameters:
val the return value.

Definition at line 53 of file ulxr_response.cpp.


Member Function Documentation

CppString ulxr::MethodResponse::getSignature ( bool  deep = false  )  const [virtual]

Returns the signature of this call.

The signature consists of all type names in this call delimited by commas. Elements of arrays are surrounded by braces. Structure elements and element pairs of structs are grouped by curly braces.

Example:

  Array:  [int,double,string]
  Struct: {{first,int},{second,double}}
 

Parameters:
deep if nested types exist, include them
Returns:
The signature

Definition at line 108 of file ulxr_response.cpp.

std::string ulxr::MethodResponse::getWbXml (  )  const [virtual]

Returns the call as binary xml string.

The method call is converted to a wbxml sequence. It is prepended with the necessary xml procession instruction with version and encoding set to UTF-8.

Returns:
The wbxml content

Definition at line 143 of file ulxr_response.cpp.

References ulxr::MethodResponseParserWb::wbToken_Fault, ulxr::MethodResponseParserWb::wbToken_MethodResponse, ulxr::MethodResponseParserWb::wbToken_Param, ulxr::MethodResponseParserWb::wbToken_Params, ulxr::WbXmlParser::wbxml_END, ulxr::WbXmlParser::wbxml_START_SEQ_LEN, and ulxr::WbXmlParser::wbxml_START_SEQ_STR.

CppString ulxr::MethodResponse::getXml ( int  indent = 0  )  const [virtual]

Returns the call as xml string.

The method cal is converted to an xml text. It is prepended with the necessary xml procession instruction with version and encoding set to UTF-8. The structure of the text is indented to facilitate easy reading.

Parameters:
indent current indentation level
Returns:
The xml conentent

Definition at line 114 of file ulxr_response.cpp.

References ulxr::getXmlIndent(), ulxr::getXmlLinefeed(), and ULXR_PCHAR.

void ulxr::MethodResponse::setFault ( int  fval,
const CppString fstr 
)

Constructs a "fault reponse" to indicate RPC problems.

The number and string are system dependent.

Parameters:
fval error code
fstr human readable desciption of the error

Definition at line 83 of file ulxr_response.cpp.

References ulxr::Struct::addMember(), ULXR_PCHAR, and ULXR_TRACE.

Referenced by MethodResponse().

void ulxr::MethodResponse::setResult ( const Value val  ) 

Sets the return value from the remote method.

The value can be of any type. To return more than one Value at once use an Array or a Struct.

Parameters:
val the return value.

Definition at line 94 of file ulxr_response.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

Referenced by MethodResponse().

const Value & ulxr::MethodResponse::getResult (  )  const

Gets the return value from the remote method.

The value can be of any type, even an Array or a Struct. If the response is faulty, is contains a Struct with two elements:

Definition at line 102 of file ulxr_response.cpp.

bool ulxr::MethodResponse::isOK (  )  const

Tests the method response state.

Returns:
true if RPC processing went OK.

Definition at line 77 of file ulxr_response.cpp.

Referenced by funtik::MultiProcessRpcServer::storeFuncResult().


Member Data Documentation

bool ulxr::MethodResponse::wasOk [private]

Definition at line 146 of file ulxr_response.h.

Value ulxr::MethodResponse::respval [private]

Definition at line 147 of file ulxr_response.h.


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 20:09:07 2007 for ulxmlrpcpp by  doxygen 1.5.1