/[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 79 - (hide annotations)
Thu Aug 25 11:58:15 2005 UTC (18 years, 8 months ago) by dpavlin
File MIME type: text/plain
File size: 1505 byte(s)
fixed MessagesReceived (request email *OR* list argument)

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26