Protocols/MSNP/MSNP13/Offline IM

From NINA Wiki
Jump to navigation Jump to search
MSNP Protocol
Version 13
General
OverviewChanges
ChallengesSharing Folders
Example Session
SOAP Address Book
Retrieving the lists
Updating the membership lists
Updating the AB
Other features using SOAP
Offline Messaging
Passport 3.0 authentication
Overview
IntroductionTermsClients
Reference
Error ListCommandsRelying Party SuiteSpotlife
Services
XMPPHTTP GatewayTabsActivities
Documentation
Development ToolsMSNP Grid
PolygamyURLs used by MSN
Documents
Protocol Versions
Version 21
Version 18
Version 16
Version 15
Version 14
Version 13
Version 12
Version 11
Version 9
Version 8
Version 2
MSNC
IntroductionP2PObject DescriptorDisplay PicturesFile Transfer
Scenarios
Microsoft Messenger for Mac
MSNP on WebTV (MSNTV)

Offline Messaging

With MSN Messenger 7, came a new feature called "Offline Messaging". This is sort of a voice mail for instant messages, allowing you to send them to offline contacts which will receive them upon signing in.

Note! It is not possible to send Offline Messages (from now on refered to as "OIMs") with MSN Messenger 7/7.5. The clients CAN receive them, though. It is also only possible to send OIMs using MSNP13 challenges. OIMs can be sent with the latest Windows Live Messenger (version 8). In order to receive OIMs you must be signed in, which is not the case for sending OIMs.

Notification of new OIMs

Upon sign in

