https://bz.apache.org/bugzilla/show_bug.cgi?id=59244

mdiianni <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from mdiianni <[email protected]> ---
Created attachment 33889
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33889&action=edit
Custom Java Library for SOAP WS-Security

This library should be installed on $APACHE_HOME/lib

How it works:
On jmeter test plan
Include a Thread Group
Include a HTTP Request sampler
Include a JSR223 Preprocessor
The HTTP request contains the XML to be signed and encrypted on plain text
The XML is picked up by the custom java library, which will include the
security header with timestamp, signature and body encrypted, to be returned
back to the HTTP sampler
Finally, HTTP sampler sends the request to configured endpoint.

Requirements:
SOAPSecurity.jar (compiled java class)
Keystore containing the private keys and certificates


Example content of the JSR223 preprocessor:

import com.example.wss.SOAPSecurity;
import org.apache.jmeter.services.FileServer;

// get SOAP message from parent sampler body
String soapData = sampler.getArguments().getArgument(0).getValue();

String baseDir = FileServer.getFileServer().getBaseDir();
String pathToKeystore = baseDir + File.separator + "keystore_files" +
File.separator + vars.get("SOAP.Keystore");
String keystorePassword = vars.get("SOAP.KeystorePass");
String pathToTruststore = baseDir + File.separator + "keystore_files" +
File.separator + vars.get("SOAP.Truststore");
String trustStorePassword = vars.get("SOAP.TruststorePass");
int timeToLive = Integer.parseInt(vars.get("SOAP.TTL"));
String signingAlias = vars.get("SOAP.SigningAlias");
String encryptAlias = vars.get("SOAP.EncryptingAlias");
String secureSoap = "";

try {
    secureSoap = SOAPSecurity.secureSoapMessageFromString(soapData,
pathToKeystore, keystorePassword, pathToTruststore, trustStorePassword,
timeToLive, signingAlias, encryptAlias);
}
catch (Exception ex){
    log.warn("Error in script", ex);
    throw ex;
}

// replace parent sampler body with secured SOAP message
sampler.getArguments().getArgument(0).setValue(secureSoap);
vars.put("SoapDataRaw", soapData);

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to