cancel
Showing results for 
Search instead for 
Did you mean: 

JEE Application using JRA - dynamically add Destinations

jochen_willeke
Explorer
0 Kudos

Dear folks,

right now we are trying to change a standalone Java-Applikation (which uses JCo3) to be a JEE-Application, running on top of a SAP AS Netweaver Java.

As far as I understood, one may not use JCo3 as it can be used from within a standalone Java-Application, as you cannot register your own Destination-Provider. This call:

     com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(provider);

will cause an exception. While searching the web, I found that SAP JRA might be the way to go, but there is one thing that bothers me. It seems, that one would have to configure each possible Target for outgoing JCo-Connections within the SAP Netweaver Administrator (Configuration Next navigation step Management Infrastructure Next navigation step Application Resources) manually, see e.g. the ressource "eis/SAPJRAFactory".My question is, is there any way, how to create my destinations from within the JEE Application?

Cheers and thanks,
Jochen

Accepted Solutions (1)

Accepted Solutions (1)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jochen,

it is not necessary to bring always your own implementation of DestinationDataProvider with you. Not in arbitrary application servers and in particular not in SAP Appllication Server Java. In the latter, it is even not possible as there is already an implementation included. Via DestinationService, you can administrate destinations for RFC connectivity, and those are then used by JCo. JCo itself is also included in an embedded version with a tiight integration into the application server, which means it is not necessary to deploy it.

With regard to application code: with the JCo 3.0 APIs, which are also available in AS Java from 7.10 onwards, there is a shift in the application paradigm: applications concentrate on their application code and don't have to deal so much with infrastructure and technical connectivity management. I.e. assume that there is a DestinationDataProvider, assume there is a SessionReferenceProvider. Do not mix those infrastructure parts into your application and implement the application simply according to the business logic.

And one more remark: It's possible and ok to use JCo 3.0 APIs directly within AS Java for client side communication with an ABAP system.

Best regards,

Markus

jochen_willeke
Explorer
0 Kudos

Hi Markus,

thanks for your explanation, but sadly I don't really understand what I have to do. My Idea is as following. We have a remote DB, where all the information about the ABAP Systems is stored (systemnumber, client, hostname, user, password).

Next thing I do is connect to the DB and iterate over all the ABAP Systems do an RFC call using JCo to those systems. This is working fine, when using a standalone Java-App. What I do is, creating a properties object:

Properties connectProperties = new Properties();

connectProperties.setProperty(DestinationDataProvider.JCO_DEST, "AS_ABAP");

......

Create my own DestinationDataProvider and register it:

DestDataProvider provider = new DestDataProvider();

com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(provider);

Pass the properties to it:

provider.changePropertiesForABAP_AS(connectProperties);

And finally retrieve the destination:

JCoDestination destination = JCoDestinationManager.getDestination("AS_ABAP");

Now I want to do this on an JEE app, which as you say, has its own DestinationDataProvider. But I do not see how, to pass my own properties-object to this DestDataProvider. Is there any way to do this?

Thanks in advance and cheers,

Jochen

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jochen,

on AS Java it is not necessary to read destination configuration from a different place - in your case an arbitrary database. You don't need an own DestinationDataProvider. The destination configuration is stored in the database of the AS Java, which is then retrieved by the builtin DestniationDataProvider, whenever you try to use a destination with JCo. From your code snippet above In your application oinly JCoDestination destination = JCoDestinationManager.getDestination(destinationName); should remain, where destinationName is the destination to use and such a destination of type RFC should have been configured in NetWeaver Admin in the Destination Servvice UI.

Best regards,

Markus

jochen_willeke
Explorer
0 Kudos

Hi Markus,

so it is, like assumed. The only way would be to add all ABAP Systems manually from within the NWA, thats bad news for me, but it is as it is

Thank you for your effort,

Jochen

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jochen,

it is not the only possibility. But the one that makes sense the most. There should be a single location in one system that allows the configuration of such destinations. Otherwise it is pretty confusing, if you condigure destinations for application A in place a and destinations for application B in place b. Nevertheless, there is also the Destination Service API, with which you could manipulate destinations programmatically. Perhaps this is of use for you, but is certainly AS Java specific.

Best regards,

Markus

Answers (0)