Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Authenticate and Execute FEX using single URL in MRE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Authenticate and Execute FEX using single URL in MRE
 Login/Join
 
Member
posted
I am trying to create a URL that would authenticate to MRE as well as execute a specified FEX. This is so that I can call this URL from a java app without having to maintain cookies in java. Any thoughts?
 
Posts: 9 | Location: Boston | Registered: April 25, 2005Report This Post
Virtuoso
posted Hide Post
Why not call the report via a web service (webfocus web service enablement option).
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Web services is not an option according to our company's WebFOCUS host. We use a shared WebFOCUS environment and for some reason they do not allow the web services option.

I did, however, manage to figure out a solution. I ended up creating a java class that is able to establish an authenticated connection using http (essentially does what we would do manually through a browser) and manages the session cookies provided by the MRE. After a connection is established, I can call upon it to execute any number of reports I want and can get the output in a number of formats.
 
Posts: 9 | Location: Boston | Registered: April 25, 2005Report This Post
Master
posted Hide Post
anush, can you post you java code or at lease email me a copy that. Scott_Wanner@ibi.com
 
Posts: 865 | Registered: May 24, 2004Report This Post
Member
posted Hide Post
OK... there actually IS a way to authenticate and execute from MRE.
You need to use the IBIMR_drill=RUNNID param for
this to work. Here's an example:
http://<server>:
29400/ibi_apps/WFServlet?
IBIMR_action=
MR_RUN_FEX&IBIMR_sub_action=
MR_STD_REPORT&
IBIMR_domain=&
IBIMR_folder=%<folder>&IBIMR_fex=
<fex>&IBIMR_drill=RUNNID&IBIMR_user=
<user>
&IBIMR_pass=<password> 
I incorporated this
into my
code
as well. Note that the WebFocusConnector
class has 2 methods of
executing reports.
First method (session-less
connection) uses the drill param mentioned above.
This way, it
does not have to maintain MRE
cookies.
Second method uses a session-
based
connection i.e. it
maintains the
MRE cookie. This allows you
to send the user &
pass just once and following that,
execute as many
reports as you want
without having to pass credentials each and every time. Here's the code:
import java.io.IOException;
import java.io.
InputStream;import java.io.UnsupportedEncoding
Exception;i
mport java.net.URLEncoder;
import org.apache.commons.
httpclient.
Cookie; import rg.aache.commons.
httpclient.
HttpClientimport org.apache.commons.
httpclient.
HttpException; import org.
apache.commons.
httpclient.
HttpMethod; import org.apache.commons.httpclient.
HttpState;import org.apache.
commons.httpclient.
NameValuePair;
import org.apache.commons.http
client.methods.
GetMethod; import org.apache.log4j.
Logger; This class allows 
for an authenticated 
connection to a WebFOCUS * 
Managed Reporting Environment 
enabling the execution of secure * 
WebFOCUS reports. * @author 
Anush Ramanipublic class WebFocus
Connector  static 
final String SERVLET_TOKEN= 
"ibi_apps/WFServlet"
static final String S
IGNON_TOKEN	
= "IBIMR_action=MR_SIGNON";
static final String USERID_TOKEN= 
"IBIMR_user" static final String 
PASSWORD_TOKEN	= "IBIMR_pass";
static final String 
DOMAIN_TOKEN	= 
"IBIMR_domain";  
static final String REPORT_TOKEN= IBIMR_action=MR_RUN_FEX&I
BIMR_sub_action=MR_STD_REPORT&
IBIMR_fex";
static final String FOLDER_
TOKEN	= "IBIMR_folder";static 
final String DRILL_TOKEN= 
"IBIMR_drill=RUNNID";  static final 
String AUTH_COOKIE = "MR_COOKIE";   
static final int AUTH_SUCCESS = 0;
static final int AUTH_FAIL= -1;    
static Logger log 
=ogger.getLogger(WebFocus
Connector.class);Server 
information private String server;
private int port; // 
User credentials  private String 
userId;  private String 
password;private String 
sessionBasedURL;  private 
String 
sessionLessURL;  
private HttpClient client;
private HttpMethod method;   
private boolean 
isConnected = false;  
@param server WebFOCUS server name 
(can be either IP or hostname).* 
@param portWebFOCUS server's 
communication port number. @param userId MRE user's login ID.@param passwordMRE user's 
password. * @param establishSession 
If <code>true</code>, an attempt 
will be made to created an authenticated session. If <code>false</code>, 
reports will be executed in a 
session-less method.  
 public WebFocusConnector
