On Wed, Oct 08, 2003 at 02:39:22PM -0700, Mahlon E. Smith wrote:
> 
> Hi list.
> 
> I've decided to jump in and integrate OpenSRS stuff into our environment.
> Taking baby steps, I wanted to just whip up a test script that verifies I
> can indeed connect to the server and speak it's language.  Apparently, I
> can't.  :)

[snip]

All this is implemented in lib/OpenSRS/XML_Client.pm. You can just use
that and save yourself these problems. You don't need to use all the
higher level stuff in there, just something like this:

---

# assume %OPENSRS has been filled in somehow
# assume $domain, $reg_username, $reg_password filled in

# log in

use OpenSRS::XML_Client;
my $XML_Client = new OpenSRS::XML_Client(%OPENSRS);
$XML_Client->login;

# get a cookie

my $xcp_request = {
        action => "set",
        object => "cookie",
        protocol => "XCP",
        attributes => {
            domain => $domain,
            reg_username => $reg_username,
            reg_password => $reg_password,
        },
    };
my $result = $XML_Client->send_cmd($xcp_request);
my $cookie = $result->{attributes}->{cookie};

# request domain info

$xcp_request = {
            action => "get",
            object => "domain",
            cookie => $cookie,
            protocol => "XCP",
            attributes => {
                type => "all_info",
            }
        };
$result = $XML_Client->send_cmd( $xcp_request );

# do stuff with $result here

$XML_Client->logout;

---

and that's it. Note that I've removed the error handling etc. for clarity. 

HTH

Chris.

Reply via email to