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
WilmerWilmer 

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

Hi,

 

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 },
function(result){
// here is another logic according to the received result.
if(result[0]!='0'){
// If process hasn´t finished yet it is recalled for next iteration
var_mystart = result[0];
settimeout("callWS();",90);
}
});
}
</script>

 

 

 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.

 

Regards,

 

Wilmer

 

 

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

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);