hi all. i deploy a custom code. to this point everything ok. but, when I try to run it, I always get the same error
Exception :com.shephertz.app42.paas.sdk.java.App42Exception: Can not parse String :
Exception Message Can not parse String :
the my code is the same of the video tutorial
thi is the function of to send the signal to server
TestMyCustomCode.java
public static void testMyCodeInCloud() throws Exception {
String apiKey = "xxxxx";
String secretKey = "xxxxxx";
ServiceAPI sp = new ServiceAPI(apiKey, secretKey);
CustomCodeService customCodeService = sp.buildCustomCodeService();
String name = "customcodedemo";
JSONObject requestJSON = new JSONObject();
requestJSON.put("user", "demo");
customCodeService.runJavaCode(name, requestJSON, new App42CallBack() {
public void onSuccess(Object response)
{
JSONObject res= (JSONObject)response;
System.out.println("response is " + res) ;
}
public void onException(Exception ex)
{
System.out.println("Exception Message " + ex.getMessage());
}
});
}
this is the server code
MyCustomCode.java
@Override
public HttpResponseObject execute(HttpRequestObject request) {
JSONObject body = request.getBody();
// Build Log Service For logging in Your Code
LogService logger = sp.buildLogService();
//logger.debug(" Recieved Request Body : :" + body.toString(), moduleName);
// Write Your Custom Code Here
// ......//
logger.info("Running Custom Code Hello World ", moduleName);
// Create JSON Response Based on Your business logic
JSONObject jsonResponse = new JSONObject();
try {
jsonResponse.put("name", "App42CustomCodeTest");
//....//
//....//
} catch (JSONException e) {
// Do exception Handling for JSON Parsing
}
// Return JSON Response and Status Code
return new HttpResponseObject(HTTP_STATUS_SUCCESS, jsonResponse);
}