Extra session created after cURL call

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Extra session created after cURL call

joostvanrijn
Hey all,

We're trying to call an XPL with POST data. It works flawlessly when we submit a simple PHP-form, but here is what happens when we use the (desired) cURL function:

1: Session gets created and stored (this is good).
2: XPL redirects to appropriate index page (this is also good)
3: index page checks if the logged in user has privileges to open that page (also good)
4: Here's the weird part: In the debug we can see that Orbeon creates another session, before executing anything from the get-session.xpl:
               
                INFO  OrbeonSessionListener  - Session Listener - Session created.
       
        Since this new session has been created the get-session.xpl of course can't find the relevant data (like security-role) that were saved in the previous session and thus the script redirects the user back to the "logged out" screen.

If we do a GET or actual HTML form post, there are no problems and we get to the correct index page.

Here's the relevant  (PHP) curl code:

  $ch = curl_init("localhost/our-orbeon-app/start");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_BINARYTRANSFER, false);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    
  curl_setopt($ch, CURLOPT_POSTFIELDS, 'znum=691654&pnum=1876459&role=somerole&securitycode=ftyiuow5hfy89346789fh98');

        $result = curl_exec($ch);
        curl_close($ch);
  echo $result;

Is it at all possible to call an Orbeon XPL with (PHP) cURL, or do we have to fake a form and auto-submit that to the XPL?

Thanks,

Joost van Rijn

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Extra session created after cURL call

Erik Bruchez
Administrator
Joost,

Are you using Tomcat? And do you have BASIC authentication configured?

-Erik

On Mon, Oct 10, 2011 at 6:18 AM, Joost van Rijn <[hidden email]> wrote:

> Hey all,
>
> We're trying to call an XPL with POST data. It works flawlessly when we submit a simple PHP-form, but here is what happens when we use the (desired) cURL function:
>
> 1: Session gets created and stored (this is good).
> 2: XPL redirects to appropriate index page (this is also good)
> 3: index page checks if the logged in user has privileges to open that page (also good)
> 4: Here's the weird part: In the debug we can see that Orbeon creates another session, before executing anything from the get-session.xpl:
>
>                INFO  OrbeonSessionListener  - Session Listener - Session created.
>
>        Since this new session has been created the get-session.xpl of course can't find the relevant data (like security-role) that were saved in the previous session and thus the script redirects the user back to  the "logged out" screen.
>
> If we do a GET or actual HTML form post, there are no problems and we get to the correct index page.
>
> Here's the relevant  (PHP) curl code:
>
>        $ch = curl_init("localhost/our-orbeon-app/start");
>        curl_setopt($ch, CURLOPT_POST, 1);
>        curl_setopt($ch, CURLOPT_BINARYTRANSFER, false);
>        curl_setopt($ch, CURLOPT_HEADER, 0);
>        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
>        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>        curl_setopt($ch, CURLOPT_POSTFIELDS, 'znum=691654&pnum=1876459&role=somerole&securitycode=ftyiuow5hfy89346789fh98');
>
>        $result = curl_exec($ch);
>        curl_close($ch);
>        echo $result;
>
> Is it at all possible to call an Orbeon XPL with (PHP) cURL, or do we have to fake a form and auto-submit that to the XPL?
>
> Thanks,
>
> Joost van Rijn
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws