GCF and <CALL> tag

Hi all,

I'm trying to get an application setup with single sign on using the GCF connector. I need to use the tag to call an external java application. The external java application will take a username, and give back a 'Session ID' which is used in generating the destination URL.

< CALL a:class="ourClass">
   < PARAM a:value="${_USERNAME}" />
   < PARAM a:value="SessID" />
< /CALL>

   Spaces were added after < since I couldn't get the code to show otherwise

Unfortunately I'm not a Java programmer and I don't really see exactly what to do from here. I know that this is passed to a Java program I specify but what I need to know is how to pass the SessID that my Java program creates back to the GCF. We just had the GCF training but the stuff is documented in a VERY rudimentary way which doesn't tell anything except what is shown above. It doesn't show what you do on the Java end. Any advice anyone can give on this on how I can pass this variable back? Any help would be appreciated.
0
No votes yet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How to invoke CALL TAG and pass back information to GCF

Hello,

Hope following comments help,

Looks like you figured out how to do call tag and pass the parameters to GCF Here is how you use that information into JAVA Class that you would write to do your stuff
public void Process(SymbolTable context, String[] params) throws Exception{

String userid = params[0];
String session_ID="";
//do your logic with JAVA to use userid and then create session id

param[1]=sessoion_ID;

}

This logic will provide you session_ID created back into GCF and using macro substituion of your value SessID do your GCF logic macro would be ${SessID}

Thanks for posting this.....

A couple questions...

1) Does a custom class need to go somewhere specific in order to get picked up in the GCF/Luminis classpath? Did you have to modify the classpath in order for GCF to recognize your custom class?

2) Do you know if this is documented anywhere from SGHE?

Custom class

You can jar this class up and put it under $CP_ROOT/products/sso/lib and modify servlets.properties under $CP_ROOT/products/ws/https-<>/config to add your new jar into classpath

Hope this helps.

Problem with above

Thank you for your reply,

What you had above is pretty much what I had but when I do that I get the following in my logs, referring to a ClassCastException. I'm not sure how I'm causing it, or how to fix it. I appreciate any advice that can be given on this problem. I've included all the information I can below in hopes that someone may notice what I'm doing wrong.

>>> authentication failed with exception:
java.lang.ClassCastException: edu.newpaltz.luminis.gcf.cgp.CGPSessions
        at com.campuspipeline.sso.authenticator.HttpSteps.opCall(HttpSteps.java:1096)
        at com.campuspipeline.sso.authenticator.HttpSteps.opExecuteSession(HttpSteps.java:1155)
        at com.campuspipeline.sso.authenticator.HttpSteps.opSession(HttpSteps.java:1251)
        at com.campuspipeline.sso.authenticator.HttpSteps.opExecuteClient(HttpSteps.java:1264)
        at com.campuspipeline.sso.authenticator.HttpSteps.opClient(HttpSteps.java:1293)
        at com.campuspipeline.sso.authenticator.HttpSteps.opExecute(HttpSteps.java:1308)
        at com.campuspipeline.sso.authenticator.HttpSteps.Execute(HttpSteps.java:1337)
        at com.campuspipeline.sso.authenticator.SSOOperations.authenticateUser(SSOOperations.java:204)
        at com.campuspipeline.cpipconnector.CpipOperationsDefault.perform1_3_6_1_4_1_4409_1_1_4_2(CpipOperationsDefault.java:232)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.campuspipeline.cpipconnector.CpipOperationsBase.perform(CpipOperationsBase.java:74)
        at com.campuspipeline.cpipconnector.CpipConnectorServlet.doPost(CpipConnectorServlet.java:164)
        at com.campuspipeline.cpipconnector.CpipConnectorServlet.doGet(CpipConnectorServlet.java:103)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:943)
        at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:494)

