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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | @Override
public HttpResponseObject execute(HttpRequestObject request) {
JSONObject body = request.getBody();
LogService logger = sp.buildLogService();
logger.info( "Running Custom Code Hello World " , moduleName);
JSONObject jsonResponse = new JSONObject();
try {
jsonResponse.put( "name" , "App42CustomCodeTest" );
} catch (JSONException e) {
}
return new HttpResponseObject(HTTP_STATUS_SUCCESS, jsonResponse);
}
|