executeCustomCode
This call invokes the CLI user exit in the UserCustom java class. This implies that there will be additional code written within the UserCustom class to support the call. The power of this is that you can extend the API with your own commands written for your own purposes, to complement the commands and calls documented in this guide.
Input
Class |
Name |
Type |
Required |
Details |
ExecuteCustomCodeRequest |
userId |
String |
Yes |
The callers user name |
ExecuteCustomCodeRequest |
password |
String |
Yes |
The callers password |
ExecuteCustomCodeRequest |
parameters |
Array[] |
Yes |
An array of name, value pairs. |
FieldMetaData |
name |
String |
Yes |
The field name |
FieldMetaData |
fixedValue |
String |
Yes |
The field value |
FieldMetaData |
value |
String |
No |
The field value |
Output
Class |
Name |
Type |
Required |
Details |
ExecuteCustomCodeResponse |
success |
boolean |
Yes |
True is succeeded False if failed |
ExecuteCustomCodeResponse |
returnCode |
String |
No |
See Appendix for details |
ExecuteCustomCodeResponse |
returnMessage |
String |
No |
Human readable message |
Example
public static void testExecuteCustomCode(EVSystemServiceStub stub) {
try {
ExecuteCustomCodeDocument reqEnvelope = ExecuteCustomCodeDocument.Factory.newInstance();
ExecuteCustomCodeRequest request = reqEnvelope.addNewExecuteCustomCode().addNewParam0();
request.setUserId(ServiceClientHelper.ADMIN_USER_ID);
request.setPassword(ServiceClientHelper.ADMIN_PASSWORD);
FieldMetaData[] parameters = new FieldMetaData[1];
parameters[0] = request.addNewParameters();
parameters[0].setName("foo");
parameters[0].setValue("bar");
request.setParametersArray(parameters);
ExecuteCustomCodeResponseDocument resEnvelope = stub.executeCustomCode(reqEnvelope);
ExecuteCustomCodeResponse response =
resEnvelope.getExecuteCustomCodeResponse().getReturn();
if (response.getSuccess()) {
System.out.println("success: [" + response.getReturnCode() + "] : " +
response.getReturnMessage());
} else {
System.out.println("failure: [" + response.getReturnCode() + "] : " +
response.getReturnMessage());
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("nnn");
}
}