(String server, 
int port, String userId, 
String password, boolean 
establishSession)    
this.server = server; 
this.port = port;       
this.userId = userId;  
this.password = password;
 client = new HttpClient()       if(establishSession)          connect();sessionBasedURL = 
"http://" + server + ":" + 
port + "/" + SERVLET_TOKEN + "?";        sessionLessURL  = 
"http://" + server + ":" + port + "/" + 
SERVLET_TOKEN + "?" + 
DRILL_TOKEN + "&" 
+ USERID_TOKEN + "=" 
+ userId +   &" + PASSWORD_TOKEN 
+ "=" + password;  Establishes an 
authenticated connection to the 
WebFOCUS s
erver.@return Indicates if 
the connection 
was successfully authenticated.
public boolean connect()
  String url = "http://" + 
server + ":" + port  "/" + 
SERVLET_TOKEN + "?" + SIGNON_TOKEN + 
"&" + USERID_TOKEN + "=" + 
userId +  "&" + PASSWORD_TOKEN + 
"=" + password;method = new 
GetMethod(url);     tryclient.executeMethod(method);                 Read the response body  
byte[] responseBody = method.getResponseBody()catch 
(HttpException e)      
e.printStackTrace();
 catch (IOException e)         e.printStackTrace(); finally 
Release the connection.   method.releaseConnection();
return isAuthenticated();
Checks if the current 
connection to the WebFOCUS 
server is authenticated.  
* @return Indicates if the current c
onnection has been authenticated. 
public boolean isAuthenticated()
HttpState state = client.getState();     Cookie[] cookies = 
state.getCookies();      
loop through the array of cookies 
to check if we have the MRE session 
cookie  for(int i = 0; i < cookies.length; 
i++)    if(cookies[i].getName().
equals(AUTH_COOKIE)) 
return true;// session 
cookie was not found
return false;  public void release
Connection() method.releaseConnection();      
isConnected = false;   * Execute's an MRE FEX stored on the WebFOCUS server. * 
@param domain MRE Domain where 
report is located.* @param
 folder MRE Folder where report is 
