Skip Menu |

This queue is for tickets about the XMLRPC-Fast CPAN distribution.

Report information
The Basics
Id: 123887
Status: open
Priority: 0/
Queue: XMLRPC-Fast

People
Owner: Nobody in particular
Requestors: richard.yang [...] wustl.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Call XML not a proper XML-RPC call. <data> element has [~some type~] child. Only <value> makes sense
Date: Fri, 15 Dec 2017 12:54:29 -0600
To: "" <bug-xmlrpc-fast [...] rt.cpan.org>
From: "Richard Yang" <richard.yang [...] wustl.edu>
Hi, The module does not create valid requests for slightly more complicated structures, I've only had it working for simple "encode_xmlrpc_request" structures that involve a single list without nesting arrays/hashes (i.e. 'methodnamehere, param1, param2..'). For example, the code below does not work (although it should as it was taken from a decoded working request, modified to module's correct syntax): my $xml = encode_xmlrpc( method => 'system.multicall' [ { 'methodName' => 'd.custom.set', 'params' => [ 'AKDF54456456AS4D56AS4D65A4SD56AS4D56AS4', 'name1', 'value1' ] }, { 'methodName' => 'd.custom.set', 'params' => [ '5A6S4D6A4SD5AS4D6A4SD6A5S4DA6SD56A4SD65', 'name2', 'value2' ], } ] The above request has the error of the subject title of this email; [~some type~] in this case is "<struct>". Note I've gotten errors in the case of "<string>" as well,  and am very like to get errors for other types. Regards, Richard Yang Majors: Biomedical Engineering, Computer Science 🌐 : yenforyang.com [https://yenforyang.com] ✉: richard.yang@wustl.edu [mailto:richard.yang@wustl.edu] [Washington University in St. Louis]

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #123887] Call XML not a proper XML-RPC call. <data> element has [~some type~] child. Only <value> makes sense
Date: Fri, 15 Dec 2017 23:25:38 +0100 (CET)
To: bug-XMLRPC-Fast [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <sebastien [...] aperghis.net>
Richard Yang wrote via RT Show quoted text
> Hi,
Hello, Show quoted text
> The module does not create valid requests for slightly more > complicated structures, I've only had it working for simple > "encode_xmlrpc_request" structures that involve a single list > without nesting arrays/hashes (i.e. 'methodnamehere, param1, > param2..').
I can assure you that this module was written to handle more than trivial structures. It was (and as far as I know still is) used in code at my previous $job to handle hundreds of encodings per minute of moderately complex structures (at least, more complex than the example you provide below). Show quoted text
> For example, the code below does not work (although it > should as it was taken from a decoded working request, modified to > module's correct syntax): > > my $xml = encode_xmlrpc( method => 'system.multicall' [ { > 'methodName' => 'd.custom.set', 'params' => [ > 'AKDF54456456AS4D56AS4D65A4SD56AS4D56AS4', 'name1', 'value1' ] }, { > 'methodName' => 'd.custom.set', 'params' => [ > '5A6S4D6A4SD5AS4D6A4SD6A5S4DA6SD56A4SD65', 'name2', 'value2' ], } ] > The above request has the error of the subject title of this email; > [~some type~] in this case is "<struct>". Note I've gotten errors in > the case of "<string>" as well,  and am very like to get errors for > other types.
Putting your example in a file, fixing the typo: $ cat t/cpan-rt-123887.t #!perl use v5.10; use strict; use warnings; use XMLRPC::Fast; my $xml = encode_xmlrpc( method => 'system.multicall', [ { 'methodName' => 'd.custom.set', 'params' => [ 'AKDF54456456AS4D56AS4D65A4SD56AS4D56AS4', 'name1', 'value1' ] }, { 'methodName' => 'd.custom.set', 'params' => [ '5A6S4D6A4SD5AS4D6A4SD6A5S4DA6SD56A4SD65', 'name2', 'value2' ] } ]); say $xml; Executing it: <?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><struct><member><name>params</name><value><array><data><string>AKDF54456456AS4D56AS4D65A4SD56AS4D56AS4</string><string>name1</string><string>value1</string></data></array></value></member><member><name>methodName</name><value><string>d.custom.set</string></value></member></struct><struct><member><name>methodName</name><value><string>d.custom.set</string></value></member><member><name>params</name><value><array><data><string>5A6S4D6A4SD5AS4D6A4SD6A5S4DA6SD56A4SD65</string><string>name2</string><string>value2</string></data></array></value></member></struct></data></array></value></param></params></methodCall> Passing the result through xml_pp: <?xml version="1.0" encoding="UTF-8"?> <methodCall> <methodName>system.multicall</methodName> <params> <param> <value> <array> <data> <struct> <member> <name>methodName</name> <value> <string>d.custom.set</string> </value> </member> <member> <name>params</name> <value> <array> <data> <string>AKDF54456456AS4D56AS4D65A4SD56AS4D56AS4</string> <string>name1</string> <string>value1</string> </data> </array> </value> </member> </struct> <struct> <member> <name>methodName</name> <value> <string>d.custom.set</string> </value> </member> <member> <name>params</name> <value> <array> <data> <string>5A6S4D6A4SD5AS4D6A4SD6A5S4DA6SD56A4SD65</string> <string>name2</string> <string>value2</string> </data> </array> </value> </member> </struct> </data> </array> </value> </param> </params> </methodCall> Piping the original program to XMLRPC::Fast decode_xmlrpc(): $ perl -Ilib t/cpan-rt-123887.t | perl -Ilib -MXMLRPC::Fast -MData::Dump=dd -e 'dd decode_xmlrpc(<>)' { methodName => "system.multicall", params => [ [ { methodName => "d.custom.set", params => ["AKDF54456456AS4D56AS4D65A4SD56AS4D56AS4", "name1", "value1"], }, { methodName => "d.custom.set", params => ["5A6S4D6A4SD5AS4D6A4SD6A5S4DA6SD56A4SD65", "name2", "value2"], }, ], ], type => "request", } As far as I can test with the provided data, everything seems to works fine. Wouldn't it be some other part of your program that could mangle the result? Regards -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.