Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

OBIEE Go Url using HTTP Client Java

Received Response
11
Views
4
Comments
3065283
3065283 Rank 1 - Community Starter

Hello Team,

I am developing a JAVA application which will fetch and save OBIEE dashboards as PDF with some parameters in local file system. I understand that it is achievable using GO URL

Example:

https://aaaa:yyyy/analytics/saw.dll?Dashboard&NQUser=AAAA&NQPassword=BBBB&Action=Print&PortalPath=%2Fshared%2FTest%2F_portal%2FPopulation&Page=India&Format=pdf&P0=3&P1=eq&P2=%22Current%20Date%22.%22Year%20%28yyyy%29%22&P3=2016&P4=eq&P5=%22Current%20Date%22.%22Calendar%20Month%22&P6=%22August%22&P7=eq&P8=%22Client%22.%22Parent%20Region%20Name%22&P9=%22India%22

However, unfortunately, I am unable to create HTTP client to display PDF results. GET or POST request s are displaying response as HTML with content of signing in in page.

If I use the same URL in the browser then it works fine and display PDF report. I observed that when I copy past this URL in browser and press enter then the request header sends below cookies a part of request

ORA_BIPS_LBINFO=15aa813ce2f;

ORA_BIPS_NQID=ftlv6jn555550h7l1jv4sbhhhhhh2d2710d0qc5epunh9pi8b7jkb;

I am clue less from where request is getting these cookies? I am sending credentials a part of request.

Please help to provide a sample code to implement this requirement.

Thanks

Answers

  • What's the full request headers your java client send?

    I guess you are missing some and that's why you end up on the login page, so post all the headers of your request and let's see what you are missing

    PS: do you agree your client can follow redirect and send back the cookies it received, right?

  • AnkitNigam
    AnkitNigam Rank 1 - Community Starter

    Thanks Gianni.

    I am using below headers:

    POST /analytics/saw.dll?Dashboard HTTP/1.1

    Host: aaaa:yyyy

    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0

    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    Accept-Language: en-GB,en;q=0.5

    Accept-Encoding: gzip, deflate

    Referer: 

    https://aaaa:yyyy/analytics/saw.dll?Dashboard&NQUser=AAAA&NQPassword=BBBB&Action=Print&PortalPath=%2Fshared%2FTest%2F_portal%2FPopulation&Page=India&Format=pdf&P0=3&P1=eq&P2=%22Current%20Date%22.%22Year%20%28yyyy%29%22&P3=2016&P4=eq&P5=%22Current%20Date%22.%22Calendar%20Month%22&P6=%22August%22&P7=eq&P8=%22Client%22.%22Parent%20Region%20Name%22&P9=%22India%22

    And redirecting using code:

    HttpClient client = HttpClientBuilder.create()

      .setRedirectStrategy(new LaxRedirectStrategy()).build();

  • Hi,

    Not sure you are the same person or just 2 different having the same exact question and code

    Actually the answer is correct, it's HTML!

    You can keep it as a GET request, that's what the system expect, and if you do it in your browser what do you observe?

    You first see a spinning "login" image and then, depending on how fast your login is, you have the PDF on your screen.

    I was maybe just lucky enough to test on a really busy server so the login took 30 seconds and I could clearly see the code.

    Look at this piece of code:

    <script type="text/javascript">window.onload=function(){     onLoggingInPageLoad('saw.dll?Dashboard',          {"Page":"Standard Visuals","Action":"Print","PortalPath":"/shared/02. Visualizations/_portal/2.10 Vanilla and Configured Visuals","caj_token":"J-u1pMiNUIA","Format":"pdf"}     );};</script>

    It's included in the HTML code you get back.

    So it's a piece of javascript doing a redirect or something like that once the session is open, so after using your NQUser and NQPassword to authenticate you.

    No idea if your JAVA can actually understand and execute javascript to simulate the browser behaviour, but I will say an easiest solution is the following:

    1) you call your actual link (or even just the OBIEE homepage link) passing NQUser and NQPassword

    2) you take all the cookies you get back and keep them

    3) you call the real link with action=print and format=pdf but without NQUser and NQPassword sending all the cookies of point 2

    4) you get your PDF directly back, nothing else in between

    In other words: first you have to open a valid session, that's what NQUser and NQPassword will always do (so even if a session already exists these 2 params will do a login again), then you call the real link you need.

    Done! Works just fine

    If you got what you were looking for you can maybe close the thread and mark as required to help other users of the forum with similar questions finding something that can help them.

  • AnkitNigam
    AnkitNigam Rank 1 - Community Starter

    Thanks Gianni. Let me try as you suggested.