Pocket XML-RPC
This is an Open Source [MPL] XML-RPC client COM component for the Windows family (PocketPC/95/98/Me/NT4/2000/XP/2003), based on James Clark's excellent Expat XML Parser and PocketHTTP.
PocketXML-RPC includes the following features- Full support for XML-RPC, including simple types, arrays and structs, and combinations of.
- A generic 'expando' style struct object.
- Efficient stream based parsing.
- HTTP 1.1 support including cookies, proxies, authentication, proxy authentication and SSL.
Latest Version : PocketXML-RPC v1.2.1, released February 26, 2005
Easy to use
set f = CreateObject("pocketXMLRPC.Factory")
set p = f.Proxy("http://rpc.weblogs.com/RPC2", "weblogUpdates.")
set r = p.ping ("It's Just Code!", "http://www.pocketsoap.com/weblog/")
wscript.echo r.message
How To Use
PocketXML-RPC is easy to use, it just consists of two objects, the proxy factory and the struct object. The proxy factory is used to create new client objects for specific endpoints and configurations. e.g.set f = CreateObject("pocketXMLRPC.Factory")
set proxy = f.Proxy("http://rpc.weblogs.com/RPC2", "weblogUpdates.")
This creates a new proxy object "proxy" that sends requests to the http://rpc.weblogs.com/RPC2 URL, with "weblogUpdates." prefixing all the methods.
To make an actual call, just call the method on the proxy object with the relevant parameters, e.g.
p.ping "It's Just Code!", "http://www.pocketsoap.com/weblog/"
This will send an XML-RPC request to http://rpc.weblogs.com/RPC2 with a methodName of weblogUpdates.ping with two string parameters "It's Just Code!" and "http://www.pocketsoap.com/weblog/".
The ping method actually returns a struct, which is automatically mapped to our struct object. To access values from the struct, just use the member names as property names, e.g.
set pingRes = p.ping("It's Just Code!", "http://www.pocketsoap.com/weblog/")
' access the message member of the returned struct
msgbox pingRes.message
To send structs, we need to create an instance of the expando struct object first, then it works just as above, it automatically exapands to support whatever properties you set, e.g.
' assume we have a proxy object and we want to send a "sendMessage" method that
' takes a single struct with 3 members message, timestamp and messageId
set myStruct = CreateObject("PocketXMLRPC.Struct")
myStruct.message = "Hello from PocketXML-RPC"
myStruct.timestamp = now
myStruct.messageId = 42
p.sendMessage myStruct
Arrays are also supported, they are mapped to/from arrays of variants, e.g.
myNumbers = array(10,20,30,40,42)
msgbox p.addNumbers (myNumbers)
Nested combinations are also supported, so you can have structs with structs, structs with arrays or arrays of structs, e.g.
set msg1 = CreateObject("PocketXMLRPC.Struct")
msg1.message = "Hello from PocketXML-RPC"
msg1.timestamp = now
msg1.messageId = 42
set msg2 = CreateObject("PocketXMLRPC.Struct")
msg2.message = "Goodbye from PocketXML-RPC"
msg2.timestamp = now
msg2.messageId = 43
msgs = array(msg1,msg2)
' assume we have a proxy object with a sendMessages method that takes an array of structs
p.sendMessages msgs
The proxy factory also supports a number of additional parameters that allow you can setup the HTTP parameters including server
authentication, proxy server and proxy configuration settings.
object Proxy ( string endpointURL,
[string methodNamePrefix],
[string serverUsername],
[string serverPassword],
[string httpProxyServer],
[long httpProxyPort],
[string proxyUsername],
[string proxyPassword],
[long timeoutInSeconds] )
Note that the default timeout is 15 seconds. For example, to create a proxy object for the weblogs.com ping,
that goes via a proxy server running at proxy.corp.com:8080, you would call
set f = CreateObject("pocketXMLRPC.Factory")
set p = f.Proxy("http://rpc.weblogs.com/RPC2", "weblogUpdates.",,,"proxy.corp.com", 8080)
Binaries & Source
Pre packaged Binaries and source are available under the Mozila Public License v1.1 (MPL)Version | Size (Kb) | Platform | Notes |
---|---|---|---|
Win32 Version v1.2.0 Packaged Install | 238 | supports Windows 95 OSR2 / 98 / Me / NT4 / 2000 / XP / 2003 |
Windows 95 requires DCOM95 Installing first Windows 95/98 requires additional installs for SSL support, see this KB article for details. |
PocketPC Version v1.2.1 Packaged Install | 570 | supports ARM, SH3 & MIPS running PocketPC and ARM devices running PocketPC 2002 and PocketPC 2003 | requires ActiveSync 3.0 or greater to install, tested on Compaq iPaq H3650 (ARM) with a CF ethernet card |
v1.2.1 Source Code | 1920 | Single source tree for both PocketPC & desktop versions | Read the building the source notes first ! |
v1.2.1 Binaries for the PocketPC 2000 emulator | 129 | Built binaries suitable for installation into the pocketPC 2000 emulator. | Run regsvrce on pocketHTTP.dll and PocketXMLRPC.dll |
v1.2.1 Binaries for the PocketPC 2002 emulator | 125 | Built binaries suitable for installation into the pocketPC 2002 emulator. | Run regsvrce on pocketHTTP.dll and PocketXMLRPC.dll |
Release History
Version 1.2.1, February 26, 2005- Updated to PocketHTTP 1.2.3 (longer timeouts, better diagnostics for SSL over Proxy failures, fixed memory leak in compression handling)
- Change to the base64 handling to vastly increase the decoding of base64 data (patch from Jim T Row, thanks Jim!)
- Updated to PocketHTTP 1.2.1, various new HTTP features & bug fixes.
- expat is now statically linked, only need PocketXMLRPC.dll and PocketHTTP.dll installed to use, all external dependencies are statically compiled in. Fixes issues where different versions of expat are already loaded into the process.
- Added a target for the PocketPC2002 emulator.
- Uses PocketHTTP 1.0.1 as its transport, this gets HTTP/1.1 support including chunked encoding, persistent connections and various HTTP related bug fixes.
- Now uses PocketHTTP as its HTTP transport, this gets HTTP/1.1 support including chunked encoding, persistent connections and various HTTP related bug fixes.
- A crashing bug with handling SSL payloads bigger than 4k on Win32 was fixed. [this doesn't affect the PocketPC version]
- Initial release, both PocketPC and desktop versions.