9.1 Using the RFIService client class

RFIService is the client class used for Remote Function Invocation programming.

To create an instance of RFIService use the static getInstance method. This method requires a properties parameter. These properties control the communication characteristics of the host connection.




Host protocol and address http://your.own.url:port.


Proxy server.


Basic authentication user.


Basic authentication password.


Host agent program.
Default - /cgi-bin/jsmdirect.


HTTP protocol head encoding.
Default - ISO8859_1.


HTTP Basic authentication encoding.
Default - ISO8859_1.


Required for an SSL connection if the trust store does not contain the peer certificate.
A value of true means that server certificate will be trusted.




Properties properties = new Properties () ;


properties.put ( "rfi.server", "http://your.own.url:port" ) ;


RFIService service = RFIService.getInstance ( properties ) ;


The RFIService has two methods to send and receive serialized objects.

The getObject method is used to receive a serialized response object from the host server using the specified service name.


Object getObject ( String service ) 

Object getObject ( RFIObject service ) ;




Object object = service.getObject ( "EMPLOYEE-FETCH" ) ;


The putObject method sends a serialized object to the host server and receives a response object from this named service.


Object putObject ( String service, Object sendObject ) ;

Object putObject ( RFIObject sendObject ) ;




Object object = service.putObject ( "EMPLOYEE-UPDATE", employee ) ;


If the response status from the host is not successful then an RFIException is thrown.

If the content type of the response is not "application/x-java-serialized-object" an RFIException is thrown.

If no content was returned a null object reference is returned, else the content is de-serialized and an object reference is returned.

The RFIObject interface has one method to return the service name.

This allows the sendObject to supply the name of the service and eliminates the need for the String service name parameter.


public interface RFIObject


    public String getService () ;



The RFIException class has several methods to allow access to the response status and message.



int getStatus ()

Get response status code

String getMessage ()

Get response status message

byte[] getContent ()

Get response content

Enumeration propertyNames ()

Get response properties

getProperty ( String property )

Get response property