Select language:

 Using P4 Protocol Over a Secure Connection

Use

You can set up a secure connection for P4 communication. You can lay the P4 messages over both SSL and HTTPS protocols.

Prerequisites
  • You configured your J2EE Engine to use SSL. For more information, see Configuring the Use of SSL on the J2EE Engine .
  • You configured the port for secure connections that the P4 Provider Service running on the Java dispatcher listens to. Then, the client uses that port to open the secure connection in its request to the J2EE Engine.

For more information, see Managing the Underlying Transport Layers .

Procedure

In your client code, obtain the InitialContext to connect to the remote object using the following properties:

  1. Specify the port for the secure connection with the provider URL property.
  2. Specify the underlying transport layer you want to use. You use the TransportLayerQueue property with value SSL for P4 over an SSL connection, or HTTPS for P4 over an HTTPS connection.
Example

Below is an example of client code that obtains InitialContext using a specific transport layer. This transport layer ( SSL or HTTPS ) is specified by the transportType parameter provided in the command line when the following client code is executed:

public void init(String host, String port, String user, String pass, String transportType)
  {
  try
  {
  Properties p = new Properties();
  p.put("java.naming.factory.initial", "com.sap.engine.services.jndi.InitialContextFactoryImpl");
  p.put("java.naming.provider.url", host + ":" + port);
  p.put("java.naming.security.principal", user);
  p.put("java.naming.security.credentials", pass);
  // The transportType parameter has value ssl or https.
  // It is provided on the command line.
  p.put("TransportLayerQueue", transportType);
  ctx = new InitialContext(p);
  System.out.println("NamingClient.run1 ctx : " + ctx);
  }
  catch(NamingException e)
  {
  System.out.println(">> Exception : " + e.getMessage());
  e.printStackTrace();
  }
  }
Note

Make sure that the IAIK cryptographic libraries are included in the path of the client P4/SSL application. You can find these files in <central_instance>:/usr/sap/<sid> SYS/global/security/lib/tools.