The authenticate section from my XML file is as follows currently:

    < authenticate>
        < CLIENT>
            < SESSION a:server="${properties.externalSystemURL}" >
                < CALL a:class="edu.newpaltz.luminis.gcf.cgp.CGPSessions">
                    < PARAM a:value="${_USERNAME}" />
                    < PARAM a:value="mySessID" />
                < /CALL>

                < SET a:symbol="SessID" a:value="${mySessID}" />

                < GET a:url="/Session/${SessID}/hello.wssp?" a:query="" a:redirects="no" />

                < SEARCH a:symbol="RetVal" a:source="${_RESPONSE}" a:value="${_VALUE}" >
                    < EXISTS a:string="User ${_USERNAME} logged in." a:found="TRUE" a:notfound="FALSE" />
                < /SEARCH>

                < RESULT a:value="${RetVal}" />
            < /SESSION>
        < /CLIENT>
    < /authenticate>

Spaces added after < since it doesn't show on this page otherwise.

and my java function (where the GetSessID function creates the sessionID when given a userid).

public void Process(SymbolTable context, String[] params) throws Exception
  {

        String userid = params[0];
        String mySessID = "";

        mySessID = GetSessID(userid);

        params[1] = mySessID;
  }


Same problem here

I've been trying to use a CALL tag to call a Java app in my CPIP connectors without success. I get the same ClassCastException in the cpip logs. Has anyone else been able to get this to work?

Found the solution

I've found the solution to the ClassCastException for anyone else who is interested. Your class needs to implement the ExternalAuthenticationProcessor class.

import com.campuspipeline.sso.authenticator.ExternalAuthenticationProcessor;

public class MyClass implements ExternalAuthenticationProcessor
{
    public void Process(SymbolTable context, String params[])
    {
        // code goes here
    }
}

However, I did find that simply assigning the output value to an element in params[] did not work as expected. I ended up using writing the output value directly to a form element. I can share the relevant code if anyone is interested.

Re: GCF and <CALL> tag

Here's an example of using CALL to invoke a Java class:

< CALL a:class="edu.newpaltz.luminis.gcf.cgp.CGPSessions" >
  < PARAM a:value="Get" />
  < PARAM a:value="${_USERNAME}" />
  < PARAM a:value="mySessID" />
< /CALL>

In this specific case, think of the first two PARAMs, 0 and 1, as IN parameters that are used somewhere within the Java class and think of the third PARAM, 2, as an OUT parameter to hold a value that is generated somewhere within the Java class.

Let's say we have the following line in the Java class:

String myString = '78104-r87uUg8AGgVUdVHrtq7k';

To get the value of myString back to the GCF XML file you can do the following:

context.put(params[2], myString);

This sets the value of the third parameter in the CALL tag's PARAM list, (in this case mySessID), to the value of myString in the Java class. Then in the GCF XML file the following:

< GET a:url="/myDirectory/${mySessID}/"
          a:query=""
          a:redirects="no" />

Would result in a GET request to:

/myDirectory/78104-r87uUg8AGgVUdVHrtq7k/

java compile problems: Class Path issues?

This is exactly what I need, but I am stuck trying to get my java class to compile:

I get the following error from javac:

OaktonTest.java:5: cannot resolve symbol
symbol : class SymbolTable
location: class OaktonTest
public void Process(SymbolTable context, String params[])
^
1 error
I am pretty sure this is a classpath issues, but I have no idea where the symbol "SymbolTable" is defined. I am compiling with the full classpath as referenced in the servlet.properties for the gcf web server, but this does not seem to fix it.

The full java source is:
-------------------------------------------------------------------
import com.campuspipeline.sso.authenticator.ExternalAuthenticationProcessor;

public class OaktonTest implements ExternalAuthenticationProcessor
{
public void Process(SymbolTable context, String params[])
{
// Basic hello World Test
String userid = params[0];
String myString = "Hello World-:" + userid ;
context.put(params[2], myString);
}
}
-------------------------------------------------------------------

GFC <CALL> Problem Resolved - needed to import one more class

Just had to add:
import com.campuspipeline.sso.authenticator.SymbolTable;
Since this is in ssotsgc.jar.

I posted a completely new forum topic with the detailed steps to do an example <CALL> tag. Will post a reference here as soon as the topic is released to the public.