on 02-05-2009 5:37 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.