Return channel

I'm developing the return channel. I use a STB with standard modem.
But the connection failed.
This is my code:
RCInterfaceManager rcm = RCInterfaceManager.getInstance();
RCInterface[] interfaces = rcm.getInterfaces();
myInterface = (ConnectionRCInterface) interfaces[0];
//HERE I reserve the interface using the method
//reserve(ResourceClient resourceClient, Object obj)
//but I just declare the implement of ResuorceClient in my
//connection class.
//All the methods are empty!!!!(COULD BE A PROBLEM???):
//implements ResourceClient
//public void notifyRelease(ResourceProxy rsPrx)
//public void release(ResourceProxy rsPrx)
//public boolean requestRelease
//(ResourceProxy rsPrx,java.lang.Object requestData)
//return true;
myInterface.reserve(this, null);
myInterface.setTargetToDefault();
//I make the call to a ISP from an internal phone line.
//So I have to use the "0," before the number to the provider
//Could be the cause of the failure???
ConnectionParameters myConnectionParameters;
myConnectionParameters = new ConnectionParameters("0,0643xxxxxxx", "XXXXXX", "XXXXXXXXi");
myInterface.setTarget(myConnectionParameters);
myInterface.connect();
// HERE I do everithing with the connection
myInterface.disconnect();
myInterface.release();
Another question is: can I use ALL providers (for example one that I use with my pc) or I have to search a particular PROVIDER for STB?
Is it too much what I' m asking??
JUST IF YOU 'RE HERE : THANK YOU

I'm developing the return channel. I use a STB with standard modem.
But the connection failed.
This is my code:
RCInterfaceManager rcm = RCInterfaceManager.getInstance();
RCInterface[] interfaces = rcm.getInterfaces();
myInterface = (ConnectionRCInterface) interfaces[0];
//HERE I reserve the interface using the method
//reserve(ResourceClient resourceClient, Object obj)
//but I just declare the implement of ResuorceClient in my
//connection class.
//All the methods are empty!!!!(COULD BE A PROBLEM???):
//implements ResourceClient
//public void notifyRelease(ResourceProxy rsPrx)
//public void release(ResourceProxy rsPrx)
//public boolean requestRelease
//(ResourceProxy rsPrx,java.lang.Object requestData)
//return true;
myInterface.reserve(this, null);
myInterface.setTargetToDefault();
//I make the call to a ISP from an internal phone line.
//So I have to use the "0," before the number to the provider
//Could be the cause of the failure???
ConnectionParameters myConnectionParameters;
myConnectionParameters = new ConnectionParameters("0,0643xxxxxxx", "XXXXXX", "XXXXXXXXi");
myInterface.setTarget(myConnectionParameters);
myInterface.connect();
// HERE I do everithing with the connection
myInterface.disconnect();
myInterface.release();
Another question is: can I use ALL providers (for example one that I use with my pc) or I have to search a particular PROVIDER for STB?
Is it too much what I' m asking??
JUST IF YOU 'RE HERE : THANK YOU

