Focal Point
How to List Available Domains in JSP or HTML

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5481011861

May 16, 2006, 01:46 AM
jodye
How to List Available Domains in JSP or HTML
Hi Everyone

I need to display a list of domains that the logged in user has access to in MRE. This would be in a jsp page or via dashboard html code. I have looked at the available jsp files as well as the javaassist files, but needless to say it is not very intuitive.

The Webfocus 713 API Developer's Reference (wf713api.pdf) is also not that clear. At least not to me. :-)

The manual refers to "deploying the Webfocus API Sample Application" page 38. I could not find these files anywhere.

Anyway on page 30 "getting a list of domains for a particular user" there is some sample code.

Unfortunately, none of the lines work in jsp. For example, even the first line application.getInitParameter fails.

I imagine the problem is that I do not import the correct files, but the samples do not indicate exactly what needs to be imported.

I then changed my approach and decided to use HTML to get the domains. The following code returns the list of domains in the dashboard...

(< and > removed from tags)

html
body
form name='form1' method='post' action='http://xxx/ibi_apps/WFServlet'
input type='hidden' name='IBIMR_action' value='MR_GET_USER_DOMAINS'
input type='hidden' name='IBIMR_returntype' value='XML'
input type='hidden' name='IBIMR_domain' value="xxxxx/xxxx.htm"
input type='hidden' name='IBIMR_random' value=""
script
document.form1.IBIMR_random.value = Math.random();
/script
script language="Javascript">
self.setTimeout('document.form1.submit();', 1000);
/script
form

However, this gives me the domains in XML inside the frame I am using. How can I parse this to display the domains in HTML instead of XML?

To Summarize:

1) Does anybody have exact JSP code showing how to list the user's domains?
2) Does anybody know how to parse the xml in the dashboard block. I suppose I will need to use javascript. I will look over all of the javaassist files but if someboody has a sample... that

Thanks in advance.

Jodye


WF 8.0.0.5M
May 16, 2006, 03:08 PM
jodye
Well I got one step closer...

the following JSP code returns the domains at text or XML. But I still do not know how to parse the results and display them as I like...

<%@ page import="java.io.File"%>
<%@ page import="ibi.webfoc.*"%>


<%
String cgiLocation = application.getInitParameter("webfocus_client_root")+File.separator+"web"+File.separator+"cgi";

//Create a request and response object
WFApplicationRequest workerReq = new WFApplicationRequest();
WFResponse workerResp = new WFServletResponse( response );

//Instantiate the WFServletVariableTableExtension to add name/value pairs to the request
WFServletVariableTableExtension wfSVTExtension = new WFServletVariableTableExtension( request, application );

//Sign-on to Managed Reporting
workerReq.addParameter( "IBIMR_action", "MR_SIGNON" );
workerReq.addParameter( "IBIMR_user", "username" );
workerReq.addParameter( "IBIMR_pass", "password" );
// workerReq.addParameter( "IBIMR_returntype", "XML" );
WFWorkerUtil.processRequest( cgiLocation, workerReq, workerResp, wfSVTExtension, null ,null, null );

//Reinitialize the request with the previous response cookies and obtain all MR Domains
workerReq.Initialize( workerResp.getCookies() );
workerReq.addParameter( "IBIMR_action", "MR_GET_USER_DOMAINS" );
//workerReq.addParameter( "IBIMR_returntype", "XML" );


WFWorkerUtil.processRequest( cgiLocation, workerReq, workerResp, wfSVTExtension, null ,null, null );

%>


WF 8.0.0.5M
May 17, 2006, 07:46 AM
Tony A
Hi Jodye,

As I understand it, to deploy the WFAPI sample app you have to create a new web application within your application server (New Atlanta etc.).

For New Atlanta, go to the admin page (http://yourwebserver/servlet/admin) and click on "Manage" under "Web Applications". You should already have "WebFOCUS 71" and maybe "ReportCaster 71". Click on "Add Web Application" and fill in the blanks e.g. -

Application Name:  Sample_713
URL Context Path:  /IB_Samp/
Location:          [path to]\WebFOCUS71\samples\webapps\wfapi


Once you have the successful message you should be able to access the sample pages via http://yourwebserver/IB_Samp.

I have managed to get to the login page that is mentioned in the manual but have not had time to venture further.

Good luck and let us know how you get on.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
May 17, 2006, 07:49 AM
Tony A
Forgot to mention that I have some sample HTML code that will execute a URL and then parse the XML returned into a select. I have tried adjusting for the MR_GET_USER_DOMAINS but cannot get a valid XML doc in the reply from the request - all I get is "The action specified "MR_GET_USER_DOMAINS" is invalid." with an error code 1007. I shall have to check this out further.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
May 17, 2006, 03:29 PM
jodye
Hi Tony

Thanks for answering. I managed to deploy the api sample app and log in. When I try to retrieve the list of domains I get..

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------

The following tags were not closed: null. Error processing resource 'http://myserver/api_samples/WfApiController...


and when I do a view source I see the following

?xml version="1.0" encoding="ISO-8859-1" ?
null name="MR_GET_DOMAINS"
/>

and thats it.

So the API sample does not work, at least not out of the box. The other links work. eg run a standard report.

Jodye


WF 8.0.0.5M
May 17, 2006, 06:04 PM
Tony A
Hi Joyde,

Unfortunately I haven't had (or will have Frowner) the time to progress any further with the API route. It will have to go in the "things to do when time permits" box along with the other bits of interesting coding I'd like to get around to Smiler.

Have you seem the PM I have sent you? Try the code and let me know what you think.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
May 17, 2006, 06:52 PM
jodye
Hi Tony

That is EXACTLY what I was looking for. Seems to work fine. Once I get the values in an array I can do anything I want with them... I will modify this to look up a list of reports under a certain folder. Should work the same way if I can get the results in XML. I will let you know.

Thanks a million!

Jodye


WF 8.0.0.5M
May 18, 2006, 08:31 AM
Tony A
Hi Jodye,

A pleasure, glad it worked for you.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10