em-msn 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -89,15 +89,25 @@ class Msn::NotificationServer < EventMachine::Connection
|
|
89
89
|
contacts.values
|
90
90
|
end
|
91
91
|
|
92
|
-
def get_soap_contacts
|
92
|
+
def get_soap_contacts(url = "https://local-bay.contacts.msn.com/abservice/SharingService.asmx")
|
93
93
|
msn_get_contacts_template_file = File.expand_path('../soap/msn_get_contacts_template.xml', __FILE__)
|
94
94
|
msn_get_contacts_template = ERB.new File.read(msn_get_contacts_template_file)
|
95
95
|
soap = msn_get_contacts_template.result(binding)
|
96
96
|
|
97
|
-
RestClient.post
|
97
|
+
RestClient.post url, soap, {
|
98
98
|
'SOAPAction' => 'http://www.msn.com/webservices/AddressBook/FindMembership',
|
99
99
|
'Content-Type' => 'text/xml',
|
100
100
|
}
|
101
|
+
rescue RestClient::ExceptionWithResponse => ex
|
102
|
+
# Assume the CacheKey changed and we need to request to another URL
|
103
|
+
xml = Nokogiri::XML(ex.response.body)
|
104
|
+
cache_key = xml.xpath("//ns:CacheKey", ContactsNamespace).first
|
105
|
+
@cache_key = cache_key.text if cache_key
|
106
|
+
get_soap_contacts(ex.response.headers[:location])
|
107
|
+
end
|
108
|
+
|
109
|
+
def cache_key_xml
|
110
|
+
@cache_key ? "<CacheKey>#{REXML::Text.normalize @cache_key}</CacheKey>" : ""
|
101
111
|
end
|
102
112
|
|
103
113
|
def post_init
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<ApplicationId xmlns="http://www.msn.com/webservices/AddressBook"><%= Msn::ApplicationId %></ApplicationId>
|
6
6
|
<IsMigration xmlns="http://www.msn.com/webservices/AddressBook">false</IsMigration>
|
7
7
|
<PartnerScenario xmlns="http://www.msn.com/webservices/AddressBook">Initial</PartnerScenario>
|
8
|
+
<%= cache_key_xml %>
|
8
9
|
</ABApplicationHeader>
|
9
10
|
<ABAuthHeader xmlns="http://www.msn.com/webservices/AddressBook">
|
10
11
|
<ManagedGroupRequest xmlns="http://www.msn.com/webservices/AddressBook">false</ManagedGroupRequest>
|
data/lib/msn/version.rb
CHANGED