sipxtacklib  Version 3.3
XmlRpcResponse.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _XMLRPCRESPPONSE_H_
12 #define _XMLRPCRESPPONSE_H_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include <utl/UtlString.h>
18 #include <utl/UtlSList.h>
19 #include <xmlparser/tinyxml.h>
20 #include "net/Url.h"
21 #include "net/XmlRpcBody.h"
22 
23 // DEFINES
24 #define ILL_FORMED_CONTENTS_FAULT_STRING "Ill-formed XML contents"
25 #define METHOD_NAME_FAULT_STRING "Method name is missing"
26 #define UNREGISTERED_METHOD_FAULT_STRING "Method has not been registered"
27 #define AUTHENTICATION_REQUIRED_FAULT_STRING "Authentication is required"
28 #define EMPTY_PARAM_VALUE_FAULT_STRING "Empty param value"
29 #define CONNECTION_FAILURE_FAULT_STRING "Connection Failed"
30 
31 // MACROS
32 // EXTERNAL FUNCTIONS
33 // EXTERNAL VARIABLES
34 // CONSTANTS
35 
36 // for backward compatibility with old #define codes
37 #define ILL_FORMED_CONTENTS_FAULT_CODE XmlRpcResponse::IllFormedContents
38 #define METHOD_NAME_FAULT_CODE XmlRpcResponse::InvalidMethodName
39 #define UNREGISTERED_METHOD_FAULT_CODE XmlRpcResponse::UnregisteredMethod
40 #define AUTHENTICATION_REQUIRED_FAULT_CODE XmlRpcResponse::AuthenticationRequired
41 #define EMPTY_PARAM_VALUE_FAULT_CODE XmlRpcResponse::EmptyParameterValue
42 
43 // STRUCTS
44 // TYPEDEFS
45 
46 // FORWARD DECLARATIONS
47 
58 {
59 /* //////////////////////////// PUBLIC //////////////////////////////////// */
60 public:
61 
62 /* ============================ CREATORS ================================== */
63 
66 
68  virtual ~XmlRpcResponse();
69 
71  typedef enum
72  {
80  } FaultCode;
86 /* ============================ MANIPULATORS ============================== */
87 
89  bool setResponse(UtlContainable* value);
90 
92  bool setFault(int faultCode, const char* faultString);
98  bool getResponse(UtlContainable*& value);
100 
102  void getFault(int* faultCode, UtlString& faultString);
103 
105  bool parseXmlRpcResponse(UtlString& responseContent);
106 
108  XmlRpcBody* getBody();
109 
110 /* ============================ ACCESSORS ================================= */
111 
112 
113 /* ============================ INQUIRY =================================== */
114 
115 /* //////////////////////////// PROTECTED ///////////////////////////////// */
116 protected:
117 
118 /* //////////////////////////// PRIVATE /////////////////////////////////// */
119 private:
120 
122  bool parseValue(TiXmlNode* valueNode);
123 
125  bool parseArray(TiXmlNode* valueNode, UtlSList* array);
126 
128  bool parseStruct(TiXmlNode* valueNode, UtlHashMap* memebers);
129 
130  // Clean up the memory in a UtlContainable
131  void cleanUp(UtlContainable* value);
132 
134  XmlRpcBody* mpResponseBody;
135 
137  UtlContainable* mResponseValue;
138 
140  int mFaultCode;
141 
143  UtlString mFaultString;
144 
146  XmlRpcResponse(const XmlRpcResponse& rXmlRpcResponse);
147 
149  XmlRpcResponse& operator=(const XmlRpcResponse& rhs);
150 };
151 
152 /* ============================ INLINE METHODS ============================ */
153 
154 #endif // _XMLRPCRESPPONSE_H_
155 
156 
name is not syntactically valid
Definition: XmlRpcResponse.h:74
void getFault(int *faultCode, UtlString &faultString)
Get the fault code and fault string from the XML-RPC response.
Definition: XmlRpcResponse.cpp:318
missing value for a required parameter
Definition: XmlRpcResponse.h:77
XmlRpcResponse()
Contruct a XML-RPC response.
Definition: XmlRpcResponse.cpp:34
virtual ~XmlRpcResponse()
Destructor.
Definition: XmlRpcResponse.cpp:43
bool setResponse(UtlContainable *value)
Values used by this subsystem in the fault code; Applications may use these or any integer value...
Definition: XmlRpcResponse.cpp:203
XmlRpcBody * getBody()
Get the content of the response.
Definition: XmlRpcResponse.cpp:835
unable to connect to service
Definition: XmlRpcResponse.h:78
bool setFault(int faultCode, const char *faultString)
Set the fault code and fault string in a fault response.
Definition: XmlRpcResponse.cpp:232
bool parseXmlRpcResponse(UtlString &responseContent)
Parse the XML-RPC response.
Definition: XmlRpcResponse.cpp:59
This class contains all the contents presented in a XML-RPC body.
Definition: XmlRpcBody.h:87
FaultCode
Fault code values.
Definition: XmlRpcResponse.h:71
This object is used to create a XML-RPC response to a XmlRpcRequest request.
Definition: XmlRpcResponse.h:57
http returned a non-2xx status
Definition: XmlRpcResponse.h:79
no server found for requested method
Definition: XmlRpcResponse.h:75
request was not properly authenticated
Definition: XmlRpcResponse.h:76
bool getResponse(UtlContainable *&value)
Get the XML-RPC response.
Definition: XmlRpcResponse.cpp:299
xmlrpc message was not well formed xml
Definition: XmlRpcResponse.h:73

sipXtackLib home page