Similar Messages

  • Write Files through return channel

    Hi,
    i'm newer in this forum. I'm working in a MHP project, and I want to comunicate STB with the server (in this case, a PC running Apache Server).
    The question is �can I write a file in the server with data obtained on the STB? I think that it is posible via return channel, but i'm not sure. The idea is to write file (on the server) with the solutions entered by TV user in an application that have some tests. �Are other ways besides return channel to do it?
    Thanks ;)
    Regards

    Hello here you an example of login in my application:
    package es.admin.servlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import es.admin.bd.PacienteBD;
    import es.admin.beans.Paciente;
    import es.admin.dao.PacienteDAO;
    * Servlet implementation class for Servlet: LoginPatient
    public class LoginPatient extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
       static final long serialVersionUID = 1L;
        /* (non-Java-doc)
          * @see javax.servlet.http.HttpServlet#HttpServlet()
         public LoginPatient() {
              super();
         /* (non-Java-doc)
          * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              processRequest(request,response);
         /* (non-Java-doc)
          * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              processRequest(request,response);
         private void processRequest(HttpServletRequest request,HttpServletResponse response) throws IOException
              Paciente paciente = new Paciente();
              paciente.setDni(request.getParameter("dni"));
              paciente.setContrasenia(request.getParameter("contrasenia"));
              boolean ok = PacienteBD.compruebaPaciente(paciente.getDni(),paciente.getContrasenia());
              response.setContentType("text/plain;charset=UTF-8");
              PrintWriter p = response.getWriter();
              if (ok)
                   p.println("true");
              else
                   p.print("false");
    public class PacienteBD {
         public static boolean compruebaPaciente(String dni,String password)
              boolean correcto = false;
              Paciente aux = PacienteDAO.BuscarPaciente(dni);
              if ((aux!=null)&&(aux.getContrasenia().equals(password)))
                   correcto = true;
              return correcto;
    }then you use from the java code :
    new URL ("http://admin/login?usuario=xxx&passw=xxx")
    thats all

  • Return channel implementation in different STB

    Hi everybody!
    We are testing our application in three different Set Top Boxes (A)Samsung DTB-S500F, B) Philips DTR4600 and C) Humax DTT-4000).
    According to the standard "On devices whose return channel can be connected or disconnected, connecting a java.net.Socket or a java.
    net.URLConnection to a host addressed via the return channel shall automatically setup a connection to the default connection target subject to the application having return channel permission for the default ISP. Such connections shall be automatically isconnected after a time out period defined in the Navigator.".
    When I try to get a Socket in STBs B and C, I must reserve the return channel, connect it and then I can get the socket. But when doing this with STB A, the application fails because the STB tries to reserve and connect the return channel himself.
    I have notice different behaviours in other aspects, such as HSinglelineEntry.
    I suppose that according to the standar, STB A is the correct one; but our application should work on every STB. Any suggestion on what line should we follow? Should we respect the standard and expect that in future every STB will respect it, or should we add some kind of tricks to the code in order to avoid this kind of situations?
    Thanks.

    maybe we can help.
    i have a ?
    did u getting application menu at sceen. ?
    i need to see your DB defult , u may have a variable in wrong position.
    if u eed help, just let me now..
    good day

  • Return channel problem

    Hi guys,
    I have a little problem.
    I am tring to use the return channel. I have an ADB STB.
    My main class try to create the connection using the singleton class RCInterfaceManager. It get a ConnectionRCInterface object and then I use reserve and connect method to establish the connection.
    My main class implements the ResourceClient interface so I pass this object as paramether in the reserve calling.
    I set the new connection target using the ConnectionParameters class.
    The problem is that the application try to dial with the external server and after a few second receives a PPP busy error in the log file.
    What is wrong?
    Thanks to all

    Hi guys,
    I have a little problem.
    I am tring to use the return channel. I have an ADB
    STB.
    My main class try to create the connection using the
    singleton class RCInterfaceManager. It get a
    ConnectionRCInterface object and then I use reserve
    and connect method to establish the connection.
    My main class implements the ResourceClient interface
    so I pass this object as paramether in the reserve
    calling.
    I set the new connection target using the
    ConnectionParameters class.
    The problem is that the application try to dial with
    the external server and after a few second receives a
    PPP busy error in the log file.
    What is wrong?
    Thanks to allHi
    I am trying to get connection with the return channel with a development STB(ADB). I am using this code:
    RCInterfaceManager rcm =
    RCInterfaceManager.getInstance();
    RCInterface[] interfaces = rcm.getInterfaces();
    if (interfaces[0] instanceof ConnectionRCInterface) {
    ConnectionRCInterface myInterface;
    myInterface = (ConnectionRCInterface)interfaces[0];
    try {
    myInterface.reserve();
    ConnectionParameters myConnectionParameters;
    myConnectionParameters = new ConnectionParameters
    ("0199604235697", "username", "password");
    myInterface.setTarget(myConnectionParameters);
    myInterface.connect();
    myInterface.disconnect();
    myInterface.release();
    } catch (permissionDeniedException e) {
    return;
    else {
    } Here there is the log file:
    [1#1] Trying to connect default return channel...
    connected.
    link up...
    waiting up to 30s for IPCP to come up...
    ppp: PPP_EV_PEER_REFUSE
    Disconnecting modem. IPCP is down.
    ppp: PPP_EV_ALREADY_CLOSED
    [1#1] Default return channel connection failed.
    [1#1:2] java.net.SocketException: ECONNABORTED - Software caused connection abort
    [1#1:2] at java.net.PlainSocketImpl.doConnect()
    [1#1:2] at java.net.PlainSocketImpl.connectToAddress()
    [1#1:2] at java.net.PlainSocketImpl.connect()
    [1#1:2] at java.net.Socket.<init>()
    [1#1:2] at java.net.Socket.<init>()
    [1#1:2] at sun.net.NetworkClient.doConnect()
    [1#1:2] at sun.net.www.http.HttpClient.openServer()
    [1#1:2] at sun.net.www.http.HttpClient.openServer()
    [1#1:2] at sun.net.www.http.HttpClient.<init>()
    [1#1:2] at sun.net.www.http.HttpClient.<init>()
    [1#1:2] at sun.net.www.http.HttpClient.New()
    [1#1:2] at sun.net.www.protocol.http.HttpURLConnection.connect()
    [1#1:2] at lib.utility.Connessione.<init>()
    [1#1:2] at viasi.XletNazioni.inCaricamento()
    [1#1:2] at viasi.XletNazioni.paint()
    [1#1:2] at java.awt.Container.paint()
    [1#1:2] at org.havi.ui.HScene.paint()
    [1#1:2] at org.havi.ui.HScene.update()
    [1#1:2] at sun.awt.otk.ComponentModel.handleEvent()
    [1#1:2] at java.awt.Component.dispatchEventImpl()
    [1#1:2] at java.awt.Container.dispatchEventImpl()
    [1#1:2] at java.awt.Window.dispatchEventImpl()
    [1#1:2] at java.awt.Component.dispatchEvent()
    [1#1:2] at java.awt.EventDispatchThread.run()
    What's the problem?Can you help me?

  • Connect to Return channel: ERROR

    Hi everyone,
    I am testing return channel, using code as following:
    try {
    myRCInterface.reserve(null,null);
         myRCInterface.setTarget(new ConnectionParameters("1269", "vnn1269","vnn1269"));
         myRCInterface.connect();
    //...Here is something for exchange data beetwen receiver and server
    myRCInterface.disconnect();
         myRCInterface.release();
    catch(IncompleteTargetException e)
         System.out.println("IncompleteTargetException: " + e.getMessage());
    catch(PermissionDeniedException e)
         System.out.println("PermissionDeniedException: " + e.getMessage());
    When i test this code on DTT-4500 stb, error occurs just at line myRCInterface.setTarget(...): PermissionDeniedException:null
    I wonder if this code is wrong? or modem of my stb is fault?
    Please tell me why this error occurs?
    I also need help for DTT-4000 much. The function "Modem Test" of this stb always says "connected successfully" while dialing to any phone number (even unavailable numbers).
    What i know is that DTT-4500 are sold mainly in Italia. If someone in Italia or have used this stb, please tell me how to setup modem for it.
    Thanks alot,
    Nghia.

    hi,
    this is quite weird, because it looks like resource reservation did not succeed. but failure to reserve should be reported during the call to reserve().
    this looks pretty much like a bug in the stb (well, this is theoretically possible that something reserved the modem just after your reserve, but very unlikely), but maybe it has something to do with the NULL ResourceClient you pass to reserve() - i think you shouldnt do it, because behavior of reserve() with NULL argument is unspecified. I suggest you write something like
    myRCInterface.reserve(new ResourceClient() { void notifyRelease(ResourceProxy proxy) { ... } ... and so on.
    try this and see if it helps.
    is this is development stb or one from a store shelf? i wonder because later you may hit SecurityException, as access to modem is restricted to applications signed with a certificate, which you will not have unless you have a dev. stb. i dont know that stb, but you may lucky because mhp security model didnt actually survive in the italian dtt market, so maybe there wont be any problem.
    cheers

  • Starting event on a server from a STB via return channel - possible?

    Hello!
    I try to create an application in MHP to send an emergency-call via a STB.
    The STB is permanently connected to a server (intranet). Now I want to launch an event (popup-window, playing sounds, etc.) on the server via the STB.
    I thought of RPC, but didn't get it to work.
    I am able to write files on the server (via FTP). Is ist possible to monitor a directory and kick an event if a file is created?
    Thanks for help!

    It's certainly possilbe on the server side. This is more a question of how your server software is implemented and whether doing this imposes too much of a load on your server.
    I'm surprised that you couldn't get RPC to work. The return channel connection in an MHP box should support any IP traffic, although you will have to implement most of the protocol yourself.
    Steve.

  • MHP serial return channel

    Does anyone know how to use the serial port present in some set-top boxes?
    Is it a RS232 serial port?
    It's intended to provide a way of using other return device than a modem, but since the MHP spec. only defines that the return channel is a TCP/IP connection and the basic connection handle API, I don't know how to setthe return channel to be by the serial port.
    I also need direct access to it, not over TCP/IP, but using streams or something like. Has anyone written some code to talk to this port, or can indicate me som documentation references?

    There is requirement that an MHP box support an RS232 port, hence there are no standard API's to support it. All the Debug boxes I've seen use a serial port for debug (uploading xlets to debug are reading back trace messages written to standard out).
    If you want to use the return channel you'll need to look at the org.dvb.net.rc packages to set up the return channel. For example use:
    RCInterfaceManager.getInstance().getInterfaces();
    to find out what return channel hardware you've got attached to your STB. After you've set up the connection you can use the standard java.io and java.net packages to talk to your remote server.
    Hope this helps,
    Roger

  • Return channel in MHP

    Hello,
    I've connected a modem in my set-top-box and I want to connect the modem of my set-top-box with the modem of my computer. It's like communicating two computers (each with a modem) with a "hyperterminal".
    I think you know what I'm talking about... :)
    I use this code:
    public class RChannel implements Xlet, ResourceClient, ConnectionListener {
       public void initXlet(XletContext ctx) throws XletStateChangeException {
          try {
             ConnectionRCInterface cif = getConnectionRCInterface();
             cif.addConnectionListener(this);
             cif.reserve(this,null);                             
             cif.setTarget(new ConnectionParameters("67740", "user", "password", "10.95.32.4"));
             System.out.println("Trying to connect...");
             cif.connect();
             System.out.println("Connected?");
          catch (Exception e) {
             System.out.println(e);
    }Then, when I invoke: cif.connect(); I get a message tell me that the connection is established, but after somer seconds I get another message tell me that the connection was refused.
    I don't know why the modems cannot connect or why they disconnect after some seconds. Any idea?
    And how send and receive data in the modem of my set-top-box? How can I do it in MHP?
    Thanks in advance.

    The modem in the PC may be accepting calls, but does the STB need some special information in order to use it effectively? After all, the STB still needs to configure an IP address and networking information for the modem connection.
    It sounds to me like it's a problem where the modem is connecting (i.e. the call is being accepted by the PC) but then some other part of the process (authentication or IP address configuration) isn't working properly.
    It may be worth talking to the STB vendor and seeing if their MHP implementation has any special requirements on the call collector that's used for their STB. It's more common with closed middleware, but they may be able to provide some more information.
    Steve.

  • Does the 32C120U support Audio Return Channel?

    Hi,
    setting up my first home theater with a 32C120U & cannot find any reference in the manual to ARC.  May I assume then that the 32C120U does not support ARC?
    Basically trying to find out if a Toslink is required with a Yamaha RX-V373 receiver - all HDMI connections.
    thanks

    If they are mp3 you could change the settings for the files in iTunes to remember playback position by highlighting the files and rightclicking and going to "Get Info".   If not there are some apps such as OverDrive Media that will support downloading and playing audiobooks (some free at that) through services provided by some local libraries and OverDrive themselves.

  • Return channel, problems trying to connect

    Hello.
    I am trying to connect my STB and a local PC. I am using an internal modem in my PC in COM3 and my STB is a ADB. The modem tries to connect but then fails saying that the line is occupied but i make a call to reserve before. This is the debug exit:
    NET: (ppp) Preparing Dial-up connection with XT986473723...
    NET: (modem) dialing...
    MDM_GetLineStatus() MDM_LINE_IS_NOT_CONNECTED || MDM_LINE_IS_IN_USE
    NET: (modem) not connected.
    And this is the relevant code that I am using:
           RCInterfaceManager rcm = RCInterfaceManager.getInstance();
            RCInterface[] interfaces = rcm.getInterfaces();
            ConnectionRCInterface myInterface;
            myInterface = (ConnectionRCInterface)interfaces[0];
            try {
                myInterface.reserve(this,null);
            } catch (PermissionDeniedException e) {
                log("Permiso denegado al interfaz");
            ConnectionParameters myConnectionParameters;
            myConnectionParameters = new ConnectionParameters
            ("986473723", "username", "password");
            try {
                myInterface.setTarget(myConnectionParameters);
            } catch (IncompleteTargetException e) {
                log("Error: "+ e.getMessage());
            } catch (PermissionDeniedException e) {
                log("Error: "+ e.getMessage());
            try {
                myInterface.connect();
            } catch (IOException e) {
                log("Error: "+ e.getMessage());
            } catch (PermissionDeniedException e) {
                log("Error: "+ e.getMessage());
            }

    Do not connect your PC's modem directly to the STB's modem port. Use a mini PABX in the middle instead. You can find some for eur 100 or less. Make sure you program it to redirect number 0 or 1 to your PC's modem and use that number from your code.

  • OCAP Return Channel - Xlet Server Communication Problem??

    Hi,
    I am trying to connect Xlet to App Server. I have tried with the Socket and HttpURLConnection both are working fine but i am looking for OCAP API's only through which Xlet can commnicate with the App Server like MHP does.
    thanks

    Hello friends can we expect at least a interest here...

  • Soap Adapter Channel not found

    I'm having problems geting the Sender SOAP adapter to work.
    I'm using to test it 
    http://<XXXXXXXX>:50000/XISOAPAdapter/HelperServlet?action=FindChannel&channel=:SunriseSoftwareSostenuto:TimeSentSoap
    where <XXXXXXXX> is our domain
    but this returns channel not found
    SunriseSoftwareSostenuto is the Service
    TimeSentSoap is the communication channel
    I've already established that the Soap Adapter is active
    Is there something that I've missed ?

    hi
    I've tried to connect to the Soap adapter using
      http://xxxxxx:50000/XISOAPAdapter/MessageServlet?channel=:SunriseSoftwareSostenuto:TimeSentSoap
    Where SunriseSoftwareSostenuto is the business service and
                TimeSentSoap is the communication channel 
    but get the error code returned below
    I've tested the sender agreement/ communication channels config internally and they seem fine
    could someone point me in the right direction
    is it a java error
    or is it a authorisation problem?
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP:Body>
          <SOAP:Fault>
             <faultcode>SOAP:Server</faultcode>
             <faultstring>Server Error</faultstring>
             <detail>
                <s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
                   <context>XIAdapter</context>
                   <code>ADAPTER.JAVA_EXCEPTION</code>
                   <text>com.sap.aii.af.mp.module.ModuleException: either no channelID specified or no channel found for the specified party, service, and channel name, MessageServlet(Version $Id: //tc/xi/NW04S_21_REL/src/_adapters/_soap/java/com/sap/aii/af/mp/soap/web/MessageServlet.java#1 $)

  • Push Notification always gets a channel uri whether I use Identity from store or not

    I am trying to use push notification in my Windows 8.1 app using C#. I reserved an application name on Windows store, and used the Identity from the store. I faced a strange thing, When I open any new windows app project, and uses this code:
    PushNotificationChannel PushNotificationChannel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
    It always returns a valid PushNotificationChannel object with a Uri string. It shouldn't return this because I didn't use Identity from the store and didn't reserve an app name for it.
    Also, every time I change the Publisher string value in appmanifest file, and undo the change, the returned channel Uri changed.
    Very confusing two things:
    First, the app that is NOT using Identity from store shouldn't return a push notification channel !!
    Second, the app that uses Identity from store and has a reserved app name should always return the same Uri for the same Identity whether I changed Published string and undo the change !!
    Can any one help in this please ??!!

    Hi Ahmed,
    >>First, the app that is NOT using Identity from store shouldn't return a push notification channel
    Looks like there are some misconceptions here, ref to MSDN document:
    https://msdn.microsoft.com/en-us/library/windows/apps/hh913756.aspx
    Please focus on the first three steps in the complete data flow:
    1. Your app sends a request for a push notification channel to the Notification Client Platform.
    2. The Notification Client Platform asks WNS to create a notification channel. This channel is returned to the calling device in the form of a Uniform Resource Identifier (URI).
    3. The notification channel URI is returned by Windows to your app.
    So the request is made to the Notification Client Platform, which in turn requests the channel URI from WNS
    So far, it has no relevance to Store Identity, thus you can receive notification channel through the CreatePushNotificationChannelForApplicationAsync method.
    >>Second, the app that uses Identity from store and has a reserved app name should always return the same Uri for the same Identity whether I changed Published string and undo the change !!
    Quote from the above reference:
    We do not guarantee that the notification channel URI for an app will always remain the same. We advise that the app requests a new channel every time it runs and updates its service when the URI changes. The developer should never modify the channel
    URI and should consider it as a black-box string. At this time, channel URIs expire after 30 days.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • TV channel and application launching

    Hello to everybody,
    Does anybody know if it is possible to launch an xlet without the need of beeing previously broadcasted? I mean, Is it necessary having the broadcaster figure to run a MHP application in a real environment?
    What I am talking about is the possibility of running xlet in a STB as if I have PC application. Is it possible?
    Thank-you everybody
    Juanpa

    Built-in applications are supported by MHP (e.g. an MHP application that is put in to the box by the STB vendor). These can appear just like any other MHP application, although how you launch them is defined by the STB vendor - maybe through the same mechanism that you use for launching other (broadcast) applications, maybe not.
    MHP 1.1. does add support for storing applications on the receiver, but these must still be signalled in the broadcast stream and will usually be downloaded from the broadcast stream as well (downloading them over the return channel is possible, but I'm not sure how widely supported it would be).
    In theory, it would be possible to build a service that lets you download and store applications on your STB, but there are a number of things that make this impractical. Stored applications in MHP are normally intended to be used as a way of caching files to improve startup times, and so an application may get automatically deleted when the receiver needs more space. There is also the problem that stored applications may conflict with broadcast apps, and so there is the potential for a lot of interoperability problems. Finally, there is the basic problem that MHP 1.1 is not deployed anywhere at the moment, and there does not appear to be any major push towards launching it.
    Generally, there is no way of instaling or running an Xlet on your set-top box that does not rely on the broadcaster or the STB manufacturer (development systems are an obvious exception to this, and I'm not considering from the for now). Consumers downloading MHP xlets from a web site and installing them on their STB is not going to happen in the forseeable future.
    Steve.

  • How to download a file version from office 365 using csom

    I need to download an older file version from office 365 and get the data into a byte array. I have no trouble downloading the latest version with File.OpenBinaryStream() and I have no trouble loading the previous file versions with File.Versions. But now
    I need to actually download an older version of the file and it seems the only way is to use File.OpenBinaryDirect. So I am creating a client context using my oAuth access token and providing the correct path, but I am getting a (401) Unauthorized
    error. Looking with Fiddler I can see that the call to OpenBinaryDirect is somehow trying to post to my file URL and the server is responding with 401.
    context = TokenHelper.GetClientContextWithAccessToken(SPHostUrl, AccessToken);
    FileInformation info = File.OpenBinaryDirect(context, "/" + _fileVersion.Url);  //throws 401
    //leading slash required otherwise ArgumentOutOfRangeException
    I have to be able to access the older file versions with my c# code -- I don't have a viable app without that ability -- any help urgently needed and greatly appreciated!

    Thank you SO much (Can't wait for the next release)!
    For anyone else who lands here, here's the code I ended up using:
    // VersionAccessUser and VersionAccessPassword are stored in web.config
    // web.Url is loaded via the clientContext
    // myVersion is the FileVersion I got from the file's Versions.GetById() method
    // probably a lot of ways to get hostUrl, it just needs to be https://yourdomain.sharepoint.com/
    // - I'm running my app from a subweb
    // I had trouble following the links to get the full MsOnlineClaimsHelper code
    // (the one on msdn.com was missing RequestBodyWriter, WSTrustFeb2005ContractClient,
    // and IWSTrustFeb2005Contract
    // so I've included the code I used here.
    string myVersionFullUrl = string.Format("{0}/{1}", web.Url, myVersion.Url);
    string userName = WebConfigurationManager.AppSettings.Get("VersionAccessUser");
    string strPassword = WebConfigurationManager.AppSettings.Get("VersionAccessPassword");
    string hostUrl = Regex.Replace(web.Url, "([^/]+//[^/]+/).*", "$1");
    MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper(hostUrl, userName, strPassword);
    var client = new WebClient();
    client.Headers["Accept"] = "/";
    client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
    client.Headers.Add(HttpRequestHeader.Cookie, claimsHelper.CookieContainer.GetCookieHeader(new Uri(hostUrl)));
    var document = client.DownloadString(myVersionFullUrl);
    // These classes are needed to download old versions of files (see: http://social.msdn.microsoft.com/Forums/en-US/7746d857-d351-49cc-b2f0-496663239e02/how-to-download-a-file-version-from-office-365-using-csom?forum=sharepointdevelopment)
    // I cobbled this file from http://social.technet.microsoft.com/Forums/msonline/en-US/4e304493-7ddd-4721-8f46-cb7875078f8b/problem-logging-in-to-office-365-sharepoint-online-from-webole-hosted-in-the-cloud?forum=onlineservicessharepoint
    // and http://fredericloud.com/2011/01/11/connecting-to-sharepoint-with-claims-authentication/
    using Microsoft.IdentityModel.Protocols.WSTrust;
    using Microsoft.SharePoint.Client;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Net.Security;
    using System.ServiceModel;
    using System.ServiceModel.Channels;
    using System.Text;
    using System.Web;
    using System.Xml;
    using System.Xml.Linq;
    namespace DPSiDoxAppWeb.Helpers
    /// <summary>
    /// Create a new contract to use for issue claims for the SharePoint requests
    /// </summary>
    [ServiceContract]
    public interface IWSTrustFeb2005Contract
    [OperationContract(ProtectionLevel = ProtectionLevel.EncryptAndSign,
    Action = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue",
    ReplyAction = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue",
    AsyncPattern = true)]
    IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state);
    Message EndIssue(IAsyncResult asyncResult);
    /// <summary>
    /// Implement the client contract for the new type
    /// </summary>
    public class WSTrustFeb2005ContractClient : ClientBase<IWSTrustFeb2005Contract>, IWSTrustFeb2005Contract
    public WSTrustFeb2005ContractClient(Binding binding, EndpointAddress remoteAddress)
    : base(binding, remoteAddress)
    public IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state)
    return Channel.BeginIssue(request, callback, state);
    public Message EndIssue(IAsyncResult asyncResult)
    return Channel.EndIssue(asyncResult);
    /// <summary>
    /// Create a class that will serialize the token into the request
    /// </summary>
    class RequestBodyWriter : BodyWriter
    readonly WSTrustRequestSerializer _serializer;
    readonly RequestSecurityToken _rst;
    /// <summary>
    /// Constructs the Body Writer.
    /// </summary>
    /// <param name="serializer">Serializer to use for serializing the rst.</param>
    /// <param name="rst">The RequestSecurityToken object to be serialized to the outgoing Message.</param>
    public RequestBodyWriter(WSTrustRequestSerializer serializer, RequestSecurityToken rst)
    : base(false)
    if (serializer == null)
    throw new ArgumentNullException("serializer");
    _serializer = serializer;
    _rst = rst;
    /// <summary>
    /// Override of the base class method. Serializes the rst to the outgoing stream.
    /// </summary>
    /// <param name="writer">Writer to which the rst should be written.</param>
    protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
    _serializer.WriteXml(_rst, writer, new WSTrustSerializationContext());
    public class MsOnlineClaimsHelper
    #region Properties
    readonly string _username;
    readonly string _password;
    readonly bool _useRtfa;
    readonly Uri _host;
    CookieContainer _cachedCookieContainer = null;
    DateTime _expires = DateTime.MinValue;
    #endregion
    #region Constructors
    public MsOnlineClaimsHelper(string host, string username, string password)
    : this(new Uri(host), username, password)
    public MsOnlineClaimsHelper(Uri host, string username, string password)
    _host = host;
    _username = username;
    _password = password;
    _useRtfa = true;
    public MsOnlineClaimsHelper(Uri host, string username, string password, bool useRtfa)
    _host = host;
    _username = username;
    _password = password;
    _useRtfa = useRtfa;
    #endregion
    #region Constants
    public const string office365STS = "https://login.microsoftonline.com/extSTS.srf";
    public const string office365Login = "https://login.microsoftonline.com/login.srf";
    public const string office365Metadata = "https://nexus.microsoftonline-p.com/federationmetadata/2007-06/federationmetadata.xml";
    public const string wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
    public const string wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
    private const string userAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
    #endregion
    class MsoCookies
    public string FedAuth { get; set; }
    public string rtFa { get; set; }
    public DateTime Expires { get; set; }
    public Uri Host { get; set; }
    // Method used to add cookies to CSOM
    public void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e)
    e.WebRequestExecutor.WebRequest.CookieContainer = getCookieContainer();
    //e.WebRequestExecutor.WebRequest.UserAgent = userAgent;
    // Creates or loads cached cookie container
    CookieContainer getCookieContainer()
    if (_cachedCookieContainer == null || DateTime.Now > _expires)
    // Get the SAML tokens from SPO STS (via MSO STS) using fed auth passive approach
    MsoCookies cookies = getSamlToken();
    if (cookies != null && !string.IsNullOrEmpty(cookies.FedAuth))
    // Create cookie collection with the SAML token
    _expires = cookies.Expires;
    CookieContainer cc = new CookieContainer();
    // Set the FedAuth cookie
    Cookie samlAuth = new Cookie("FedAuth", cookies.FedAuth)
    Expires = cookies.Expires,
    Path = "/",
    Secure = cookies.Host.Scheme == "https",
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(samlAuth);
    if (_useRtfa)
    // Set the rtFA (sign-out) cookie, added march 2011
    Cookie rtFa = new Cookie("rtFA", cookies.rtFa)
    Expires = cookies.Expires,
    Path = "/",
    Secure = cookies.Host.Scheme == "https",
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(rtFa);
    _cachedCookieContainer = cc;
    return cc;
    return null;
    return _cachedCookieContainer;
    public CookieContainer CookieContainer
    get
    if (_cachedCookieContainer == null || DateTime.Now > _expires)
    return getCookieContainer();
    return _cachedCookieContainer;
    private MsoCookies getSamlToken()
    MsoCookies ret = new MsoCookies();
    try
    var sharepointSite = new
    Wctx = office365Login,
    Wreply = _host.GetLeftPart(UriPartial.Authority) + "/_forms/default.aspx?wa=wsignin1.0"
    //get token from STS
    string stsResponse = getResponse(office365STS, sharepointSite.Wreply);
    // parse the token response
    XDocument doc = XDocument.Parse(stsResponse);
    // get the security token
    var crypt = from result in doc.Descendants()
    where result.Name == XName.Get("BinarySecurityToken", wsse)
    select result;
    // get the token expiration
    var expires = from result in doc.Descendants()
    where result.Name == XName.Get("Expires", wsu)
    select result;
    ret.Expires = Convert.ToDateTime(expires.First().Value);
    HttpWebRequest request = createRequest(sharepointSite.Wreply);
    byte[] data = Encoding.UTF8.GetBytes(crypt.FirstOrDefault().Value);
    using (Stream stream = request.GetRequestStream())
    stream.Write(data, 0, data.Length);
    stream.Close();
    using (HttpWebResponse webResponse = request.GetResponse() as HttpWebResponse)
    // Handle redirect, added may 2011 for P-subscriptions
    if (webResponse.StatusCode == HttpStatusCode.MovedPermanently)
    HttpWebRequest request2 = createRequest(webResponse.Headers["Location"]);
    using (Stream stream2 = request2.GetRequestStream())
    stream2.Write(data, 0, data.Length);
    stream2.Close();
    using (HttpWebResponse webResponse2 = request2.GetResponse() as HttpWebResponse)
    ret.FedAuth = webResponse2.Cookies["FedAuth"].Value;
    ret.rtFa = webResponse2.Cookies["rtFa"].Value;
    ret.Host = request2.RequestUri;
    else
    ret.FedAuth = webResponse.Cookies["FedAuth"].Value;
    ret.rtFa = webResponse.Cookies["rtFa"].Value;
    ret.Host = request.RequestUri;
    catch (Exception ex)
    return null;
    return ret;
    static HttpWebRequest createRequest(string url)
    HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.CookieContainer = new CookieContainer();
    request.AllowAutoRedirect = false; // Do NOT automatically redirect
    request.UserAgent = userAgent;
    return request;
    private string getResponse(string stsUrl, string realm)
    RequestSecurityToken rst = new RequestSecurityToken
    RequestType = WSTrustFeb2005Constants.RequestTypes.Issue,
    AppliesTo = new EndpointAddress(realm),
    KeyType = WSTrustFeb2005Constants.KeyTypes.Bearer,
    TokenType = Microsoft.IdentityModel.Tokens.SecurityTokenTypes.Saml11TokenProfile11
    WSTrustFeb2005RequestSerializer trustSerializer = new WSTrustFeb2005RequestSerializer();
    WSHttpBinding binding = new WSHttpBinding();
    binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
    binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
    binding.Security.Message.EstablishSecurityContext = false;
    binding.Security.Message.NegotiateServiceCredential = false;
    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
    EndpointAddress address = new EndpointAddress(stsUrl);
    using (WSTrustFeb2005ContractClient trustClient = new WSTrustFeb2005ContractClient(binding, address))
    trustClient.ClientCredentials.UserName.UserName = _username;
    trustClient.ClientCredentials.UserName.Password = _password;
    Message response = trustClient.EndIssue(
    trustClient.BeginIssue(
    Message.CreateMessage(
    MessageVersion.Default,
    WSTrustFeb2005Constants.Actions.Issue,
    new RequestBodyWriter(trustSerializer, rst)
    null,
    null));
    trustClient.Close();
    using (XmlDictionaryReader reader = response.GetReaderAtBodyContents())
    return reader.ReadOuterXml();

Maybe you are looking for