/[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

Contents of /trunk/soap-client.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (show 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 #!/usr/bin/perl -w
2
3 use SOAP::Lite;
4
5 my $debug = 0;
6 $debug = 1 if (@ARGV);
7
8 my $HOST = "http://localhost/~dpavlin/notice-sender/soap.cgi";
9 my $NS = "http://localhost/Nos/SOAP/";
10 my $soap = SOAP::Lite
11 ->readable(1)
12 ->uri($NS)
13 ->proxy($HOST);
14
15 $soap->on_debug(sub{print "# ",@_}) if ($debug);
16
17 my $list_id = $soap->CreateList({
18 list => 'My list',
19 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 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;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26