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     WebFocus Servlet Callable Exit Problem

Read-Only Read-Only Topic
Go
Search
Notify
Tools
WebFocus Servlet Callable Exit Problem
 Login/Join
 
Gold member
posted
I just tried to create a webfocus servlet callable exit based on the "WebFocus Security and Administration" documentation (version 5 release 2.3) and it failed to work. It appears that the return code is not being set, and the parameters I return in newVars are not available in my focexec.

The documentation contains errors, so I am not sure what the correct procedure is. Below I describe what I did. What am I missing?

Here is the servlet code (I've removed the security portion):


// HDRExit - This class defines the security exit for webfocus and defines
// a general parameter array PARAMS.
//
// NOTE: Everybody is authorized at this time.
// ------------------------------------------------------------------------
// 09/09/2004 James Muir Initial coding.
// ------------------------------------------------------------------------

import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class HDRExit
{
// Data.

private long AUTHORIZED = 0;
private long UNAUTHORIZED = 1;

// Constructors.

public HDRExit ()
{
super();
}

// Public Methods.

// authorize: authorize the requestor via pmit server.
// ------------------------------------------------------------------
public long authorize (String[] newVars, HttpServletRequest req)
{
Enumeration names = req.getParameterNames();

newVars[0] = _params(names);
return AUTHORIZED;
}

// Private Methods.
// _params: create params amper variable containing list of param names
// ------------------------------------------------------------------
private String _params(Enumeration names)
{
int i = 1;

Vector params = new Vector();

while (names.hasMoreElements())
{
params.addElement(_param(i++, (String)names.nextElement()))
}

String firstParam = _param(0, String.valueOf(params.size()));

StringBuffer result = new StringBuffer(firstParam);

Enumeration pe = params.elements();

while( pe.hasMoreElements())
{
result.append("&");
result.append((String)pe.nextElement());
}

return result.toString();
}


// _param: make a parameter string.
// ------------------------------------------------------------------
private String _param (int i, String name)
{
String ix = String.valueOf(i);

return "PARAM" + ix + "=" + name;
}
}

The HDRExit.class file was placed in the $CATALINA_HOME/webapps/webfocus52/WEB-INF/classes directory.

Here are the mods to the webfocus deployment descriptor web.xml:

<servlet>
<servlet-name>WFServlet</servlet-name>
<display-name>WFServlet</display-name>
<description>WebFOCUS Servlet</description>
<servlet-class>ibi.webfoc.WFServlet</servlet-class>
<init-param>
<param-name>WFEXT</param-name>
<param-value>HDRExit</param-value>
<description>HDRS WebFocus servlet callable exit</description>
</init-param>
</servlet>

I set the <param-value> to be the name of the class, HDRExit, as described on Page 8-2 of the documentation. In the documentation example, Page 8-6, the method name is given for the <param-value> and the <description> contains the class name. Bizarre and confusing.


We added this code to the end of the site.wfs file:

<CALL> authorize()
<IF> RETCODE NE "0"
HTMLFORM> unauthz.htm
<EXIT>
<ENDIF>


NOTE: The < is missing on the HTMLFORM directive above because the bulletin board software would not allow it. The < does exist in the site.wfs code.

The net result of these changes was the the RETCODE was always non-zero, and we were directed to our unuathorized page, unauthz.htm. We also did not see the PARAM0, PARAM1, ..., array that we were hoping to see.

Any and all suggestions appreciated.

Thanks, and apologies for the lengthy posting.
-James
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report This Post
Gold member
posted Hide Post
That's helpful. I'll try that.

Any idea what document describes the scripting language used in the site.wfs ?

I'd like to pass back to WebFocus a variable number of parameters PARAM0, PARAM1, ... Does this scripting language have any looping capabilities?
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report This Post
Master
posted Hide Post
Have you look at the 523 Security Manual. I ave create a WebFOCUS Exit and it works I took some code from the Security manual
 
Posts: 865 | Registered: May 24, 2004Report This Post
Master
posted Hide Post
Try a little example like this

import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Enumeration;
import java.util.Vector;
import java.util.*;
import java.io.*;

public class WfCallableExit
{
/*** WfCallableExit constructor comment. ***/

public WfCallableExit()
{
super();
String methodname = "[WFEXT] WfCallableExit:";
System.out.println(methodname);
}

public long MyExit(String[] NewVars, HttpServletRequest req)
{
String methodname = "[WFEXT] MyExit";
System.out.println( methodname);
NewVars[0] = setNewVars("Security=0") + setNewVars("&ID=SAM") + setNewVars("&MYPASS=PASSWORD");
System.out.println( methodname + " " + NewVars[0] );
return 0;
}


/****************************************************************************/
/*** Populates WebFOCUS internal exit buffer with name/value pairs. The & ***/
/*** is not part of the variable, it is used as a delimiter. ***/
/****************************************************************************/

private String setNewVars(String MajorFac)
{
String NewVars;
NewVars = MajorFac;
return(NewVars);
}
}
 
Posts: 865 | Registered: May 24, 2004Report This Post
Gold member
posted Hide Post
Well, I simplified my servlet callable exit quite a bit. Now all I want is a valid return code. How hard could that be??? Sheesh. Here's the new simplified exit code. I've included the print statements as suggested.

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class HDRSession
{
// Data.

private long AUTHORIZED = 0;
private long UNAUTHORIZED = 1;

// Constructors.

HDRSession ()
{
super();

System.out.println("[WFEXT] HDRSession");
}

// Public Methods.

// authorize: authorize the requestor via pmit server.
// ------------------------------------------------------------------
public long authorize (String[] newVars, HttpServletRequest req)
{
System.out.println("[WFEXT] authorize");

return AUTHORIZED;
}
}


We turned on tracing, and the trace indicated that the class is not being instantiated even though we have added the following XML to the web.xml file. Does this look correct?

<servlet>
<servlet-name>WFServlet</servlet-name>
<display-name>WFServlet</display-name>
<description>WebFOCUS Servlet</description>
<servlet-class>ibi.webfoc.WFServlet</servlet-class>
<init-param>
<param-name>WFEXT</param-name>
<param-value>HDRSession</param-value>
<description>WebFocus servlet callable exit</description>
</init-param>
</servlet>

We rebuilt the war file, and we simplified our site.wfs file to just do the following (as a test) to display the value of RETCODE:

<CALL> authorize()

HTMLFORM> wfexterr.htm
<EXIT>

As stated previously, the documentation is really poor in the WebFocus 5.2 Security and Administration Manual. On page 8-2 one is instructed to add the CLASSNAME as a parameter to the WFServlet block. Fine. Later, on page 8-6, in an example that the tech writer obviously did not test one is shown an example in which a METHODNAME is being passed as a parameter.

So which is it? METHODNAME or CLASSNAME. Classname makes sense to me, but I'll entertain any nonsense if it gets this product to work.
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report This Post
<RJones>
posted
the scripting langauge is covered in the WebFocus Security and Admin manual..Chapter 10.

the web.xml should contain the class name and the site.wfs should contain the method you want to call.

did you reload the webfocus52 web app after you made the changes?
 
Report This Post
Gold member
posted Hide Post
Yes. Rebuilt the webfocus52.war file and had tomcat reload it.

Could there be a webfocus configuration option that is keeping it from instantiating the webfocus servlet callable exit?
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report This Post
Member
posted Hide Post
You are correct in that the doc is wrong
Should read
<init-param>
<param-name>WFEXT</param-name>
<param-value>WfExitSample</param-value>
<description>Callable Exit Example</description>
</init-param>

You code looks ok.
It sounds like the exit is not being loaded.
If you put your exit in a jar file, did you add the jar file to lib directory of the web app (WEB-INF/lib), or did you add the class to classes directory of the web app (WEB-INF/classes).
If you still having a problem turn servlet traces on, in the trace file you should see something like (trimmed tracing to show relevant information)
...Do next token: WFEXT
...current token(varName) : WFEXT
...var value is : ibix.exits.wf.WfCallableExit
...exec command is : true
:
:
...:Entered DoCall()
...:User Method name = requestInfo
...:Found method matching call signature in class: ibix.exits.wf.WfCallableExit
...:Exit Object Return Value = 0
 
Posts: 5 | Registered: May 20, 2003Report This Post
Gold member
posted Hide Post
Well, here's a snippet from a trace we did a while ago. It sure does look like the exit is not being found. Apologies for the lengthy posting.

We didn't bother to package the servlet into a jar file. We just put the class in classes, and then rebuilt the war file. No luck.

What package should the servlet callable exit belong to? Any thoughts on this vexing problem would be appreciated...


1325:2793:ibi.webfoc.wfutil.WFRunScript.createWFRunScript(WFRunScript.java:502):Instantiating WFRunScript
1326:2794:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:273):getValue of the variable :WFEXT
1327:2796:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:305):value is : null
1328:2797:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:575):Get the content of the file : /opt/webf2/ibi/client52/wfc/etc/site.wfs
1329:2799:ibi.webfoc.wfutil.WFSharedFileCache.getFile(WFSharedFileCache.java:163):File is not loaded : /opt/webf2/ibi/client52/wfc/etc/site.wfs
1330:2800:ibi.webfoc.wfutil.WFSharedFileCache.cacheFile(WFSharedFileCache.java:335):Reading the file...
1331:2803:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:606):Parsing 'wfs' file:/opt/webf2/ibi/client52/wfc/etc/site.wfs
1332:2804:ibi.webfoc.wfutil.WFRunScript.getVersion(WFRunScript.java:710):Version is:1
1333:2806:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: _HTML_COMMENT_VAR
1334:2807:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : _HTML_COMMENT_VAR
1335:2809:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:273):getValue of the variable :_cgi_gen_var
1336:2812:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:305):value is : null
1337:2814:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : CGI gened on null
1338:2816:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1339:2818:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: <sendvar>
1340:2819:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:273):getValue of the variable :REMOTE_USER
1341:2821:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:305):value is : Suzanne Smith
1342:2823:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:273):getValue of the variable :REMOTE_USER
1343:2824:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:305):value is : Suzanne Smith
1344:2826:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: _site_profile
1345:2828:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : _site_profile
1346:2830:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : -INCLUDE /focd10/wdisk/wfsitepf.fex
1347:2831:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1348:2833:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: ENABLE_SSG
1349:2834:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : ENABLE_SSG
1350:2836:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : NO
1351:2838:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1352:2839:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: IBIF_wfdescribe
1353:2841:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : IBIF_wfdescribe
1354:2843:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : XMLRUN
1355:2844:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1356:2846:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: EXPIRE_REPORTS
1357:2847:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : EXPIRE_REPORTS
1358:2849:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : 1
1359:2850:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1360:2852:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: WF_AUTO_SIGNON
1361:2855:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : WF_AUTO_SIGNON
1362:2857:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : NO
1363:2859:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1364:2860:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: <ifndef>
1365:2862:ibi.webfoc.wfutil.WFRunScript.doIfdef(WFRunScript.java:961):doIfdef() called ...
1366:2863:ibi.webfoc.wfutil.WFRunScript.doIfdef(WFRunScript.java:966):doIfdef() Current Token is : IBIC_user
1367:2865:ibi.webfoc.wfutil.WFRunScript.doIfdef(WFRunScript.java:967):Token Type is : 0
1368:2867:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:273):getValue of the variable :IBIC_user
1369:2868:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:305):value is : null
1370:2870:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : IBI_REPORT_USER
1371:2872:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : www
1372:2873:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1373:2875:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: <ifndef>
1374:2877:ibi.webfoc.wfutil.WFRunScript.doIfdef(WFRunScript.java:961):doIfdef() called ...
1375:2878:ibi.webfoc.wfutil.WFRunScript.doIfdef(WFRunScript.java:966):doIfdef() Current Token is : IBIC_pass
1376:2880:ibi.webfoc.wfutil.WFRunScript.doIfdef(WFRunScript.java:967):Token Type is : 0
1377:2881:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:273):getValue of the variable :IBIC_pass
1378:2883:ibi.webfoc.wfutil.WFVariableTable.getValue(WFVariableTable.java:305):value is : null
1379:2884:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:882):doLineOld: doing def-line for current token(varName) : IBI_REPORT_PASS
1380:2886:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:908):defLineOld: var value is : "TRUSTED"
1381:2888:ibi.webfoc.wfutil.WFRunScript.defLineOld(WFRunScript.java:909):defLineOld: exec command is : true
1382:2890:ibi.webfoc.wfutil.WFRunScript.runScript(WFRunScript.java:612)Big Grino next token: <CALL>
1383:2891:ibi.webfoc.wfutil.WFRunScript.doCall(WFRunScript.java:1625):Entered DoCall()
1384:2893:ibi.webfoc.wfutil.WFRunScript.doCall(WFRunScript.java:1632): User Method name = authorize
1385:2895:ibi.webfoc.wfutil.WFRunScript.internalCallExitMetod(WFRunScript.java:1570):Exit class not defined
1386:2896:ibi.webfoc.wfutil.WFRunScript.internalCallExitMetod(WFRunScript.java:1570):Exit class not defined
1387:2901:ibi.webfoc.wfutil.WFRunScript.internalCallExitMetod(WFRunScript.java:1590)Big Grinid not find a method matching call signature in class: ibi.webfoc.wfutil.WFRunScript
1388:2903:ibi.webfoc.wfutil.WFRunScript.doCall(WFRunScript.java:1685):Method not Called!
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report 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     WebFocus Servlet Callable Exit Problem

Copyright © 1996-2020 Information Builders