I am new at using RPC-XML. Some suggested to use Frontier::Client, and it seems pretty easy. My problem is constructing the arguments to pass through. I have a hash of key-value pairs, but when I debug it the XML request doesn't look like it should.
#!/usr/bin/perl -w use strict; use Frontier::Client; my $server = Frontier::Client->new('url' => 'http://somexmlrpcsite.com +/service.php', 'encoding' => 'ISO-8859-1', 'debug' => 1); my $method = 'search'; my %paramfields = [{ 'this' => 'thisvalue', 'that' => 'thatvalue', 'something' => 'somevalue' }]; my $result = $server->call($method, %paramfields); print "My result is \n\n: $result\n";
And the debugger gives something like this:
---- request ---- <?xml version="1.0" encoding="ISO-8859-1"?> <methodCall> <methodName>searchres</methodName> <params> <param><value><array><data> <value><struct> <member><name>this</name><value><string>thisvalue</string></value></me +mber> <member><name>that</name><value><string>thatvalue</string></value></me +mber> <member><name>something</name><value><string>somevalue</string></value +></member> </struct></value> </data></array></value></param> </params> </methodCall>
What it should put out is something like this:
---- request ---- <?xml version="1.0" encoding="ISO-8859-1"?> <methodCall> <methodName>search</methodName> <params> <param> <value> <struct> <member> <name>this</name> <value> <string>thisvalue</string> </value> </member> <member> <name>that</name> <value> <string>thatvalue</string> </value> </member> <member> <name>something</name> <value> <string>somevalue</string> </value> </member> </struct> </value> <param> </params> </methodCall>
So the difference is the:
<value><array><data>
I need to get rid of those because it is throwing off the server and giving me an error that they can't find one of the key-value pairs.

In reply to Frontier::Client and getting right XML output by inblosam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.