Previous Topic

Next Topic

Book Contents

Consuming P6 Web Services over HTTPS (SSL) From Java using HTTP Cookies

The following Java example invokes the Login operation of the Authentication 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);


Copyright information