none
Context references not resolved in query string part of action RRS feed

  • Question

  •  

    Hi,

     

    I have recently upgraded to CCF 2009 and am finding that default actions are not being executed as expected, at least not when they contain a reference to a context element.

     

    It is a simple session based hosted web application.  The behaviour is:

     

    * Open a session

    * Application is started

    * Home page Url is shown in browser control, default action has not been fired

    * Open CCF debugger

    * Force the default action on the hosted app, nothing happens

    * Fire the default action again, the action performs as expected

     

    Replace the %CustomerID reference with a literal value and it all works as expected.  I am going to trace the request/ responses to give a better indication as to what is actually going on.

     

    See below for Init string and action xml.

     

    Any help would be appreciated.

     

    Regards,

     

    Leon

     

    <?xml version="1.0" encoding="utf-16"?>
    <initstring>
      <homePage useNewProcess="True">www.google.com</homePage>
      <DataDrivenAdapterBindings>
        <Type>Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter.WebDataDrivenAdapter, Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter</Type>
        <Controls />
      </DataDrivenAdapterBindings>
    </initstring>

    <?xml version="1.0" encoding="utf-16"?>
    <ActionInit>
      <Url>http://www.google.com/search</Url>
      <QueryString>q=%CustomerID</QueryString>
      <Verb>GET</Verb>
    </ActionInit>

     

     

     

     

    Monday, January 19, 2009 10:11 AM

Answers

  •  

    Thanks Torsten,

     

    I can confirm this is a bug in that the first call to:

     

    HostedWebApplication.GetContextValue (string)

     

    causes the context to be lazily initialized but immediately after initialization the method returns null.  Only a subsequent call to this method results in the context being queried correctly.

     

    My workaround for this was to retrieve the hosted app instance from within a legacy adapter and call this method once (per instance of the adapter), before handing the action off to the base WebApplicationAdapter for normal processing.

     

    This causes the default action to work correctly.

     

    This has resulted in a nasty hack in my code.  Can you please let me have an issue number so I can track this fix in subsequent CCF releases?

     

    Leon.

     

     

    Tuesday, January 27, 2009 3:23 PM

All replies

  •  

    OK, I have traced my requests.

     

    Also note that I realised I had not removed the __ccfdata part of the the query string, so to get these requests I have used a legacy adapter that is initialized using:

     

    EmptyQueryStringData = true

     

    Additionally I have changed my app to use www.google.co.uk, otherwise I get a redirect that just confuses issues.

     

    So, the session starts and we see navigation to the apps homepage

     

    GET http://www.google.co.uk/ HTTP/1.1
    <snip>

     

    Then we see the default action being executed (so in contrast to what I thought was happening in my original post the default action is performed, but the context reference is not resolved)

     

    GET http://www.google.co.uk/search?q= HTTP/1.1

     

    our CustomerID context value at this point is:

    3DD0F63E-558A-DD11-A9A6-0003FF571A7E

    but as can be seen from the above request, it is empty in the query string

     

    You can then see a redirect from google, which is what happens when you enter www.google.co.uk/search?q=

    GET http://www.google.co.uk/webhp HTTP/1.1

     

    Force the default action via the CCF debugger, again we can see the incomplete query string

    GET http://www.google.co.uk/search?q= HTTP/1.1

     

    Finally, invoke the default action via the CCF debugger again, this time we see what we expect

    GET http://www.google.co.uk/search?q=3DD0F63E-558A-DD11-A9A6-0003FF571A7E HTTP/1.1

     

    At all stages the CCF debugger shows the correct CustomerID in the context


     

    Monday, January 19, 2009 1:46 PM
  • Hi Leon,

     

    there are two issues in CCF that prevent the correct execution of the Action you described.

     

    1. sometimes the default action doesn't get fired for a web application. We don't have a workaround for this but will work on a fix for the next release. One solution could be to create a small hosted control that will fire the Action.

     

    2. If you use a DDA, an Action expects an Automation reference in the init string. To fix this issue, you could either remove the adapter form the bindings (Adapter Configuration -> "Use no Adpater") or create an Automation (WF workflow) to navigate to the page. We also looking into a fix for this.

     

    -Torsten

     

    Tuesday, January 27, 2009 1:23 AM
  •  

    Thanks Torsten,

     

    I can confirm this is a bug in that the first call to:

     

    HostedWebApplication.GetContextValue (string)

     

    causes the context to be lazily initialized but immediately after initialization the method returns null.  Only a subsequent call to this method results in the context being queried correctly.

     

    My workaround for this was to retrieve the hosted app instance from within a legacy adapter and call this method once (per instance of the adapter), before handing the action off to the base WebApplicationAdapter for normal processing.

     

    This causes the default action to work correctly.

     

    This has resulted in a nasty hack in my code.  Can you please let me have an issue number so I can track this fix in subsequent CCF releases?

     

    Leon.

     

     

    Tuesday, January 27, 2009 3:23 PM
  • Hi Leon,

    Can you please advice or post the changes that you did to get this to work. I am facing similar issues. I would Like to use your method to resolve it.

    Regards,
    Suleman
    Tuesday, July 21, 2009 3:43 PM