Hi! I'm using Unity3D 4.6.0.f1 and App42 2.9.4
I used example for CustomCode from which i downloaded from this tutorial:
http://api.shephertz.com/tutorial/Server-Side-Custom-Code/?index=customcode-wrd
In Example i does not change anything:
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);
}
I deployed this example. And then i call this CustomCode from Unity3D.:
SimpleJSON.JSONClass jclass = new SimpleJSON.JSONClass();
jclass.Add ("data", data);
ServiceAPI sp = new ServiceAPI (Constant_App42.apiKey_App42,Constant_App42.secretKey_App42);
CustomCodeService ccs = sp.BuildCustomCodeService ();
ccs.RunJavaCode("MyCustomCode", jclass, customCodeCallback);
Sometimes it's work and i get correct response from CustomCode, but sometimes i get response with error:
successValue : {"app42Fault":{"httpErrorCode":400,"appErrorCode":1903,"message":"Bad Request","details":" Application Exception : com.shephertz.app42.paas.customcode.sample.MyCustomCode"}}
Why did i get this error? And what i need to do to escape this error?