Title: Exception Post by: piotrsw on January 27, 2012, 01:43:39 PM In case of exception my xml-rpc server returns:
<value><struct> <member><name>faultCode</name><value><int>116</int></value></member> <member><name>faultString</name><value><string>Error description</string></value></member> </struct></value> In OnReturn event i can get Result.asException but it returns string value. How to get faultCode and faultString from Result? Title: Re: Exception Post by: D.Tkalcec (RTC) on January 27, 2012, 02:19:44 PM If you get a FaultCode as part of the XML-RPC result, the "asException" string will contain the FaultCode as well as the FaultString in the following format:
'#'+faultcode+':'+faultstring In other words, if you have received FaultCode '116' and FaultString 'Error descriotion', then "asException" will return: '#116:Error description' The same way, if you are writing a Server and you want to return error message with FaultCode '116' and FaultString 'ErrorDescription', you would need to set the asException value to '#116:ErrorDescription'. Note: A FaultCode of 0 (zero) is handled as "no fault code" and will result in "asException" containing only the FaultString, without the preceding "#0:'. In other words, if "asException" is returning a string which doesn't start with '#', then the Server has either sent a FaultCode 0, or hasn't explicitly set a FaultCode (left empty or null). Best Regards, Danijel Tkalcec |