Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
Data Integration Samples
Data Integration Samples
nopaneltrue

You may want to secure a data service by authentication, encryption and the usage of signatures. This is facilitated in the WSO2 Enterprise Integrator (WSO2 EI) by applying security properties directly to the data service. This sample demonstrates how a service client is used to access a secured data service.

...

This service contains a single query/operation named showAllOffices, which returns all the office branches in a company.

Secure service client: When using a service client to access a secured data service, it must follow special steps in creating a secured connection to the service. The following code snippet is taken from the Axis2 service client used to access our sample secure data service.

Code Block
String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/SecureDataService";
System.setProperty("javax.net.ssl.trustStore", (new
File(CLIENT_JKS_PATH)).getAbsolutePath());
ConfigurationContext ctx = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null, null);
SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr);
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
client.engageModule("rampart");
options.setUserName("admin");
options.setPassword("admin");
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy(SECURITY_POLICY_PATH));

...