akremer
(André Kremer)
1
I found the following article and wanted to adjust it to my demand. Currently I do have problems to get information out of the processedResponseObject. I always receive a JavaException.
Webservice Connector - Create Account Operation - Empty Response
I just need to get the first object, as I only want to attach it in a WebServicesAfterOperationsRule for a “Create Account”.
Map responseMap = (Map) processedResponseObject.get(0);
This end up in a parse error.
Tried also to define it as a List/Array, but same issue.
In the Java Docs it is defined as List<Map<String, Object>>.
Thanks for help.
Hi Andre,
There is a code snippet in the below documentation. Please try it out
Web Services After Operation Rule
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Iterator;
//We can parse the response(rawResponseObject) to fetch from the respective executed Endpoint operation.
Map updatedMapInfo = new HashMap();
if (processedResponseObject != null){
for (Map iterateMap : processedResponseObject) {
if (iterateMap != null ) {
Set keySet = iterateMap.keySet();
for (String s : keySet) {
if (s.equals("given_name")) {
String forStr = (String) iterateMap.get("given_name");
forStr = "TEST"+ forStr;
iterateMap.put("given_name", forStr);
}
}
}
}
updatedMapInfo.put("data", processedResponseObject);
}
Map connectorStateMap = new HashMap();
connectorStateMap.put("refresh_token","refreshTokenGeneratedInAfterRuleScript");
updatedInfoMap.put("connectorStateMap",connectorStateMap);
return updatedMapInfo;
Regards
Arjun