function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to catch an Apex webservice error message when you call it from a scontrol?



We have a scontrol that calls an apex webservice by the API an it was working fine until some days ago that it started to retrieve the following error message (not all the time):



ERROR: ........... {faultcode:'soapenv:Server', faultstring:'Unable to deserialize inputstream', }


This is the summary of the scontrol code:



<script src="/soap/ajax/13.0/connection.js"></script>
<script src="/soap/ajax/13.0/apex.js"></script>
<Script language="JavaScript">
// here goes another code
function callWS(){
var process = sforce.apex.execute('MyApexWebservice', 'Method1',{param1:1, starting: var_mystart, param2: var_for_param2, param3: var_for_param3 },
// here is another logic according to the received result.
// If process hasn´t finished yet it is recalled for next iteration
var_mystart = result[0];



 So now,


1: I would like to know what does that error message means? It seems to be a Server side problem.

2. Is there any possible way to catch that error? I already tried to add the "try catch" sentence to the scontrol and to the apex webservice but in none place it is catched.


I'd like to catch that kind of error message so I could implement a RETRY method.


Thanks to all of you who could help me.







Message Edited by Wilmer on 05-16-2009 09:02 AM
Best Answer chosen by Admin (Salesforce Developers) 

You should provide a onSuccess and onFailure callback method, something like:


var callback = { onSuccess: function(result){}, onFailure: function(error){} };


sforce.apex.execute(classname, method, params, callback);