/[notice-sender]/trunk/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

Annotation of /trunk/soap-client.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (hide annotations)
Mon Aug 22 20:24:04 2005 UTC (18 years, 8 months ago) by dpavlin
File MIME type: text/plain
File size: 1378 byte(s)
great API change: list options are now create_list and drop_list

1 dpavlin 25 #!/usr/bin/perl -w
2    
3 dpavlin 70 use SOAP::Lite;
4    
5     my $debug = 0;
6     $debug = 1 if (@ARGV);
7    
8 dpavlin 25 my $HOST = "http://localhost/~dpavlin/notice-sender/soap.cgi";
9 dpavlin 27 my $NS = "http://localhost/Nos/SOAP/";
10 dpavlin 25 my $soap = SOAP::Lite
11     ->readable(1)
12     ->uri($NS)
13     ->proxy($HOST);
14    
15 dpavlin 70 $soap->on_debug(sub{print "# ",@_}) if ($debug);
16 dpavlin 33
17 dpavlin 72 my $list_id = $soap->CreateList({
18 dpavlin 27 list => 'My list',
19 dpavlin 33 email => 'my-soap@example.com',
20     })->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 dpavlin 27 email => 'dpavlin@rot13.org',
28     name => 'Dobrica Pavlinusic',
29 dpavlin 33 })->result || die "can't add user";
30 dpavlin 25
31 dpavlin 33 print "added member ID $member_id\n";
32    
33    
34     my $message_id = $soap->AddMessageToList({
35 dpavlin 27 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 dpavlin 33 })->result || die "can't add message";
43    
44     print "added message ID $message_id\n";
45    
46 dpavlin 62 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 dpavlin 72 $soap->DropList({
65 dpavlin 70 list => 'My list'
66     });
67    
68     print "delete list\n";
69    
70 dpavlin 25 1;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26