Re: perl RPC::XML (blackperl)
Bryan Henderson <[email protected]> 23 Mar 2012 15:29:03 +0000
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
>Am I really coming at this backwards?
I don't know if it's you, but somebody is coming at this backwards. You don't
specfify an XML-RPC API with an XML document and have users reverse engineer
it. The API in question should be documented something like this:
Method name: "Gateway.SendMessage"
One parameter, of type structure. Members:
Service: type integer, meaning: ... example: 0
Password: type string, meaning: ... example: "aPassword"
Text: type string, meaning: ... example: "A demonstration short message"
DeliveryTime: type datetime, meaning: ... example: April 21, 2005 ...
Anyway, the way you specify RPC parameters is to add each as an argument to
your $client->send_request(). You need one parameter, so your
$client->send_request will have two arguments. That one parameter is a
structure, which is represented in XML::RPC by a XML::RPC::struct. The
constructor for XML::RPC::struct (see perldoc XML:RPC) takes a Perl hash
reference as its argument. Since a Perl hash and an XML-RPC structure are
virtually identical data structures, it's easy to see the correspondence, with
the one complication that the hash values are references to XML::RPC data
objects, not the normal Perl data structures. The Perl hash you start with is
thus something like
('Service' => new RPC::XML::int(0),
'Password' => new RPC::XML::string('aPassword'),
'Text' => new RPC::XML::string('A demonstration short message'),
...)
--
Bryan Henderson San Jose, California
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xml-rpc/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/xml-rpc/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/