cancel
Showing results for 
Search instead for 
Did you mean: 

Implementation of an RFCServer with JCo3

Former Member
0 Kudos

Hello,

I want do write a RFCServer with JCo3.

First I have implementet the StepByStepServer from the manual. But it did not work.

I do not understand the the using of the connetionProperties.

Why does the program uses three connections ? If I want to implemt a server I only need a server connection with GWHOSt, GWSERV, PROGID.

If I try this I will gete an error like:

Exception in thread "main" com.sap.conn.jco.JCoRuntimeException: (101) JCO_ERROR_CONFIGURATION: Unable to start the server, because of repository is null

at com.sap.conn.jco.rt.DefaultServer.checkRuntimeConfiguration(DefaultServer.java:561)

at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:580)

at StepByStepServer.step3SimpleTRfcServer(StepByStepServer.java:291)

at StepByStepServer.main(StepByStepServer.java:299)

Has somebody an example for an RFCServer implemteted with JCo3 ?

Thanks

Arnfried

Accepted Solutions (0)

Answers (1)

Answers (1)

ravindra_bollapalli2
Active Contributor
0 Kudos

hi,

check this threads

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/fcadaf90-0201-0010-4091-bd0bcd7b...

http://www.persistentsys.com/DesktopModules/WhitepapersSetting/UploadCaseStudy/CMS_497929003_Java_SA...

check for this book "Enterprise Java for SAP" u can download this book from net

let me know u need any further info

bvr

Edited by: bvr on Feb 2, 2009 1:16 PM

Former Member
0 Kudos

These two documents are based on JCo2.*. It seems JCo2 server programming can work with only one gateway, but JCo3 need one more AS for repository.

I don't want to use a AS at all. Is there any way to do it?

Thanks!

Former Member
0 Kudos

Hello,

have a look at this thread

Maybe it helps

Arnfried

Former Member
0 Kudos

In my Java server code, I want to provide a function named "IncreaseOne", it gets an input integer named "i", and returns another integer with value i+1. I don't want to register this pure java method in any application server.

I think I only need to register a JCoServerRequestHandler for my "IncreaseOne". Then I can use jcorequest and jcoresponse to get and set my desired values.

public void handleRequest(JCoServerContext jcoservercontext, JCoRequest jcorequest, JCoResponse jcoresponse)

Get: int i = jcorequest.getInt("i");

Set: jcoresponse.setValue("i_output", i+1);

It should NOT ask me to link to any application server.

It's unfare to throw this exception:

Exception in thread "main" com.sap.conn.jco.JCoRuntimeException: (101) JCO_ERROR_CONFIGURATION: Unable to start the server, because of repository is null

Does anyone know how I can get it over?

Thanks!

Former Member
0 Kudos

Hello,

please read my posting above.

You need to connections to a SAP system if you want to implement a JCo Server 3.x.

The message "Unable to start the server, because of repository is null" means that your connection to get the repository information is not working or is not implemented.

Arnfried

Former Member
0 Kudos

I have successfully met my goal of no need for sap server as repository.

//Define my own JCoCustomRepository

public class MyJCoCustomRepository implements JCoCustomRepository {

protected String m_Name;

protected Hashtable<String, JCoFunctionTemplate> m_JCoFunctionTemplateCache;

protected Hashtable<String, JCoRecordMetaData> m_JCoRecordMetaDataCache;

...

}

//Use it as following:

JCoCustomRepository jcorepository = new MyJCoCustomRepository("LocalRepository");

server.setRepository(jcorepository);

String name = "STFC_CONNECTION_KEVIN";

JCoListMetaData imports = JCo.createListMetaData("aa");

imports.add("REQUTEXT", JCoMetaData.TYPE_STRING, 50, 50, JCoListMetaData.IMPORT_PARAMETER);

imports.lock();

JCoListMetaData exports = JCo.createListMetaData("bb");

exports.add("RESPTEXT", JCoMetaData.TYPE_STRING, 50, 50, JCoListMetaData.EXPORT_PARAMETER);

exports.add("ECHOTEXT", JCoMetaData.TYPE_STRING, 50, 50, JCoListMetaData.EXPORT_PARAMETER);

exports.lock();

JCoFunctionTemplate jcofunctiontemplate = JCo.createFunctionTemplate(name, imports, exports, null, null, null);

jcorepository.addFunctionTemplateToCache(jcofunctiontemplate);

JCoServerFunctionHandler stfcConnectionHandler = new StfcConnectionHandler();

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

factory.registerHandler(name, stfcConnectionHandler);

server.setCallHandlerFactory(factory);

server.start();

I am not sure if there is any risk or issue with this design. Can anyone confirm?

Thanks!

Former Member
0 Kudos

.

Edited by: Arnfried Dötsch on Apr 3, 2009 10:40 AM