Topic
6 replies Latest Post - ‏2013-01-09T15:13:09Z by mburati
SystemAdmin
SystemAdmin
9029 Posts
ACCEPTED ANSWER

Pinned topic Adding an iFrame to a portlet

‏2013-01-07T12:29:13Z |
We are adding an iFrame in a portlet html, as shown below:

1. Compliance by owning organization


Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam
cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at,
laoreet mattis, massa. Sed eleifend nonummy diam.


<iframe id="iFrame1" index="1" name="iFrame1"
src="https://zcogwasd1.boulder.ibm.com/transform/bacc/cognos/bi01n/ServletGateway/servlet/Gateway?b_action=cognosViewer&ui.action=run&ui.object=/content/folder/folder/report&ui.name=Overall Compliance&run.outputFormat=&run.prompt=true"
width="40%" height="500" scrolling="no" style="overflow-x:hidden"> </iframe>


The url redirects us to a login page within the iFrame, after supplying the credentials we get an error, which indicates that the supplied credentials are not reaching the server and hence we don't get the information back.

When we use the same code in an independent html page and run on a browser, it works fine.

So we suspect that when we use the iframe within a portlet, the login info is getting missed.

Any help will be appreciated.
Updated on 2013-01-09T15:13:09Z at 2013-01-09T15:13:09Z by mburati
  • mburati
    mburati
    2392 Posts
    ACCEPTED ANSWER

    Re: Adding an iFrame to a portlet

    ‏2013-01-07T13:34:00Z  in response to SystemAdmin
    Is it possible that you're not hitting the portal with the same URL prefix that you're using in the iframe? If the URL hostname doesn't match (eg, you're using localname instead of fully qualified DNS name) then the browser is likely just not sending the session and authentication cookies along with the iframe request that it thinks is a different server).

    I hope that info helps,
    ..Mike Burati
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: Adding an iFrame to a portlet

      ‏2013-01-08T07:49:56Z  in response to mburati
      Hi,

      I am not able to understand this:

      Is it possible that you're not hitting the portal with the same URL prefix that you're using in the iframe?
      Within the iFrame we are using a cognos server url (fully qualified name) and the portal is deployed on another server.
      So both are on different servers.
      • mburati
        mburati
        2392 Posts
        ACCEPTED ANSWER

        Re: Adding an iFrame to a portlet

        ‏2013-01-08T14:53:24Z  in response to SystemAdmin
        Your iframe URL above is: https://zcogwasd1.boulder.ibm.com/...

        So your browser is only going to send the cookies associated with your session and authentication information if the URL that was used to obtain those cookies matches that URL prefix. If you log into the portal with http://localhost/wps/portal or a partial hostname like https://zcogwasd1/wps/portal
        then the URL prefix that the iframe is using won't match the URL prefix used to obtain the cookies so the browser won't forward them in the iframe request.

        You should be able to monitor the http headers (including cookies) being received/sent via a browser debugger like Firebug, Chrome Debugger or IE Dev tools, or with a logging proxy like Fiddler.

        I hope that info helps,
        ..Mike Burati
        http://www-10.lotus.com/ldd/pfwiki.nsf/
        The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
        • mburati
          mburati
          2392 Posts
          ACCEPTED ANSWER

          Re: Adding an iFrame to a portlet

          ‏2013-01-08T15:53:17Z  in response to mburati
          Sorry, my window was so small I only saw your first two response comments when I responded, and not your last one stating that these are two different servers.

          Unless you have a security proxy in front of them, I'm not sure how you're expecting the browser to send the security cookies/tokens to the other server. Without knowing more about your server/proxy configuration, it's hard to say how that would/should work.

          When you tried this with a simple HTML page, what server was that simple HTML page on and what server (and when) were you doing the authentication?

          Are you using WEF to build this portlet? (I ask since this is a WEF forum, but WEF developers don't tend to use iFrames to other servers, but rather use integration builders to pull back data from other servers and then manipulate it in the portlet and then generate a UI for it).

          I hope that info helps,
          ..Mike Burati
          http://www-10.lotus.com/ldd/pfwiki.nsf/
          The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
          • SystemAdmin
            SystemAdmin
            9029 Posts
            ACCEPTED ANSWER

            Re: Adding an iFrame to a portlet

            ‏2013-01-09T09:32:31Z  in response to mburati
            I ran the html file directly in browser and didn't deploy it on any server. The login screen comes in the Iframe and after supplying the credentials, I can see the content. Attached is the screenshot.

            Yes, this portlet is created using WEF 8.0, I tried to use the iFrame builder, but that too doesn't work.

            Please let me know what integration builders can we use to pull the data from other servers?
            • mburati
              mburati
              2392 Posts
              ACCEPTED ANSWER

              Re: Adding an iFrame to a portlet

              ‏2013-01-09T15:13:09Z  in response to SystemAdmin
              I may have misunderstood your original question - I had thought you were expecting that since you're logged into portal that you would already be logged into the remote server that the iframe is accessing.

              Re-reading your original question, it looks like you're expecting to have to log into the remote server that it's accessing and that for some reason that remote authentication is failing only when that iframe is in a portlet. If that's your actual question, then sorry I misunderstood it the first time.

              If that's the case, then I suggest using a browser debugger and/or a proxy like Fiddler to watch what's going back and forth between the browser and the remote server in the working and non-working case, to see what's different.

              As far as using WEF to retrieve data from another server, there are many integration builders (including DBs, 3rd party apps etc), but the generic ones for appservers are the Web Service Call and Web Service MultiOperation builders (for WSDL/SOAP based web services) and the REST Service call builder (for simple HTTP based REST services/URLs).

              If you're new to WEF then I suggest going through the learning roadmap tutorials and videos found via the WEF Wiki below.
              I hope that info helps,
              ..Mike Burati
              http://www-10.lotus.com/ldd/pfwiki.nsf/
              The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.