locked
How to transfter to LiveId login page when a .net webservice method is invoked from JAVA application? RRS feed

  • Question

  • A .net application when built, it will redirects to the liveid login page, then to the default.aspx, and then to the healthvault PPE. But I am Invoking .net web service method from java. When the method is invoked form java, how should I redirect to the liveid login page, so that any data can be transferred to the healthvault PPE.
    Wednesday, January 6, 2010 8:00 PM

Answers

  • Hello Kumaresh,

    This looks like you are not able to use the PageOnPreLoad() method in your Java client as it is. I am not very familiar with Java programming. But I have an alternate suggestion to do the authentication.

    In your .web service class define a method similar to the one below.
            [WebMethod(EnableSession = true)]
            public string GetAuthenticationUrl()
            {
                return WebApplicationConfiguration.ShellAuthenticationUrl.ToString();
            }

    In the Java client call this method to retrieve the authentication URL. Then in the client you can do a redirection using this URL.
    Once the authentication is done the platform will return to the registered redirect URL.

    Please try this part and let me know if it works for you?

    Thanks and Regards,
    Aneesh D.
    Thursday, January 7, 2010 9:39 PM

All replies

  • Hello Kumaresh,

    As you are using Web Services you will not be deriving the class from HealthServicePage, that is why you are not automatically redirected to the HealthVault login page. In this case you can try using some code similar to the one below.

    [WebMethod]
    public string RedirectToHealthVault()
    {
          PersonInfo personInfo = WebApplicationUtilities.PageOnPreLoad(HttpContext.Current, true);

          return "DoneRedirection";
    }

    Please note that before using this code you have to add the required appsettings tags to the Web.config of the Web Service.

    Also after the redirection while returning from the shell it will be redirected to the action URL registered for the application ID. So you will have to register a valid URL for that and receive the token in this page.

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Wednesday, January 6, 2010 9:17 PM
  • Hi Aneesh and all,
    I get the following error, when I do as suggested by aneesh above:
    Exception in thread "main"

    javax.xml.ws.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Web.HttpException: Response is not available in this context.at System.Web.UI.Page.get_Response() in java application.

    I have created a Default.aspx, Redirect.aspx.
    I have coded as follows in a class

    UploadFile.cs:

    FileToUpdate(){

    XmlDocument

    ccdDocument = new XmlDocument();
    ccdDocument.Load(
    @"D:\Kumaresh\CreateFile.xml");
    PersonInfo personInfo = WebApplicationUtilities.PageOnPreLoad(HttpContext.Current, true);
    HealthRecordItem ccd = new HealthRecordItem(CCD_THING_GUID, ccdDocument);
    PersonInfo.SelectedRecord.NewItem(ccd);
    }
    My WebService method:
    [WebMethod]
    public string Test (string x)
    {
        UploaodFile uF = new UploadFile();
        uF.FileToUpdate();
    }

    I am unable to redirect to liveid login page. Where should I correct my code?

    Wednesday, January 6, 2010 10:41 PM
  • Hello Kumaresh,

    This looks like you are not able to use the PageOnPreLoad() method in your Java client as it is. I am not very familiar with Java programming. But I have an alternate suggestion to do the authentication.

    In your .web service class define a method similar to the one below.
            [WebMethod(EnableSession = true)]
            public string GetAuthenticationUrl()
            {
                return WebApplicationConfiguration.ShellAuthenticationUrl.ToString();
            }

    In the Java client call this method to retrieve the authentication URL. Then in the client you can do a redirection using this URL.
    Once the authentication is done the platform will return to the registered redirect URL.

    Please try this part and let me know if it works for you?

    Thanks and Regards,
    Aneesh D.
    Thursday, January 7, 2010 9:39 PM