Your SAS programs, embedded in web apps and elsewhere

STP Server & Java Client

Reply
N/A
Posts: 0

STP Server & Java Client

I am not a SAS programmer, user, or administrator and I know very little about SAS in general (not ideal, but that's how it is right now). I am developing a Java application which needs to connect to a SAS stored process server (pooled from the metadata server), execute a stored process and handle the results. Not a web app, just a plain old command line single method java application. Using the STP web app is not an option, the portal and web layer are not installed. I was hoping the SAS site would have a complete example of doing this, but I wasn't able to find one.

I started with "Connecting with Server Attributes Read from a SAS Metadata Server"
http://support.sas.com/rnd/itech/doc9/dev_guide/dist-obj/javaclnt/javaprog/connfact_omr.html

Instead of specifying the workspace server's logical name login015Logical, I specified the load balanced stored process server's logical name.

I then narrow the object and get a reference to the stored process server instead of the workspace server:
IStoredProcessServer stpServer = IStoredProcessServerHelper.narrow(obj);

I then create the context for the stored process (com.sas.iom.SASStoredProcess.IStoredProcessContext), which seems to take the physical locations, not the logical locations

StringHolder arg0 = new StringHolder();
String[] names = {};
String[] values = {};
String sessionId = "";
String repos = "/var/sasrepo";
String process = "test.sas";
IStoredProcessContext stpContext= stpServer.CreateContext(repos, process,names, values, sessionId);

Following that I execute it with
stpContext.Execute(arg0);

Now, this works, the stored process is executed from what I can tell... using stpContext.GetFormattedSasLog returns the expected log results.

What I am unsure of is how to get the resulting dataset from the stored process. Using the Workspace server from the original example I would do a executeWithResults and get a ResultSet back or grab a Connection and select results from work.out. With the IStoredProcessContext object I'm not sure how to go about retreiving results or how/what the stored process coder needs to send the results to within the process.

Compounding this problem is there appears to be no documentation for IStoredProcessServer, IStoredProcessContext and their related classes.

Am I barking up the wrong tree? Is there a simpler way to execute processes on a pooled stored process server using the metadata server to get the connection... is there a complete example? I can imagine people have done this and I am just missing some easier way to do it, but I've gone over all the documentation I can find and am sad to say I'm just not seeing it.
SAS Employee
Posts: 284

Re: STP Server & Java Client

Try contacting our Technical Support department. They may have some starter code for you to try:

http://support.sas.com/ctx/supportform/index.jsp

Vince DelGobbo
SAS R&D
Ask a Question
Discussion stats
  • 1 reply
  • 343 views
  • 0 likes
  • 2 in conversation