Accessing the SAS SessionService from a Java Connection

Reply
Contributor
Posts: 28

Accessing the SAS SessionService from a Java Connection

Does anyone have any experience connection to the SAS Workspace Server from Java and then grabbing the SessionService Object? I have followed this tutorial, http://support.sas.com/documentation/cdl/en/itechjcdg/62762/HTML/default/viewer.htm#connfact.htm , and have been able to make a connection. I know would like to grab and use the SessionService which I know is available by this article, http://support.sas.com/documentation/cdl/en/itechjcdg/62762/HTML/default/viewer.htm#found_session.ht... .

,

PROC Star
Posts: 425

Re: Accessing the SAS SessionService from a Java Connection

Hi,

If you haven't seen them already you might want to have a look at the Javadocs:

Would you also be able to provide a little more background, or business examples, on what you are trying to do with regard to "connection to the SAS Workspace Server from Java and then grabbing the SessionService Object?".  It's possible, and quite easy, to get a simple SAS Workspace Server connection (see Connecting with Directly Supplied Server Attributes and Connecting with Server Attributes Read from a SAS Metadata Server) without using Foundation Services (you should even be able to connect to a workspace server via those mechanisms without foundation services running). I'm assuming from your question that you're using one of those techniques? If so, and you want/need to be using Foundation Services you might want to think about approaching this problem from the other direction and getting a workspace server connection from the Foundation Services infrastructure instead as (heavily summarized) in the Example of Connecting with Server Attributes from the Information Service. Whether you want/need that additional layer of Foundation Services complexity will depend on the problem you are trying to solve which is why a bit more background on the underlying business requirement might help.

Cheers

Paul

PROC Star
Posts: 425

Re: Accessing the SAS SessionService from a Java Connection

Posted in reply to PaulHomes

By the way, this is shortest self-contained code (exception handling removed for simplicity) that I've personally been able to use to get access to remote SAS Foundation Services from a standalone Java app:

PlatformServicesConfiguration platformServicesConfig = new PlatformServicesConfiguration(null, new MetadataSourceInterface[] {
    PlatformServicesConfiguration.createMetadataSource( "sas-oma://sasmeta:8561;reposname=Foundation;", "sasadm@saspw", "secretpassword")
    });
CorePlatformServices.setServicesConfiguration(platformServicesConfig);
CorePlatformServices.startServices();
SessionServiceInterface sessionService = CorePlatformServices.getSessionService();
UserServiceInterface userService = CorePlatformServices.getUserService();
AuthenticationServiceInterface authService = CorePlatformServices.getAuthenticationService();
InformationServiceInterface infoService = CorePlatformServices.getInformationService();    
CorePlatformServices.terminateServices();

Other SAS & Java programmers might be able to give you alternative methods.

Contributor
Posts: 28

Re: Accessing the SAS SessionService from a Java Connection

Paul, this I had looked into the javadocs a bit. The information your provided in your second post is what I was looking for although I am still having trouble accomplishing my task. Essentially I have as Custom SAS Portlet with a Flash Application in it which are going to access data through Java/Blazeds services. What I would like to do is pass some SAS variable (SessionID is what I was looking for) to the Flash app which could then forward this to the Java Services and they could verify that this is a legitimate SAS Session before returning data.

Ask a Question
Discussion stats
  • 3 replies
  • 353 views
  • 0 likes
  • 2 in conversation