Consuming P6 EPPM Web Services over HTTPS (SSL) From Java using HTTP Cookies (On-Premises Only)

The following Java example invokes the Login operation of the Authentication P6 EPPM Web Services over the Secure Sockets Layer.

import com.primavera.ws.p6.authentication.AuthenticationService;

import com.primavera.ws.p6.authentication.AuthenticationServicePortType;

import org.apache.cxf.configuration.jsse.TLSClientParameters;

import org.apache.cxf.frontend.ClientProxy;

import org.apache.cxf.transport.http.HTTPConduit;

//...

System.setProperty("javax.net.ssl.trustStore","C:/keystore_certs/server.keystore");

URL wsdlURL = new URL("https://localhost:8443/p6ws/services/AuthenticationService?wsdl");

AuthenticationService service = new AuthenticationService(wsdlURL);

AuthenticationServicePortType port = service.getAuthenticationServiceSOAP12PortHttp();

org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);

HTTPConduit httpConduit = (HTTPConduit)client.getConduit();

TLSClientParameters tlsParams = new TLSClientParameters();

tlsParams.setSecureSocketProtocol("SSL");

httpConduit.setTlsClientParameters(tlsParams);

port.login("admin", "admin", 1,true);



Last Published Thursday, May 2, 2024