When you are signing in the NS will send you a special message containing information about your new OIMs.It does this by either appending (if you sign in with a Hotmail account) or by sending a new (if you're not on a Hotmail account) a special MSG with the content-type "text/x-msmsgsinitialmdatanotification".

Assuming you would have a Hotmail account the intial data notification message will now look something like the example below. Note that if you're not on a Hotmail account the last three headers will be left out (considering you do not need URLs to know how to open your inbox):

MSG Hotmail Hotmail 1491
MIME-Version: 1.0
Content-Type: text/x-msmsgsinitialmdatanotification; charset=UTF-8
Mail-Data: See #XML_Data
Inbox-URL: /cgi-bin/HoTMaiL
Folders-URL: /cgi-bin/folders
Post-URL: http://www.hotmail.com

IMPORTANT: Please note that you should not assume that the Mail-Data field will always contain the XML. You will soon realize that the OIMs listed in the XML data of the Mail-Data field can not exceed a limit of around 25 OIM messages. In which case, the Mail-Data field will contain the string "too-large". See #Retreiving_Mail-Data_field_using_SOAP

When already signed in

However, if you are already signed you might receive new OIMs. This happens for example when you appear offline to someone else (you might have them blocked), or if they are using a third party application to send OIMs. In this case, the server will send you a special MSG, with the content-type "text/x-msmsgsoimnotification":

MSG Hotmail Hotmail 294
MIME-Version: 1.0
Content-Type: text/x-msmsgsoimnotification; charset=UTF-8
Mail-Data: See #XML_Data

The XML stream ("Mail-Data")

Once you have received either of these special messages you will need to parse the string of XML data from the "Mail-Data" field. This XML data you receive depends highly on what message you received. Some fields are left out when you are already signed in, and other are being added.

XML Data

If have just signed in and received your initial data notification message you will receive the following chunk of XML. The XML has been exploded for easier viewing. Note that the <E> node will always be present, even if you do not have a Hotmail account.

  <MD>
    <E>
      <I>0
      <IU>0</IU>
      <O>0</O>
      <OU>0</OU>
    </E>
    
      <QTM>409600</QTM>
      <QNM>204800</QNM>
    
    <M>
      <T>11</T>
      <S>6
      <RT>2005-11-15T22:24:27.000Z
      <RS>0</RS>
      <SZ>1006</SZ>
      <E> Removed </E>
      <I>C6525A83-03C5-4F35-91E4-AFF4C397D26D
      <F>00000000-0000-0000-0000-000000000009</F>
      <N>=?utf-8?B?SW5reQ==?=</N>
    </M>
    .. etc ..
  </MD>

However, when you are already signed in the following XML feed will be sent to you. Note that the field RT is missing (which is logical, you do not need to know when the message was received) and the <F> field has a different content:

<MD>
  <M>
    <T>11</T>
    <S>6
    <RS>0</RS>
    <SZ>1029</SZ>
    <E> Removed </E>
    <I>C6525A83-03C5-4F35-91E4-AFF4C397D26D
    <F>.!!OIM</F>
    <N>=?utf-8?B?SW5reQ== ?=</N> Note the space!
    <SU> </SU>
  </M>
</MD>

For each OIM, a new <M> node (Message) is being added to the mail data. This node has various children properties, which will be used later on to retrieve the messages from the server. A list of all properties and their meaning (if known) can be found below:

Meaning of the fields

  • T: Unknown, but has so far only been set to 11.
  • S: Unknown, but has so far only been set to 6.
  • RT: The date/time stamp for when the message was received by the server. This stamp can be used to sort the message in the proper order, although you are recommended to use a different method instead which will be explained later.
  • RS: Unknown, but most likely is set to 1 if the message has been read before ("Read Set").
  • SZ: The size of the message, including headers
  • E: The e-mail address of the sender
  • I: This is the ID of the message, which should be used later on to retrieve the message. Note that the ID is a GUID in the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. It was previously (the change was first noticed in March 2007) in the format of "MSGunix-timestamp.millseconds" (for example MSG1132093467.11) and the Message ID format could change again anytime.
  • F: Unknown, but has so far only been observed as either a GUID with a single 9 at the end, or as ".!!OIM" (in case you are already online when receiving the notification).
  • N: This field contains the friendlyname of the person, wrapped in a special encoding. This encoding is defined in RFC 2047, but to get you started there is a quick overview of the format below (see #Field_encoding). You are recommended however to implement a fully able e-mail parser to handle OIMs!
    • Note! When this field is found in a non-initial notification it will contain a space in the data field. You must filter this space (trim the string) in order to correctly decode this field!
  • SU: Unknown, has only been observed to contain one space.

Field encoding

Note! This is a quick overview of RFC 2047. You are recommended to look up information about the RFC on Google or by following the link to the RFC. Below is a quick overview of how the subject encoding works.
=?charset?encoding-type?data?=
  • charset: The character set which should be used for the decoded text. This charset is usually UTF-8, although it may vary widly. For example, koi8-r is popular for encoding Russian text, while jcode is used for Japanese text.
  • encoding-type: This can either be "B" or "Q". So far only "B" has been observed, but be prepared to handle "Q" as well. B uses Base 64 to encode its data, while Q means Quoted-Printable, which is similar to URL encoding, but uses "=" instead of "%".
  • data: The data, either encoded with Base64 or Quoted-Printable.

Retreiving Mail-Data field using SOAP

In case you receive the field "Mail-Data: too-large", you will need to retreive the Mail-Data XML from the server using a SOAP request. The SOAP request must point to "https://rsi.hotmail.com/rsi/rsi.asmx" and the SOAPAction must be "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata". Here is an example of the SOAP request you need to send (the SOAP payload has been exploded for easier viewing):

POST /rsi/rsi.asmx HTTP/1.1
Accept: */*
SOAPAction: "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata"
Content-Type: text/xml; charset=utf-8
Content-Length: 771
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Windows Live Messenger 8.0.0812)
Host: rsi.hotmail.com
Connection: Keep-Alive
Cache-Control: no-cache
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <PassportCookie xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">
      <t> Removed for security reasons </t>
      <p> Removed for security reasons </p>
    </PassportCookie>
  </soap:Header>
  <soap:Body>
    <GetMetadata xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi" />
  </soap:Body>
</soap:Envelope>
  • PassportCookie: The cookie sent to you when signing in. This cookie is the same as you used for authentication (USR TWN S), although it may expire over time (see #Errors below). This node has two children, t and p which can be stripped directly from the cookie.

The SOAP reply will look like this :

HTTP/1.1 200 OK
Connection: close
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 6152
<?xml version="1.0" encoding="utf-8"?><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">
  <soap:Body>
    <GetMetadataResponse xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">See #XML_Data</GetMetadataResponse>
  </soap:Body>
</soap:Envelope>

Note that the SOAP response XML Data will only contain the <M> and tags, and no <E> tag, to get the number of read/unread emails, you'll need to support the old MSNP9 method, which consisted of sending on the NS a special MSG with the content-type set to "text/x-msmsgsemailnotification".


Retrieving your new OIMs

SOAP Request

To retrieve the messages the client uses special SOAP requests. These SOAP requests point to "https://rsi.hotmail.com/rsi/rsi.asmx", and are being sent using SSL (Secure Socket Layer). The SOAP requests may NOT be done using plain HTTP, you will simply not be able to connect to the server if you do not use SSL. The SOAPAction executed on the server must be "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage", as seen in the example below (the SOAP payload has been exploded for easier viewing):

POST /rsi/rsi.asmx HTTP/1.1
Accept: */*
SOAPAction: "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage"
Content-Type: text/xml; charset=utf-8
Content-Length: 865
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Messenger (BETA) 8.0.0328)
Host: rsi.hotmail.com
Connection: Keep-Alive
Cache-Control: no-cache
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <PassportCookie xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">
      <t> Removed for security reasons </t>
      <p> Removed for security reasons </p>
    </PassportCookie>
  </soap:Header>
  <soap:Body>
    <GetMessage xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">
      <messageId>C6525A83-03C5-4F35-91E4-AFF4C397D26D</messageId>
      <alsoMarkAsRead>false</alsoMarkAsRead>
    </GetMessage>
  </soap:Body>
</soap:Envelope>
  • PassportCookie: The cookie sent to you when signing in. This cookie is the same as you used for authentication (USR TWN S), although it may expire over time (see #Errors below). This node has two children, t and p which can be stripped directly from the cookie.
  • messageId: This is the Message ID received in the Mail-Data, described above.
  • alsoMarkAsRead: This value should be set to "true" if you wish to mark the message as read. This is useful only if you do not want to remove the OIM from ones storage space, but don't want to show up in the next Mail-Data stream either. The client always sets this value to "false".

NOTE: aMSN developers seem to have found a limitation. Here is what a comment in their code says: "the official client sends the nickname limited to 48 characters, if we don't limit it to 48, the server will throw an error at us..."

SOAP Reply

When succesfull the server will reply with a 200OK with a payload containing the message you requested. If things turned out to be wrong in your request then the server will send an error instead (see #Errors). Note that the XML has once again been exploded for easier viewing.

HTTP/1.1 200 OK
Date: Tue, 15 Nov 2005 22:24:58 GMT
Server: Microsoft-IIS/6.0
P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 1363
<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Body>
    <GetMessageResponse xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">
      <GetMessageResult>
        X-Message-Info: cwRBnLifKNE8dVZlNj6AiX8142B67OTjG9BFMLMyzuui1H4Xx7m3NQ==
        Received: from OIM-SSI02.phx.gbl ([65.54.237.206]) by oim1-f1.hotmail.com with Microsoft SMTPSVC(6.0.3790.211);
        	 Tue, 15 Nov 2005 14:24:27 -0800
        Received: from mail pickup service by OIM-SSI02.phx.gbl with Microsoft SMTPSVC;
        	 Tue, 15 Nov 2005 14:24:27 -0800
        From: =?utf-8?B?SW5reQ==?= < Removed >
        To: < Removed >
        Subject:
        X-OIM-originatingSource: 217.121.64.74
        X-OIMProxy: MSNMSGR
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: base64
        X-OIM-Message-Type: OfflineMessage
        X-OIM-Run-Id: {CA7B4177-1CFB-49CE-9F02-982C704A18EB}
        X-OIM-Sequence-Num: 1
        Message-ID: <OIM-SSI02zDv60gxapz00061a8b@OIM-SSI02.phx.gbl>
        X-OriginalArrivalTime: 15 Nov 2005 22:24:27.0201 (UTC) FILETIME=[56E50B10:01C5EA33]
        Date: 15 Nov 2005 14:24:27 -0800
        Return-Path: ndr@oim.messenger.msn.com

        SGVsbG8sIHdvcmxkISA6KQ==
      </GetMessageResult>
    </GetMessageResponse>
  </soap:Body>
</soap:Envelope>

As you can see the main payload is simply a plain e-mail message. So, in order to correctly parse it, you must either write your own parser for such messages, or use an other (open-source) library for it. Note that most operating systems and/or languages come with easy to use default libraries for this task.

Note that the X-OIM-Run-Id and X-OIM-Sequence-Num are very useful for determining the order of the message. Each "run" of messages (basically an IM session) has a unique ID (a GUID). Each of those runs then have one or more messages, each indicated by a simple number (1..*). Note that this method is very similar to multi-packeting.

Deleting OIMs from your Storage Space

Once you have retrieved your OIMs you must also delete them from the server. If you do not do this they will show up again the next time you sign in (they won't show up however if you set the "AlsoMarkAsRead" field to true when requesting OIMs).

SOAP Request

The client does this by sending a special SOAP message, with the SOAPAction field pointed to "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages". The request itself must be done to https://rsi.hotmail.com/rsi/rsi.asmx. An example of how to delete a message is shown below:

NOTE! An error will be sent if you mess up the order of the <p> and <t> nodes. The <t> node should go first, and after that you should place the <p> node.

POST /rsi/rsi.asmx HTTP/1.1
Accept: */*
SOAPAction: "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages"
Content-Type: text/xml; charset=utf-8
Content-Length: 861
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Messenger (BETA) 8.0.0328)
Host: rsi.hotmail.com
Connection: Keep-Alive
Cache-Control: no-cache
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <PassportCookie xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">
      <t> Removed for security </t>
      <p> Removed for security </p>
    </PassportCookie>
  </soap:Header>
  <soap:Body>
    <DeleteMessages xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi">
      <messageIds>
        <messageId>C6525A83-03C5-4F35-91E4-AFF4C397D26D</messageId>
      </messageIds>
    </DeleteMessages>
  </soap:Body>
</soap:Envelope>
  • PassportCookie: This fields childnodes contain your authentication cookie, split up in two parts:
    • t: This is the "t=" part of your auth cookie
    • p: This is the "p=" part of your auth cookie
  • messageIds & messageId: This field contains all the IDs of the messages you want to delete. It is allowed to delete multiple messages at once, simply by adding multiple messageId sub-nodes.

SOAP Reply

If everything went okay, the server will respond with a very simple and short SOAP reply. If there was an error (for example the message you tried to delete does not exist or your cookie has expired) it will send back an error reply. See #Errors for more information on errors.

HTTP/1.1 200 OK
Date: Tue, 15 Nov 2005 22:25:01 GMT
Server: Microsoft-IIS/6.0
P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 326
<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Body>
    <DeleteMessagesResponse xmlns="http://www.hotmail.msn.com/ws/2004/09/oim/rsi" />
  </soap:Body>
</soap:Envelope>

Notification on NS

Once you have removed a message from your Storage Space the NS will send you a message notifying you of the update. The message will carry the content-type "text/x-msmsgsactivemailnotification" and contains three headers, as seen below:

MSG Hotmail Hotmail 148
MIME-Version: 1.0
Content-Type: text/x-msmsgsactivemailnotification; charset=UTF-8
Src-Folder: .!!OIM
Dest-Folder: .!!trAsH
Message-Delta: 1

Sending OIMs to Others

SOAP Request

To send OIMs the client once again uses SOAP requests. But before it does, it will always try to invite the person into a conversation, first. When it receives a 217 error upon inviting the other participant it will start using OIMs. You may send OIMs to contacts that are still online. They will usually see the new messages within a minute from sending.

Sending OIMs is done through https://ows.messenger.msn.com/OimWS/oim.asmx, and by pointing the SOAPAction to "http://messenger.msn.com/ws/2004/09/oim/Store", as seen in the example below. The XML has been exploded for easy viewing only!

POST /OimWS/oim.asmx HTTP/1.1
Accept: */*
SOAPAction: "http://messenger.msn.com/ws/2004/09/oim/Store"
Content-Type: text/xml; charset=utf-8
Content-Length: 1669
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Messenger (BETA) 8.0.0328)
Host: ows.messenger.msn.com
Connection: Keep-Alive
Cache-Control: no-cache
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
  <From memberName=" Removed " friendlyName="=?utf-8?B?SW5reSB8IFRCIGlzIGVlbiBob2VyIG9sw6kgb2zDqQ==?=" xml:lang="nl-nl" proxy="MSNMSGR" xmlns="http://messenger.msn.com/ws/2004/09/oim/" msnpVer="MSNP13" buildVer="8.0.0328"/>
  <To memberName=" Removed " xmlns="http://messenger.msn.com/ws/2004/09/oim/"/>
  <Ticket passport=" Removed for security " appid="PROD01065C%ZFN6F" lockkey="e745d4e406790fb5c5ca70041fbe06df" xmlns="http://messenger.msn.com/ws/2004/09/oim/"/>
  <Sequence xmlns="http://schemas.xmlsoap.org/ws/2003/03/rm">
    <Identifier xmlns="http://schemas.xmlsoap.org/ws/2002/07/utility">http://messenger.msn.com</Identifier>
    <MessageNumber>1</MessageNumber>
  </Sequence>
</soap:Header>
<soap:Body>
  <MessageType xmlns="http://messenger.msn.com/ws/2004/09/oim/">text</MessageType>
  <Content xmlns="http://messenger.msn.com/ws/2004/09/oim/">MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: base64
    X-OIM-Message-Type: OfflineMessage
    X-OIM-Run-Id: {3A3BE82C-684D-4F4F-8005-CBE8D4F82BAD}
    X-OIM-Sequence-Num: 1
    SGVsbG8sIHRoaXMgaXMgYW4gT0lN
  </Content>
</soap:Body>
</soap:Envelope>
  • From: This field contains all the information about the sender (ie. yourself).
    • memberName: The passport you are using, for example address@domain.com
    • friendlyName: Your own friendly name, wrapped in a special encoding (see #Field_encoding).
    • msnpVer: The version of MSNP you are using. In case of WLM 8, this field would contain "MSNP13"
    • buildVer: The build of MSN Messenger (or WLM) you are using. The server does not discriminate on this field, so it is okay to send your own clients build number instead of the build number of a real MSN/WLM client.
  • To: This field cotnains the information about the receiver. The only field it has is memberName, which is the e-mail address of the receiver.
  • Ticket: This field contains your ticket and other authentication information, so the server can validate whether you are really the person you claim to be.
    • passport: The full ticket you received when authenticating (the same ticket you send with USR TWN S!)
    • appid: The application ID of the program you are using. This ID is the same as used in the challenges.
    • lockkey: This MD5 hash is generated using the MSNP11 challenge mechanism. If this is your first OIM, then you must leave this field empty. You will in turn receive a 500 Internal Server Error (See #Errors) and a new LockKeyChallenge value which you can then use to compute this fields value. After you have done this you must rerequest this document.
  • Sequence: Sequence information
    • Identifier: This fields use is unknown, but is only being observed with the value http://messenger.msn.com
    • MessageNumber: The message number. This number must be the same as the value of the X-OIM-Sequence-Num placed later on in the SOAP request. This number is used to indicate the order of the messages (1,2,...*)
  • MessageType: For now this field should always be set to "text", although it is believed it can be changed in order to also send Ink, Voice Clips, etc. This however has not been tested yet.
  • Content: This field contains the contents of the message, in e-mail form.
    • X-OIM-Run-ID: This field indicates the run ID. The ID is a unique GUID, that must assigned to each new session (conversation).
    • X-OIM-Sequence-Num: The sequence number of the message. This number is being used to sort the message so they end up in the right order in the receivers IM window.

SOAP Reply

When everything is OK, the server will reply with a 200 OK, which contains little to no interesting information. You can safely discard the contents of the message for this reason and simply check whether your POST was succesful or not.

HTTP/1.1 200 OK
Date: Tue, 15 Nov 2005 17:28:43 GMT
Server: Microsoft-IIS/6.0
P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 631
<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Header>
    <SequenceAcknowledgment xmlns="http://schemas.xmlsoap.org/ws/2003/03/rm">
      <Identifier xmlns="http://schemas.xmlsoap.org/ws/2002/07/utility">http://messenger.msn.com</Identifier>
      <AcknowledgmentRange Upper="1" Lower="1" />
    </SequenceAcknowledgment>
  </soap:Header>
  <soap:Body>
    <StoreResponse xmlns="http://messenger.msn.com/ws/2004/09/oim/">
      <PointsConsumed>0</PointsConsumed>
    </StoreResponse>
  </soap:Body>
</soap:Envelope>
  • SequenceAcknowledgement:
    • Identifier: The server appears to be sending back the Identifier at all times.
    • AcknowledgementRange: This field contains the messages that were OK. Assuming you only send one message at the time, this field has no real value. Note that perhaps you can send multiple messages at once, in which case it would be recommended to check this field. This has not been tested yet.
  • StoreResponse:
    • PointsConsumed: This value has so far only been observed as 0.

Errors

Authentication Failed

In the above examples you can see that you are always required to send along the cookie you received when authenticating, and when sending OIMs you must also send a so called "lock key". However, this cookie may expire (when being logged in for a very long time, or when the client uses a cached cookie for example), or you may not know the lock key challenge value so you cannot compute the fields value.

In this case you should leave the fields empty, on which the server will send back a 500 Internal Server Error:

HTTP/1.1 500 Internal Server Error.
Date: Tue, 15 Nov 2005 17:28:40 GMT
Server: Microsoft-IIS/6.0
P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 947
<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Body>
    <soap:Fault>
      <faultcode xmlns:q0="http://messenger.msn.com/ws/2004/09/oim/">q0:AuthenticationFailed</faultcode>
      <faultstring>Exception of type System.Web.Services.Protocols.SoapException was thrown.</faultstring>
      <faultactor>https://ows.messenger.msn.com/OimWS/oim.asmx</faultactor>
      <detail>
        <TweenerChallenge xmlns="http://messenger.msn.com/ws/2004/09/oim/">lc=1033,id=507,tw=120,ru=http://messenger.msn.com,ct=1132075720,kpp=1,kv=7,ver=2.1.6000.1,tpf=ab7bfa98f7683164c11c7dba276daa58</TweenerChallenge>
        <LockKeyChallenge xmlns="http://messenger.msn.com/ws/2004/09/oim/">1850937852</LockKeyChallenge>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

As you can see the message body contains the information you need to know in order to fetch both your Authentication Cookie from the .NET Passport servers, and the number used to compute the lock key value (with the MSNP11 challenge algorithm!).

System Unavailable

This error is usually being sent to you when sending an OIM, in the following situations:

  • The user does not exist
  • The user is not on your AL list (you cannot send messages to blocked contacts)
HTTP/1.1 500 Internal Server Error.
Cache-Control: private
Date: Thu, 17 Nov 2005 17:26:50 GMT
Server: Microsoft-IIS/6.0
Content-Length: 524
Content-Type: text/xml; charset=utf-8
P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-AspNet-Version: 1.1.4322
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Body>
    <soap:Fault>
      <faultcode xmlns:q0="http://messenger.msn.com/ws/2004/09/oim/">q0:SystemUnavailable</faultcode>
      <faultstring>Exception of type System.Web.Services.Protocols.SoapException was thrown.</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Scheme Validation Error

This error will be sent (of course) when something is wrong or missing in your SOAP request body, but specifically when you did not specify your authentication ticket when deleting messages. Note that the server will never send back a new TweenerChallenge in this case, so you must be already logged in in order to delete messages.

HTTP/1.1 500 Internal Server Error.
Cache-Control: private
Date: Fri, 18 Nov 2005 16:29:32 GMT
Server: Microsoft-IIS/6.0
Content-Length: 482
Content-Type: text/xml; charset=utf-8
P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-AspNet-Version: 1.1.4322
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Schema validation error</faultstring>
      <faultactor>https://rsi.hotmail.com/rsi/rsi.asmx</faultactor>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>


SenderThrottleLimitExceeded

The name suggests that you can't send too many offline messages in a short period of time. I haven't tried to figure out what the exact limit is, but waiting 10 seconds and resend seems to work.

<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Header>
    <Machine xmlns="http://messenger.msn.com/ws/2004/09/oim/" name="BAYM-OW15" ver="12.30.1623.0"/>
  </soap:Header>
  <soap:Body>
    <soap:Fault>
      <faultcode xmlns:q0="http://messenger.msn.com/ws/2004/09/oim/">q0:SenderThrottleLimitExceeded</faultcode>
      <faultstring>Exception of type 'System.Web.Services.Protocols.SoapException' was thrown.</faultstring>
      <detail/>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>


Credits

Research by Siebe "Inky" Tolsma. Additional research by Youness Alaoui, a.k.a KaKaRoTo.


WSDL and XML schemas

Here the WSDL and XML schemas for the web service descripted here, you can use them to generate a web service binding for your programming language.

Offline Service WSDL & XSD files