located.   * @param name   
Name of the report to 
execute. * @param params 
Parameters to be passed to 
the report. * @retur Output 
from the executed report.   public InputStream executeReport(String domain, 
String folder, String 
report, NameValuePair[] params)
if(isConnected) releaseConnection()
String url = null;InputStream 
responseBody = null;   
if(isAuthenticated())  
url = sessionBasedURL; 
else url = sessionLessURL; t
ry // construct URL with URL-safe 
(UTF8-encoded)valuesurl += "&" + 
DOMAIN_TOKEN + "=" + URLEncoder.encode(domain.trim(), 
"UTF-8") + "&" + FOLDER_TOKEN + "=" + URLEncoder.encode(folder.trim(), 
"UTF-8") + "&" + REPORT_TOKEN + "=" + URLEncoder.encode(report.trim(), 
"UTF-8");if any parameters exist, a
dd them to the URLif
(params != null)   
for(int i = 0; i 
<params.length; i++)if(
params[i] 
!= null   url += "&" L
Encoder.encode
(params[i].
getName().trim(), 
"UTF-8") + "=" + URLEncoder.
encode(params[i].
getValue().trim(), "UTF-8"); 
catch (UnsupportedEncodingException e1) e1.printStackTrace();
 method = new GetMethod(url);  
try  log.debug("Executing HTTP
 method: " + url)
client.executeMethod
(method);  responseBody = method.getResponseBodyAsStream()          isConnected = true;catch 
(HttpException e)         
e.printStackTrace();
catch (IOException e)          e.printStackTrace();
 return responseBody; p
ublic 
static void 
main(String[] args)
WebFocusConnector conn = 
new WebFocusConnector
(<server>, 
<port>, <user>, <password>, 
<session?>
NameValuePair[] params = 
{new NameValuePair
("REP_START_DATE", "20050101"),  
new NameValuePair(
"REP_END_DATE", 
"20050526"), new NameValuePair
("CURRENCY_CODE", "USD"),            			new NameValuePair
("REP_OUTPUT", "PDF")}      
InputStream responseBody = 
conn.executeReport
(<domain>, 
<folder>, <fex>, params);
Note that to
use this code, you will
require
the HttpClient jar and its
dependencies (available at apache.org).

This message has been edited. Last edited by: <Mabel>,
 
Posts: 9 | Location: Boston | Registered: April 25, 2005Report This Post
Expert
posted Hide Post
IBIMR_drill=RUNNID

Thank you for this information - it may come in handy.
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Thanks for the information on the IBIMR_drill=RUNNID. That was what I was missing and my self-service links were not working as I was getting the "must login to MRE" message. Just wanted to post a "thank you for contributing to the forum".


Dev- WF 7.68 on Windows Server 2003: DB2, SQL Server 2K, SQL Server 2005, SQL Server Anaysis Services 2005.
Test- WF 7.67 on Windows Server 2003: DB2, SQL Server 2K, SQL Server 2005, SQL Server Anaysis Services 2005.
Prod - Dev- WF 7.65 on Windows Server 2003: DB2, SQL Server 2K, SQL Server 2005, SQL Server Anaysis Services 2005
 
Posts: 10 | Registered: July 22, 2004Report This Post
Expert
posted Hide Post
Adding &IBIMR_drill=RUNNID seems to allow one to login to MRE without a valid User ID and Password.

Is there some way to stop this?

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Further to this, it looks like you can login with anything as User ID/Password, the IBIMR_fex is executed alright, but if that program has a form that submits another report, you get the "not logged-in to MRE" message.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
<form target="dscCall" method="get" target="dsc" action="http://servername/ibi_apps/WFServlet">
<input type="hidden" name="IBIMR_drill"      value="RUNNID">
<input type="hidden" name="IBIMR_action"     value="MR_RUN_FEX">
<input type="hidden" name="IBIMR_sub_action" value="MR_STD_REPORT">
<input type="hidden" name="IBIMR_folder"     value="#dashboardsa3">
<input type="hidden" name="IBIMR_domain"     value="enterpri/enterpri.htm">
<input type="hidden" name="IBIMR_fex"        value="app/dbdsc.fex">

<span style="width: 100px;">MRE User</span><input type="data" style="width: 100px;" name="IBIMR_user" value="">
<br>
<span style="width: 100px;">MRE Password</span><input type="password" style="width: 100px;" name="IBIMR_pass" value="">
<br><br>
<input type="submit" name="Submit" value="Submit">


I thought this form would be one method to login to MRE and execute a fex. Well, it appears to login and execute a fex, but if the executed fex has a form to submit another fex, I get "Cannot execute the request. Please log into Managed Reporting."

Any ideas, anyone?

Thanks.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Guru dhagen's response here triggering report fex from... appears to be the answer.

I have made his suggestion work, but I may have to add some cookie deletion JavaScript - I've noticed if I login with a different User ID, the first User ID is the one that's really logged in.

Also, I cannot find any documentation on a couple of MRE parameters he specified: SIGNON_CORRECT_ADMIN and SIGNON_CRT_DOM_ADMIN.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
<Jim Thorstad - WF Product Mgt.>
posted
We are adding two new settings in WebFOCUS 7.6.4, MR_ANONYMOUS_RUN_ACCESS=YES|NO and MR_AUTOSIGNON=YES|NO. I think these will give you what you are looking for, and also address the security concerns some people have had about IBIMR_drill=RUNNID. Also, look for this being written up in the next WF Newsletter Article.

More info posted about these settings here:

https://forums.informationbuilders.com/eve/forums/a/tpc/...1057331/m/9361055342
triggering a fex...
 
Report This Post
Expert
posted Hide Post
Jim, thanks very much for the update. These new parameters will come in handy when the customer upgrades...

Cheers,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Authenticate and Execute FEX using single URL in MRE

Copyright © 1996-2020 Information Builders