5 Replies Latest reply: Oct 21, 2013 9:43 AM by Sujan Kumar Paidiapala RSS

    Handling Cookies in BPEL

    1048378

      Hi All ,

       

      Can anyone help me on the below .

       

      We have a scenario , where we have to invoke two restful ws , first URL is login URL and second is businees URL , for the first they have provided username and password to login with that we able to login and after that we have to invoke the business URL with in the scope , but here BPEL is not storing the credentials in cookies and we are getting message 'not logged in' from business URL when we try invoke .

       

      Can BPEL handle Cookies , is there any doc on this ?

       

      Regards,

      Avinash

        • 1. Re: Handling Cookies in BPEL
          vladodias

          Hi Avinash,

           

          I don't think BPEL will support that model of security design... Cookies are designed to be stored in a browser... BPEL is a server side component...

           

          Cheers,

          Vlad

          • 2. Re: Handling Cookies in BPEL
            1048378

            Hi Vlad ,

             

              Thank you for the response , can you please help me on this

             

              Now after invoking login URL with the credentials provided they are sending response as "Success" in the body of the response and SessionId in the Header of the Response , with that SessionId i can able to invoke the next business URL , can you please let me know how to capture the SessionId in the response and assign it to a temp variable .

             

            Regards,

            Karthik

            • 3. Re: Handling Cookies in BPEL
              Sujan Kumar Paidiapala

              Hi Avinash,

               

              im not expert in this. but trying to think about your issue.

               

              Point 1. why can't you directly invoke your business URL by adding policies to provide the credentials.

               

              Point 2. any how if you need to hit both the URLs, Java embedding can be useful for you to get the session id from first URL invocation. From there u can get the session id to BPEL Variables.

               

              Thanks

              Sujan

              • 4. Re: Handling Cookies in BPEL
                1048378

                HI Sujan ,

                 

                I using Java embedding activity only for both URLs , in the first activity we are invoking login URL with the credentials they have provided and it was successful  and in the second activity we have to invoke second URL for which they haven't given any credentials separately , in this we have capture the cookie from first URL response and we have to pass that cookie to the second URL to invoke successfully ,

                 

                From First Invoke response we are getting three types of responses

                 

                1) Body : in this we will get success or failure messages

                2) Cookies : in this we will get the SessionId which to capture and assign it to temp variable

                3) Headers : we will get the details which are not useful .

                 

                Now is there a way to capture the cookie from the response and assign it to a temp variable?

                 

                 

                Regards,

                Karthik

                • 5. Re: Handling Cookies in BPEL
                  Sujan Kumar Paidiapala

                  i think u can try it in this way.

                   

                  Create a class with 2 methods to call your services

                   

                  CallURL1(); should return your cookie to your caller.

                  CallURL2(cookie) ; should be able to take the cookie

                   

                  Have a java embedding in BPEL.

                   

                  Create object to ur class.

                  get the cookie by calling first method.

                   

                  if you want

                  then assign it to bpel variable if you want to use it in BPEL by using below method in java embedding.

                  setVariableData("BPEL Variable",MethodResponseVariable);


                  or else

                  You can even directly call other method in the embedding itself by passing cookie to the method.


                  Let me know if its helpful.


                  Thanks

                  Sujan