AnyEvent-MSN
view release on metacpan or search on metacpan
lib/AnyEvent/MSN.pm view on Meta::CPAN
my $token = $s->auth_token('contacts.msn.com')
->{'wst:RequestedSecurityToken'}{'wsse:BinarySecurityToken'}{content};
$token =~ s/&/&/sg;
$token =~ s/</</sg;
$token =~ s/>/>/sg;
$token =~ s/"/"/sg;
# Reply to good challenge. Expect no body.
$s->_soap_request(
'https://local-bay.contacts.msn.com/abservice/SharingService.asmx',
{ 'content-type' => 'text/xml; charset=utf-8',
SOAPAction =>
'"http://www.msn.com/webservices/AddressBook/FindMembership"'
},
sprintf(<<'XML', $token),
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ABApplicationHeader xmlns="http://www.msn.com/webservices/AddressBook">
<ApplicationId>CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>
<IsMigration>false</IsMigration>
<PartnerScenario>Initial</PartnerScenario>
lib/AnyEvent/MSN.pm view on Meta::CPAN
XML
sub {
my $contacts = shift;
# XXX - Do something with these contacts
#...
}
);
$s->_soap_request(
'https://local-bay.contacts.msn.com/abservice/abservice.asmx',
{ 'content-type' => 'text/xml; charset=utf-8',
SOAPAction =>
'"http://www.msn.com/webservices/AddressBook/ABFindContactsPaged"'
},
sprintf(<<'XML', $token),
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ABApplicationHeader xmlns="http://www.msn.com/webservices/AddressBook">
<ApplicationId>3794391A-4816-4BAC-B34B-6EC7FB5046C6</ApplicationId>
<IsMigration>false</IsMigration>
<PartnerScenario>Initial</PartnerScenario>
lib/AnyEvent/MSN.pm view on Meta::CPAN
handles => {_add_soap_request => 'set',
_del_soap_request => 'delete',
_clear_soap_requests => 'clear'
}
);
sub _soap_request {
my ($s, $uri, $headers, $content, $cb) = @_;
my %headers = (
'user-agent' => 'MSNPM 1.0',
'content-type' => 'application/soap+xml; charset=utf-8; action=""',
'Expect' => '100-continue',
'connection' => 'Keep-Alive'
);
#warn $content;
@headers{keys %$headers} = values %$headers;
$s->_add_soap_request(
$uri,
AnyEvent::HTTP::http_request(
POST => $uri,
lib/AnyEvent/MSN.pm view on Meta::CPAN
my $token = $s->auth_token('contacts.msn.com')
->{'wst:RequestedSecurityToken'}{'wsse:BinarySecurityToken'}{content};
$token =~ s/&/&/sg;
$token =~ s/</</sg;
$token =~ s/>/>/sg;
$token =~ s/"/"/sg;
#
$s->_soap_request(
'https://local-bay.contacts.msn.com/abservice/abservice.asmx',
{ 'content-type' => 'text/xml; charset=utf-8',
SOAPAction =>
'"http://www.msn.com/webservices/AddressBook/ABContactAdd"'
},
sprintf(<<'XML', $token, $contact),
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Header>
<ABApplicationHeader xmlns="http://www.msn.com/webservices/AddressBook">
lib/AnyEvent/MSN.pm view on Meta::CPAN
my $token = $s->auth_token('contacts.msn.com')
->{'wst:RequestedSecurityToken'}{'wsse:BinarySecurityToken'}{content};
$token =~ s/&/&/sg;
$token =~ s/</</sg;
$token =~ s/>/>/sg;
$token =~ s/"/"/sg;
#
$s->_soap_request(
'https://contacts.msn.com/abservice/abservice.asmx',
{'content-type' => 'text/xml; charset=utf-8',
SOAPAction =>
'"http://www.msn.com/webservices/AddressBook/ABContactDelete"'
},
sprintf(<<'XML', $token, $contact),
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Header>
<ABApplicationHeader xmlns="http://www.msn.com/webservices/AddressBook">
( run in 2.407 seconds using v1.01-cache-2.11-cpan-524268b4103 )