1 Reply Latest reply on Oct 26, 2012 6:47 AM by airdrive

    Stateful web service implementation in Flex 2

      Hello Gurus,

      We are trying to invoke a web service located on a remote server using MXML to create a purchase order. One of the requirements is that we pass a cookie from our end to this web service for authentication and session management purposes. Can anyone throw some pointers on passing cookie information to webservices from MXML or ActionScript?

      A little bit of research resulted in the following link:
      http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/ wwhelp.htm?context=LiveDocs_Parts&file=rpc_26.html

      An extract from the above document states the following:

      "Stateful web services
      Flex uses Java server sessions to maintain the state of web service endpoints that use cookies to store session information.

      But unfortunately there are no examples on how to pass the cookie information itself. Any pointers are appreciated . Thanks much!
        • 1. Re: Stateful web service implementation in Flex 2

          This issue caused me much confusion and delay, so I hope that what I am about to say is correct.  When Flex calls a web service that requires a stateful connection, the web service "cookie" is stored in the browser.  Flash automatically attempts to access this cookie value, and returns it to the web service when additional web service operations are called.  The cookie value will be placed in the "Request Headers".


          A couple issues that gave me fits:

          1.  Safari browser on Mac had default "/preferences/Privacy/Block cookies" set to "From third parties and advertisers".  This was preventing the cookie from being sent.  I had to change this setting to "never".

          2.  I work inside the Flash API.  Testing my movie never passed the cookie value back, and I have not figured out how to do this when compiling for Flash Player.

               - NOTE: I am able to test compiling as an Adobe Air App just fine.  I did this to get my web service calls/parsing of returned info correct first.  Cookie issue and Cross Domain issues are not issues in Adobe Air, so I find this is a good place to get the web service working.  After working compiling as Adobe Air, switch to compile for Flash Player to fine tuning other issues.

          3. Cross Domain issues.  Lots of posts on this.  Pay close attention.