Forum Discussion
Yoav_Seroussi
16 years agoOccasional Contributor
Hi Ole,
I attached the screenshot of the SoapUI.
Here's the code for the class:
Regards,
Mike
I attached the screenshot of the SoapUI.
Here's the code for the class:
package com.muzicall;
import org.apache.log4j.Logger
import com.eviware.soapui.impl.rest.RestRequestInterface
import com.eviware.soapui.model.propertyexpansion.PropertyExpansionContext
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import org.apache.commons.codec.binary.Base64
class Rbt4AllApiSignatureGenerator {
public static String sign(String key, RestRequestInterface request, PropertyExpansionContext context, Logger log) {
Set<String> sortedKeys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER)
sortedKeys.addAll(Arrays.asList(request.getParams().getPropertyNames()))
sortedKeys.remove("signature")
sortedKeys.remove("public_key")
log.info("Request parameters: ${sortedKeys}")
def restCall = ""
for (String s : sortedKeys) {
restCall += s
restCall += context.expand(request.getPropertyValue(s))
log.info(s + "=" + request.getPropertyValue(s))
log.info(s + "=" + context.expand("'" + request.getPropertyValue(s))+ "'")
}
log.info(context.expand('${#TestSuite#storeId}'))
...
sign the key
...
return signedKey;
}
}
Regards,
Mike