cancel
Showing results for 
Search instead for 
Did you mean: 

RFCServer with JCo 3.0

Former Member
0 Kudos

Hello,

I want do write a RFCServer with JCo 3.0

First I have implementet the StepByStepServer from the manual and it works fine.

In the StepByStepServer example the connection data is read from a property file.

How can I change this ? I want to set the connection parameters directly for the server but I didn't find any

SET methods to do this.

In the manual you found the following sentence:

"For this example the destination configuration is stored in a file that is called by the program. In practice you should avoid this for security reasons."

But there is no proposal to do this.

Has anybody an idea ?

[Manual|http://www.grupos.com.br/group/abap4/Messages.html?action=download&year=08&month=12&id=1228390207150251&attach=SAPJCo_Documenta%E7%E3o_3.0_EN.pdf]

Thanks

Arnfried

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In the manual you found the following sentence:

"For this example the destination configuration is stored in a file that is called by the program. In practice you should avoid this for security reasons."

But there is no proposal to do this.

Has anybody an idea ?

You have to create destinations using the NWA and use this instead of files

Configuration Management-> Destinations.

Regards

Ayyapparaj

Former Member
0 Kudos

Thanks for the answer but I am working with the standalone version of JCo 3.0 in Eclipse.

How can I do this with the standalone version ?

Have you an code example ?

Thanks

Arnfried

Former Member
0 Kudos

Does anybody know meanwhile an answer to this question?

The only documented way to create a new JCo server instance (or to return an available instance) is

JCoServerFactory.getServer("SERVER");

which loads automatically a file called SERVER.jcoServer from the working directory which contains the connection properties.

So in my opinion there is missing the possibility to call the method getServer with Properties as parameter to create a new JCo server instance without a property file.

Former Member
0 Kudos

Meanwihile I know the solution.

For a JCo Server you need two connections to a SAP system. One connection as client to get the repository data and a scond connection as server. You have to implement both connections.

1. ServerConnection

Implement your own ServerDataProvider class which implements the interface ServerDataProvider. Important is the method "getServerProperties()". Usefull is also to implement methods to set the the properties like setServerName(), setHost(),...

Impotant is to set the property ServerDataProvider.JCO_REP_DEST. With this property you define which client connection should be used to read the repository data.

2. ClientConnection

Implement your own DestinationDataProvider class which implements the interface DestinationDataProvider. Important is the method "getServerProperties()". Usefull is also to implement methods to set the the properties like setDestName(), setHost(),...

3. Create instances of your provider classes and set the properties

Example:

RFCDestinationDataProvider destDataProvider = new RFCDestinationDataProvider();

destDataProvider.setProperties("destName","host", "sysNo", "client", "user", "password, "language");

RFCServerDataProvider serverDataProvider = new RFCServerDataProvider();

serverDataProvider.setProperties("serverName","host", "gwHost", "progID", "connection_count", "destName");

4. Register both provider a the JCo Environment

Example:

Environment.registerDestinationDataProvider(destDataProvider);

Environment.registerServerDataProvider(serverDataProvider);

5. Create a server instance

Example:

JCoServer server = JCoServerFactory.getServer(SERVER_NAME );

6. Create HandlerFactory

Example:

DefaultServerHandlerFactory.FunctionHandlerFactory factory = new DefaultServerHandlerFactory.FunctionHandlerFactory();

7. Implement your own function handler class(es) implementing the interface JCoServerFunctionHandler.

Example: StfcConnectionHandler()

8. Register your handler class and the calling SAP function module at the FactoryHandler (see point 6)

Example:

JCoServerFunctionHandler stfcConnectionHandler = new StfcConnectionHandler();

factory.registerHandler("STFC_CONNECTION", stfcConnectionHandler);

factory.registerHandler("STFC_STRUCTURE", stfcConnectionHandler);

8. Register HandlerFactory at the server (see point 5)

Example: server.setCallHandlerFactory(factory);

9. Start the server

Example: server.start();

I hope this small instructions will help you.

A german version you will find under: http://www.abapforum.com/forum/viewtopic.php?f=6&t=16120&p=54128#p54128

Bye

Arnfried

Former Member
0 Kudos

Thanks for your answer. This will help.

Meanwhile I've found additionally a [tutorial|http://www.vogella.de/articles/SAPJCo/article.html] where this is also with examples described.

So the "missing link" for me was the information about the JCo Enviroment.