Intermec CV30 Intermec Terminal Emulator (ITE) Programmer's Reference Manual - Page 166

About RPC XML in ITE

Page 166 highlights

Appendix B - About RPC Implementation About RPC XML in ITE RPC XML in ITE is implemented as XMLRPC (see http://www.xmlrpc.com). This standard interface is simple, well supported, and has been implemented in many languages and on several platforms. It describes simple types using XML tags. For example, examples.getStateName 41 describes an examples.getStateName() function that takes a integer parameter whose value is 41. XMLRPC implementations normally translate function parameters into XMLRPC and unpack XML into their respective types. In the SourceForge implementation (http://xmlrpcpp.sourceforge.net) XMLRPC functions have the following physical prototypes: bool Client.execute(String functionName, XmlRpcValue parms, XMLRpcValue result); void Sever.execute(XMLRpcValue parms, XMLRpcValue result); For instance, to use XMLRPC to add numbers, the server code (the function that adds the numbers) in C++ using the SourceForge implementation is: void execute(XmlRpcValue& params, XmlRpcValue& result) { int nArgs = params.size(); double sum = 0.0; for (int i=0; i

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184

Appendix B — About RPC Implementation
154
Intermec Terminal Emulator (ITE) Programmer’s Reference Manual
About RPC XML in ITE
RPC XML in ITE is implemented as XMLRPC (see
). This
standard interface is simple, well supported, and has been implemented in many
languages and on several platforms. It describes simple types using XML tags. For
example,
<methodCall>
<methodName>examples.getStateName</methodName>
<params>
<param>
<value><i4>41</i4></value>
</param>
</params>
</methodCall>
describes an examples.getStateName() function that takes a integer parameter
whose value is 41.
XMLRPC implementations normally translate function parameters into XMLRPC
and unpack XML into their respective types.
In the SourceForge implementation (
) XMLRPC
functions have the following physical prototypes:
bool Client.execute(String functionName, XmlRpcValue parms,
XMLRpcValue result);
void Sever.execute(XMLRpcValue parms, XMLRpcValue result);
For instance, to use XMLRPC to add numbers, the server code (the function that
adds the numbers) in C++ using the SourceForge implementation is:
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
double sum = 0.0;
for (int i=0; i<nArgs; ++i)
sum += double(params[i]);
result = sum;
}
The caller (client) code looks like:
// Add up an array of numbers
XmlRpcValue numbers;
numbers[0] = 33.33;
numbers[1] = 112.57;
numbers[2] = 76.1;
std::cout << "numbers.size() is " << numbers.size() <<
std::endl;
if (c.execute("Sum", numbers, result))
std::cout << "Sum = " << double(result) << "\n\n";