|
a/libupnpp/soaphelp.hxx |
|
b/libupnpp/soaphelp.hxx |
|
... |
|
... |
22 |
#include <map>
|
22 |
#include <map>
|
23 |
|
23 |
|
24 |
#include <upnp/ixml.h>
|
24 |
#include <upnp/ixml.h>
|
25 |
|
25 |
|
26 |
/** Store returned values after decoding the arguments in a SOAP Call */
|
26 |
/** Store returned values after decoding the arguments in a SOAP Call */
|
27 |
class SoapArgs {
|
27 |
class SoapDecodeOutput {
|
28 |
public:
|
28 |
public:
|
29 |
std::string name;
|
29 |
std::string name;
|
30 |
std::map<std::string, std::string> args;
|
30 |
std::map<std::string, std::string> args;
|
31 |
|
31 |
|
32 |
// Utility methods
|
32 |
// Utility methods
|
|
... |
|
... |
46 |
* @param actReq the XML document containing the SOAP data.
|
46 |
* @param actReq the XML document containing the SOAP data.
|
47 |
* @param[output] res the decoded data.
|
47 |
* @param[output] res the decoded data.
|
48 |
* @return true for success, false if a decoding error occurred.
|
48 |
* @return true for success, false if a decoding error occurred.
|
49 |
*/
|
49 |
*/
|
50 |
extern bool decodeSoapBody(const char *name, IXML_Document *actReq,
|
50 |
extern bool decodeSoapBody(const char *name, IXML_Document *actReq,
|
51 |
SoapArgs *res);
|
51 |
SoapDecodeOutput *res);
|
52 |
|
52 |
|
53 |
/** Store the values to be encoded in a SOAP response.
|
53 |
/** Store the values to be encoded in a SOAP response.
|
54 |
*
|
54 |
*
|
55 |
* The elements in the response must be in a defined order, so we
|
55 |
* The elements in the response must be in a defined order, so we
|
56 |
* can't use a map as container, we use a vector of pairs instead.
|
56 |
* can't use a map as container, we use a vector of pairs instead.
|
57 |
* The generic UpnpDevice callback fills up name and service type, the
|
57 |
* The generic UpnpDevice callback fills up name and service type, the
|
58 |
* device call only needs to fill the data vector.
|
58 |
* device call only needs to fill the data vector.
|
59 |
*/
|
59 |
*/
|
60 |
class SoapData {
|
60 |
class SoapEncodeInput {
|
61 |
public:
|
61 |
public:
|
|
|
62 |
SoapEncodeInput() {}
|
|
|
63 |
SoapEncodeInput(const std::string& st, const std::string& nm)
|
|
|
64 |
: serviceType(st), name(nm) {}
|
|
|
65 |
SoapEncodeInput& addarg(const std::string& k, const std::string& v) {
|
|
|
66 |
data.push_back(pair<string,string>(k, v));
|
|
|
67 |
return *this;
|
|
|
68 |
}
|
|
|
69 |
SoapEncodeInput& operator() (const std::string& k, const std::string& v) {
|
|
|
70 |
data.push_back(pair<string,string>(k, v));
|
|
|
71 |
return *this;
|
|
|
72 |
}
|
|
|
73 |
static std::string i2s(int val);
|
|
|
74 |
|
|
|
75 |
std::string serviceType;
|
62 |
std::string name;
|
76 |
std::string name;
|
63 |
std::string serviceType;
|
|
|
64 |
std::vector<std::pair<std::string, std::string> > data;
|
77 |
std::vector<std::pair<std::string, std::string> > data;
|
65 |
void addarg(const std::string& k, const std::string& v) {
|
|
|
66 |
data.push_back(pair<string,string>(k, v));
|
|
|
67 |
}
|
|
|
68 |
};
|
78 |
};
|
69 |
|
79 |
|
|
|
80 |
// Until we can fix the device code.
|
|
|
81 |
typedef SoapEncodeInput SoapData;
|
|
|
82 |
typedef SoapDecodeOutput SoapArgs;
|
|
|
83 |
|
70 |
/** Build a SOAP response data XML document from a list of values */
|
84 |
/** Build a SOAP response data XML document from a list of values */
|
71 |
extern IXML_Document *buildSoapBody(SoapData& data);
|
85 |
extern IXML_Document *buildSoapBody(const SoapEncodeInput& data,
|
|
|
86 |
bool isResp = true);
|
72 |
|
87 |
|
73 |
#endif /* _SOAPHELP_H_X_INCLUDED_ */
|
88 |
#endif /* _SOAPHELP_H_X_INCLUDED_ */
|