Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 27th March 2006, 20:11
olaus olaus is offline
Junior Member
 
Join Date: Feb 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
 
Post ISPConfig Remoting Framework using perls SOAP::Lite

hi folks,

if anyones interessted in using the ISPConfig Remoting Framework with SOAP::Lite here's some example code that downloads a list of all resellers.

ciao
arnim

Code:
#!/usr/bin/perl -w
# contact ISPconfig SOAP-remote-extension using SOAP::Lite

my ( @params );
my ( $obj );

use SOAP::Lite;

my $soap = SOAP::Lite
    -> proxy('https://127.0.0.1:81/remote/index.php') ;

@params = (
  SOAP::Data->name(username => 'USER'),
  SOAP::Data->name(password => 'PASSWORD'),
);

$obj = $soap->call(login => @params);

if ( $obj->faultstring ) {
        die "error: ".$obj->faultstring ;
}

$session_id = $obj->result;

@params = (
  SOAP::Data->name(sid => $session_id ),
  SOAP::Data->name(module => 'reseller'),
  SOAP::Data->name(function => 'reseller_list'),
  SOAP::Data->name(params => ''),
);

# get object:
$obj = $soap->call(service => @params);

if ( $obj->faultstring ) {
        die "error: ".$obj->faultstring ;
}
$result = $obj->result;

# show results:
foreach my $hash_name ( keys %{$result} ) {
        ($hash_ref) = $result->{ $hash_name };
        print "hash_name: $hash_name - hash_ref: $hash_ref \n";
        foreach my $key (sort keys %{$hash_ref}) {
       }
}

# Adding a client
@kunden_params = (
        SOAP::Data->name(reseller_title => 'test_anbieter'),
        SOAP::Data->name(kunde_title => 'kunde_title'),
        SOAP::Data->name(kunde_anrede => 'kunde_anrede'),
        SOAP::Data->name(kunde_firma => 'test_anbieter'),
        SOAP::Data->name(kunde_vorname => 'test_anbieter'),
        SOAP::Data->name(kunde_name => 'test_anbieter'),
        SOAP::Data->name(kunde_strasse => 'test_anbieter'),
        SOAP::Data->name(kunde_plz => '12345'),
        SOAP::Data->name(kunde_ort => 'test_anbieter'),
        SOAP::Data->name(kunde_land => 'test_anbieter'),
        SOAP::Data->name(kunde_telefon => 'test_anbieter'),
        SOAP::Data->name(kunde_fax => 'test_anbieter'),
        SOAP::Data->name(kunde_email => 'test_anbieter'),
        SOAP::Data->name(kunde_internet => 'test_anbieter'),
        SOAP::Data->name(webadmin_user => 'test_anbieter'),
        SOAP::Data->name(webadmin_passwort => 'test_anbieter'),
        SOAP::Data->name(kunde_province => 'test_anbieter'),
);

@params = (
  SOAP::Data->name(sid => $session_id ),
  SOAP::Data->name(module => 'kunde'),
  SOAP::Data->name(function => 'kunde_add'),
  SOAP::Data->name(params => \SOAP::Data->value(
          SOAP::Data->name(params => @kunden_params ),
                                                )
                                        )
);

$customer_id = $soap->call(service => @params);

print "customer_id: $customer_id\n";

if ( $customer_id->faultstring ) {
        die "error: ".$customer_id->faultstring ;
}

# over and out
@params = (
  SOAP::Data->name(sid => $session_id ),
);
$obj = $soap->call(logout => @params);

if ( $obj->faultstring ) {
        die "error: ".$obj->faultstring ;
}

Last edited by olaus; 27th March 2006 at 22:11.
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot access ispconfig site Nu2Linux Installation/Configuration 13 3rd January 2009 16:29
Users and websites aren't created Glorfindel Installation/Configuration 9 23rd February 2006 05:20
42goISP vs. ISPConfig nveid General 1 16th January 2006 10:07
Mirroring ISPConfig with DRBD rodriglm General 5 2nd January 2006 13:48
ISPConfig Devel Report. till Developers' Forum 3 27th November 2005 16:07


All times are GMT +2. The time now is 17:11.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.