Trying to connect via SoapUI. I can connect via REST but cannot connect via SOAP.
Here is the call that I'm making...I'm just trying to make the base getLead connection but am failing on auth. What is it that I'm doing wrong?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mkt="http://www.marketo.com/mktows/">
<!-- my mktowsUserIdfield begins with "MKTOWS_" and is the 'User ID' FIELD FROM ADMIN UI -->
My requestSignature below is calculated below. Perhaps this is what I'm messing up on. I'm calculating it in java as below:
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String text = df.format(new Date());
String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22);
String encryptString = requestTimestamp + "MKTOWS_XXX-XXX-XXX_X" ;
SecretKeySpec secretKey = new SecretKeySpec("[Encryption Key from admin UI]".getBytes(), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
byte rawHmac = mac.doFinal(encryptString.getBytes());
char hexChars = Hex.encodeHex(rawHmac);
String requestSignature = new String(hexChars);
Your code to generate the signature looks correct, so it is hard to say what is happening. I recommend posting the exact error that you are getting back.
Another approach is to generate the timestamp and hmac using sites like these:
1. Timestamp Generator / Converter - Timestampgenerator.com
2. Free Online HMAC Generator / Checker Tool (MD5, SHA-256, SHA-512) - FreeFormatter.com
Dave, thanks for taking the time to post. I don't think my issue is creating timestamps although I'll play with your suggestion. I will try the HMAC generator although I'm using the UI tool in this example and the java code you have posted on your site in the app. The abvove was sent via SoapUI to take the app out of the equation. Below is the result...its clearly an auth issue. I think that the signature creation has to be the issue but for SoapUI I'm pressing the create button in the admin UI app from our account and using it here so I don't know how it could be wrong. It has to be simple but I'm missing something...
<faultstring>20014 - Authentication failed</faultstring>
<message>Authentication failed (20014)</message>