1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use SOAP::Lite; #+trace => 'debug'; |
use SOAP::Lite; # +trace => 'debug'; |
4 |
my $HOST = "http://localhost/~dpavlin/notice-sender/soap.cgi"; |
my $HOST = "http://localhost/~dpavlin/notice-sender/soap.cgi"; |
5 |
my $NS = "http://localhost/Nos/SOAP/"; |
my $NS = "http://localhost/Nos/SOAP/"; |
6 |
my $soap = SOAP::Lite |
my $soap = SOAP::Lite |
8 |
->uri($NS) |
->uri($NS) |
9 |
->proxy($HOST); |
->proxy($HOST); |
10 |
|
|
11 |
print "added member ID ",$soap->AddMemberToList({ |
|
12 |
|
my $list_id = $soap->NewList({ |
13 |
|
list => 'My list', |
14 |
|
email => 'my-soap@example.com', |
15 |
|
})->result || die "can't add list"; |
16 |
|
|
17 |
|
print "added list ID $list_id\n"; |
18 |
|
|
19 |
|
|
20 |
|
my $member_id = $soap->AddMemberToList({ |
21 |
list => 'My list', |
list => 'My list', |
22 |
email => 'dpavlin@rot13.org', |
email => 'dpavlin@rot13.org', |
23 |
name => 'Dobrica Pavlinusic', |
name => 'Dobrica Pavlinusic', |
24 |
})->result,"\n"; |
})->result || die "can't add user"; |
25 |
|
|
26 |
|
print "added member ID $member_id\n"; |
27 |
|
|
28 |
print "added message ID ",$soap->AddMessageToList({ |
|
29 |
|
my $message_id = $soap->AddMessageToList({ |
30 |
list => 'My list', |
list => 'My list', |
31 |
message => 'To: member@example.com |
message => 'To: member@example.com |
32 |
From: mylist@example.com |
From: mylist@example.com |
34 |
|
|
35 |
This is a dummy test |
This is a dummy test |
36 |
', |
', |
37 |
})->result,"\n"; |
})->result || die "can't add message"; |
38 |
|
|
39 |
|
print "added message ID $message_id\n"; |
40 |
|
|
41 |
|
my $result = $soap->ListMembers({ |
42 |
|
list => 'My list', |
43 |
|
}); |
44 |
|
|
45 |
|
die "can't list members ".$result->faultcode.": ".$result->faultstrig if ($result->fault); |
46 |
|
|
47 |
|
print "members:\n"; |
48 |
|
foreach my $m (@{$result->result}) { |
49 |
|
print "\t",$m->{'email'},"\n"; |
50 |
|
} |
51 |
|
|
52 |
|
$soap->DeleteMemberFromList({ |
53 |
|
list => 'My list', |
54 |
|
email => 'dpavlin@rot13.org', |
55 |
|
})->result || die "can't delete member"; |
56 |
|
|
57 |
|
print "deleted member\n"; |
58 |
|
|
59 |
1; |
1; |