Looking to simplify or even "dumb down" this example:
$source = @'
namespace OpenSubtitlesAPI
{
using CookComputing.XmlRpc;
[XmlRpcUrl("http://api.opensubtitles.org/xml-rpc")]
public interface IOpenSubtitles : IXmlRpcProxy
{
[XmlRpcMethod("LogIn")]
XmlRpcStruct LogIn(string username, string password, string language, string useragent);
[XmlRpcMethod("LogOut")]
XmlRpcStruct LogOut(string token);
[XmlRpcMethod("SearchSubtitles")]
XmlRpcStruct SearchSubtitles(string token, XmlRpcStruct[] queries);
[XmlRpcMethod("SearchSubtitles")]
XmlRpcStruct SearchSubtitles(string token, XmlRpcStruct[] queries, int limit);
}
public class ProxyFactory
{
public static IOpenSubtitles CreateProxy()
{
return XmlRpcProxyGen.Create<IOpenSubtitles>();
}
}
}
'@
so that the simplest possible xml-rpc
query is invoked. Using .NET Core on Linux.
also trying:
desired output:
$VAR1 = {
'description' => 'Mountain Dew',
'upc' => '012000000850',
'upce' => '01208500',
'issuerCountryCode' => 'us',
'noCacheAfterUTC' => bless( do{\(my $o = '2020-11-16T17:20:29')}, 'Frontier::RPC2::DateTime::ISO8601' ),
'pendingUpdates' => '0',
'issuerCountry' => 'United States',
'ean' => '0012000000850',
'size' => '12fl oz (355mL)',
'found' => bless( do{\(my $o = '1')}, 'Frontier::RPC2::Boolean' ),
'status' => 'success',
'message' => 'Database entry found',
'lastModifiedUTC' => bless( do{\(my $o = '2014-05-27T04:52:02')}, 'Frontier::RPC2::DateTime::ISO8601' )
};
Adapting from an example script in perl
:
#!/usr/bin/perl
#
# Get an RPC key assigned on the "Account Info" page on https://www.upcdatabase.com/
# Then substitute your own RPC key for $key below.
#
# Usage examples:
# perl_example_new.pl test
# perl_example_new.pl help
# perl_example_new.pl lookup upc 012000000850
# perl_example_new.pl lookup ean 0012000000850
use Frontier::Client;
use Data::Dumper;
use strict;
my $server_name = 'www.upcdatabase.com';
my $key = '445d...aa3';
my $server = Frontier::Client->new( 'url' => 'https://' . $server_name . '/xmlrpc', debug => 0, );
my $method = shift;
my $result = $server->call($method, { rpc_key => $key, @ARGV } );
print Dumper($result);
__END__
adapting to powershell
using the REPL
console:
PS /home/nicholas/powershell>
PS /home/nicholas/powershell> Get-Help Send-XmlRpcRequest -Examples
NAME
Send-XmlRpcRequest
SYNOPSIS
Send a XML RPC Request
-------------------------- EXAMPLE 1 --------------------------
PS > Send-XmlRpcRequest -Url "example.com" -MethodName "updateName" -Params @('oldName', 'newName')
---------
Description
Calls a method "updateName("oldName", "newName")" on the server example.com
PS /home/nicholas/powershell>
PS /home/nicholas/powershell> Send-XmlRpcRequest -Url "www.upcdatabase.com" -MethodName "012000000850" -Params @('fjkdlsfjd')
Exception: /home/nicholas/.local/share/powershell/Modules/XmlRpc/1.0.1.1/XmlRpc.psm1:323
Line |
323 | $doc.LoadXml($response)
| ~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "LoadXml" with "1" argument(s): "Root element is missing."
PS /home/nicholas/powershell>
or using a script file.