Show TOC Start of Content Area

Background documentation Portal Destination Service  Locate the document in its SAP Library structure

The portal destination service can be called by portal applications for obtaining connections to any available back end which can be consumed by means of connectors deployed on the J2EE engine. The portal destination service is not limited, as is the connector gateway service, to creating connection only to systems in the portal system landscape.

Back-end connection definitions may be stored in various system landscape repositories. The ability of the portal destination service to establish connections to all of them results in the bringing of all available connectivity landscapes within the scope of the connector framework.

The portal destination service contains out-of-the-box implementations for connecting to:

·        Portal System Landscape

·        J2EE Destination Service

·        J2EE Web Service Security Service (Dynamic Proxy)

·        WebDynPro JCo Destinations

Each one of these back-end definition sources can connect to more than one type of back end. For example, the Portal System Landscape can hold connection definitions to a SAP system, a relational database system, and a Web Service. The Portal Destination service enables the client to get a list of destination names (filtered by their source and type). The client can also retrieve information for a given destination name, such as its source and type. The service also enables the client to get a connector framework connection to a given destination name.

The following table shows the relationship between back-end system definition sources and the connector framework connectors that can access them using the portal destination service.

Connector – Source Chart

Connector Type

SAP

Web Service

JDBC

Source

Portal System Landscape

ü

ü

ü

J2EE Destination

ü

ü

 

Dynamic Proxy

 

ü

 

WebDynPro JCo

ü

 

 

Note

In addition to the mapping in the table, any additional connector that may be deployed to the J2EE engine would be mapped only to the application for which it was created.

Extending the Service

The destination service is extensible and it is possible to write and register your own implementation of system landscape repositories. See the com.sap.portal.connectivity.destinations package in the Javadocs for more details.

Essential Information

The portal destination service API is exposed as a J2EE library and therefore can be consumed from any J2EE component type. To retrieve this service instance from a portal application, add com.sap.portal.ivs.connectorservice in the portalapp.xmlreferences list and use:

IDestinationsService destinationsService = (IDestinationsService) PortalRuntime.getRuntimeResources().getService(IDestinationsService.KEY);

To retrieve this service from another type of component, add to your component a reference to J2EE library com.sap.portal.services.api and use:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sapportals.portal.prt.registry.PortalRegistryFactory");

InitialContext context = new InitialContext(env);

IDestinationsService destinationsService = (IDestinationsService) context.lookup(IDestinationsService.SERVICE_JNDI_NAME);

Code sample for using this service:

String[] destinationNames;

String destinationName;

IDestinationWrapper destinationWrapper;

IConnection connection = null;

DestinationFilter destinationFilter1 = new DestinationFilter(IDestinationWrapper.SOURCE_PORTAL_SYSTEM_LANDSCAPE_SERVICE, IDestinationWrapper.TYPE_ALL);

DestinationFilter destinationFilter2 = new DestinationFilter(IDestinationWrapper.SOURCE_J2EE_DESTINATION_SERVICE, IDestinationWrapper.TYPE_SAP);

DestinationFilter[] destinationFilters = new DestinationFilter[] {destinationFilter1, destinationFilter2};

destinationNames = destinationsService.getDestinationNames(myUser, destinationFilters);

 

boolean hintAreCredentialsSet;

for (int i = 0; i < destinationNames.length; i++) {

destinationName = destinationNames[i];

try {

destinationWrapper = destinationsService.getDestinationWrapper(myUser, destinationName);

hintAreCredentialsSet = destinationWrapper.hintAreCredentialsSet(myUser);

if (hintAreCredentialsSet) {

connection = destinationsService.getConnection(myUser, destinationName);

} else {

// get credential (e.g. popup a logon window)

connection = destinationsService.getConnection(myUser, destinationName, "myUserName", "myPassword");

}

// consume the back-end

} catch (Exception e) {

// error handling

} finally {

if (connection != null) {

try {

connection.close();

} catch (ResourceException e1) {

// error handling

 

 

End of Content Area