Problem passing multiple parameters through actionqs

May 18, 2011 at 5:25 AM
Edited May 18, 2011 at 5:25 AM

Our application would like to pass two parameters through actionqs back to us. But our second parameter is dropped when we get the response. We hope to use the standard way to pass these parameters. What could we do?

Our app calls the shell like this:

https://account.healthvault-ppe.com/redirect.aspx?target=AUTH&targetqs=?appid=blablabla%26redirect=http://localhost:8080/myapp%26actionqs=myParamOne=MyValueOne&myParamTwo=MyValueTwo

 

The redirect from the shell is like this:

http://localhost:8080/myapp?target=AppAuthSuccess&actionqs=myParamOne%3dMyValueOne&wctoken=blablabla

I think that the last & may be the problem. I also tried %26 without any luck. What could I do?

Thanks in advance,

May

Coordinator
May 18, 2011 at 4:27 PM
Edited May 18, 2011 at 7:46 PM

Hi May,

This type of question that isn't directly related to the Java SDK is better asked at the HealthVault forums here.  They have a number of people that can answer questions.

That said, the actionqs parameter will be appended to your redirect URL in it's entirety.  You can include a path and/or query parameters.  I bolded your actionqs parameter below:

https://account.healthvault-ppe.com/redirect.aspx?target=AUTH&targetqs=?appid=blablabla%26redirect=http://localhost:8080/myapp%26actionqs=myParamOne=MyValueOne&myParamTwo=MyValueTwo. 

Query string parameters are separated by the "&" character.  Url parsing treats the string myParamTwo=MyValueTwo as a separate query string parameter to the redirect.aspx page and is not releated to the actionqs paramter. 

My suggestion is to use the following pseudo-logic:  Note the use of Url encoding.

String actionqsString = URLEncoder.encode("/a/path/to/somewhere?myParamOne=MyValueOne&myParamTwo=MyValueTwo");

String targetqsString = URLEncoder.encode("appid=blablabla&redirect=http://localhost:8080/myapp&actionqs=" + actionqsString);

String redirectString = "https://account.healthvault-ppe.com/redirect.aspx?target=AUTH&targetqs?" + targetqsString;

In the end you will be redirected to "http://localhost:8080/myapp/a/path/to/somewhere?myParamOne=MyValueOne&myParamTwo=MyValueTwo".

Edit: 

To be fair, HealthVault redirects you to your redirect url with target=AppAuthSuccess&actionqs=%2fa%2fpath%2fto%2fsomewhere%3fmyParamOne%3dMyValueOne%26myParamTwo%3dMyValueTwo&wctoken=ADAC64...

Typically, your action page will parse the actionqs and forward the parameters along.  Many action pages issue a redirect to the final destination.

--Rob

May 18, 2011 at 11:57 PM

Thanks Rob for the quick reply. I tried your suggestion and the encoding worked for the second parameter. but I still do not get the correct redirect. I will post to the HealthVault forum as you suggested and see what answers I get.

With the following response, I need to process the response and do another redirect to the correct page:

http://localhost:8080/mayapp/?target=AppAuthSuccess&actionqs=/a/path/to/somewhere?myParamOne=MyValueOne&myParamTwo=MyValueTwo. 

Thanks,

May

Coordinator
May 19, 2011 at 3:48 PM
Edited May 19, 2011 at 3:48 PM

Hi May,

What is the correct result you are looking for?  What did you get? The logic above should be correct. 

Yes, it is up to your application to process the AppAuthSucess action and continue on according to the actionqs.

--Rob

May 19, 2011 at 5:44 PM

Hi Rob,

    I am looking for a redirect to "http://localhost:8080/myapp/a/path/to/somewhere?myParamOne=MyValueOne&myParamTwo=MyValueTwo". With the extra action page your recommended, I am all fine now. Thanks!

May