/[notice-sender]/jifty-dbi/soap-client.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /jifty-dbi/soap-client.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25 by dpavlin, Mon May 16 13:52:43 2005 UTC revision 72 by dpavlin, Mon Aug 22 20:24:04 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use SOAP::Lite +trace => 'debug';  use SOAP::Lite;
4    
5    my $debug = 0;
6    $debug = 1 if (@ARGV);
7    
8  my $HOST   = "http://localhost/~dpavlin/notice-sender/soap.cgi";  my $HOST   = "http://localhost/~dpavlin/notice-sender/soap.cgi";
9  my $NS     = "urn:Nos";  my $NS     = "http://localhost/Nos/SOAP/";
10  my $soap = SOAP::Lite  my $soap = SOAP::Lite
11          ->readable(1)          ->readable(1)
12          ->uri($NS)          ->uri($NS)
13          ->proxy($HOST);          ->proxy($HOST);
14    
15  my $som = $soap->add_member_to_list(  $soap->on_debug(sub{print "# ",@_}) if ($debug);
16          SOAP::Data->name("list" => "My list"),  
17          SOAP::Data->name("email" => 'dpavlin@rot13.org'),  my $list_id = $soap->CreateList({
18          SOAP::Data->name("name" => 'Dobrica Pavlinusic'),                  list => 'My list',
19          );                  email => 'my-soap@example.com',
20          print "The response from the server was:\n".( $som->result || 'null' )."\n";          })->result || die "can't add list";
21    
22    print "added list ID $list_id\n";
23    
24    
25    my $member_id = $soap->AddMemberToList({
26                    list => 'My list',
27                    email => 'dpavlin@rot13.org',
28                    name => 'Dobrica Pavlinusic',
29            })->result || die "can't add user";
30    
31    print "added member ID $member_id\n";
32    
33    
34    my $message_id = $soap->AddMessageToList({
35                    list => 'My list',
36                    message => 'To: member@example.com
37    From: mylist@example.com
38    Subject: text
39    
40    This is a dummy test
41    ',
42            })->result || die "can't add message";
43    
44    print "added message ID $message_id\n";
45    
46    my $result = $soap->ListMembers({
47                    list => 'My list',
48    });
49    
50    die "can't list members ".$result->faultcode.": ".$result->faultstrig if ($result->fault);
51    
52    print "members:\n";
53    foreach my $m (@{$result->result}) {
54            print "\t",$m->{'email'},"\n";
55    }
56    
57    $soap->DeleteMemberFromList({
58            list => 'My list',
59            email => 'dpavlin@rot13.org',
60    })->result || die "can't delete member";
61    
62    print "deleted member\n";
63    
64    $soap->DropList({
65            list => 'My list'
66    });
67    
68    print "delete list\n";
69    
70  1;  1;

Legend:
Removed from v.25  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26