Show TOC

Procedure documentationUsing P4 Protocol Over a Secure Connection Locate this document in the navigation structure

 

You can set up a secure P4 communication using both SSL and HTTPS protocols as underlying transport layers.

Prerequisites

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

The following example shows 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:

Syntax Syntax

  1. 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);
    			InitialContext ctx = new InitialContext(p);
    			System.out.println("NamingClient.run1 ctx : " + ctx);
    		}
    		catch(javax.naming.NamingException e)
    		{
    			System.out.println(">> Exception : " + e.getMessage());
    			e.printStackTrace();
    		}
    	}
    
End of the code.