Consuming P6 EPPM Web Services over the Secure Sockets Layer involves several steps:
- Setting up the application server to use SSL
- Creating client code that sets up and uses an SSL connection
The following additions in bold to the demo source provide an example of how you could implement client code that sets up and uses an SSL connection.
Note: The following snippet is for example purposes only and does not include all of the changes that would need to be made to the demo source to successfully use SSL with the demo.
private int readEPS()
throws Exception
{
String url = makeHttpURLString(m_demoInfo.hostname, m_demoInfo.port, EPS_SERVICE);
URL wsdlURL = new URL(url);
EPSService service = new EPSService(wsdlURL);
EPSPortType servicePort = service.getEPSPort();
Client client = ClientProxy.getClient(servicePort);
//..Set up and use an SSL connection
HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setSecureSocketProtocol("SSL");
httpConduit.setTlsClientParameters(tlsParams);
//..
List<EPSFieldType> epsFields = new ArrayList<EPSFieldType>();
epsFields.add(EPSFieldType.OBJECT_ID);
epsFields.add(EPSFieldType.ID);
epsFields.add(EPSFieldType.NAME);
// ParentObjectId will be null for all root level EPS
List<EPS> EPSs = servicePort.readEPS(epsFields, "ParentObjectId is null", null);
if ((EPSs == null) || (EPSs.size() == 0))
{
System.out.println("No EPS node available");
return 0;
}
else
{
return EPSs.get(0).getObjectId().intValue();
}
}