7 Replies Latest reply: May 17, 2013 7:25 PM by Sara Woodhull-Oracle RSS

    Getting VALID_GUEST icxSession using Ebusiness Suite SDK session management

    mkohanek
      Hi all

      I have the following use case. My first question would be - is the ebusiness SDK appropriate for this use case in the first place?
      I am trying to provide order invoices to customers on the web. I have an OAF page we use internally to view the pdfs. The plan is to use this page basically as a web service that provides the pdf to my application (sending users to the actual page is of course not desirable). So I am building a mid-tier RESTful web service that will hit the appropriate OAF page url, and take the input and pass it to an external app.
      Of course, to access the OAF page, I need a valid icxSession. Previously, I was able to get a valid session by calling some of the icx functions through a PL SQL call. Then I extract and pass the $TWO_TASK cookie, and use it in my call to the OAF page. I then pass along the pdf I get from the OAF page as a Response. I had this working. But I understand the icx PL SQL functions are (or will soon be) deprecated, so I am trying to avoid using them if possible. And so, now I have been trying to use the Ebusiness SDK.
      Is this a valid use of the SDK? I know the icx PL SQL functions are being deprecated and all, but how valid would using them be as a backup plan?

      Here is my experience so far with the SDK.
      I have registered the nodes, setup profile options, created the AppDataSource, and everything else in the steps found in the pdf manual (titled Oracle E-Business Suite Software Development Kit for Java). I have integrated some code into my RESTful service to use the fndext.jar(I am using Jersey by the way). Right now, I can instantiate the EBiz object with the APPL_SERVER_ID from my desktop dbc file, create the AppsRequestWrapper and Session. However, I am getting a session as a guest, not a VALID session as the new user I created with the UMX|APPS_SCHEMA_CONNECT role. I believe I have my app and the EBS instance on the same domain, so I do not think that is the problem. Could there be other reasons for this problem? Some steps to troubleshoot this would be wonderful - note I am developing the service in Eclipse, and not JDeveloper though.

      So of course with a guest session, I cannot access the page. However, I have found that is I use Session.convertGuest() and pass in the user name of the user with the UMX|APPS_SCHEMA_CONNECT role, that I can now get the icx cookie value, and successfully use it to get the pdf data as I was before. So it is working like this, I am just not sure it is good practice. I expected to not need to use convertGuest at all - I thought I would have a VALID session immediately. Can someone confirm this for me - should I indeed have a VALID session as soon as I instantiate the EBiz object and create the session? Or is a VALID_GUEST session the intended initial session?

      My last question is about the HttpServletRequest and HttpServletResponse objects I pass in to instantiate AppsRequestWrapper. I have not been able to find an example of this used in a RESTful web service. So to get these objects, I am using the following:

      private @Context HttpServletRequest request;
      private @Context HttpServletResponse response;

      Does this seem correct, or should I be doing this some other way?

      Thanks very much

      edit - one other thing. In the documentation, it talks about editing your hosts file:

      "1. Open C:\WINDOWS\system32\drivers\etc\hosts file on notepad. Then replace the
      line 127.0.0.1 localhost with #127.0.0.1 localhost 127.0.0.1 myapp.us.oracle.com"

      I am not sure how to decipher this. It seems to be telling me to replace
      127.0.0.1 localhost
      with
      #127.0.0.1 localhost 127.0.0.1 mydomain.com

      All on the same line... I don't know everything about the hosts file and how it works, but wouldn't that just be a commented out line?
      Are the instructions perhaps trying to say to replace
      127.0.0.1 localhost
      with two lines:
      #127.0.0.1 localhost
      127.0.0.1 mydomain.com

      That seems to make more sense to me, but I wanted to clarify since it is not clear in the pdf.

      Edited by: mkohanek on Mar 14, 2013 11:33 AM

      Edited by: mkohanek on Mar 14, 2013 12:24 PM