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
TKDudeTKDude 

Partner API 6.0 SoapException vs SoapHeaderException

It seems that most API error results in a SoapHeaderException, where I can retreive the 'Code' property easily.

However, INVALID_SESSION_ID error throws a more generic SoapException. One cannot easily determine the fault without parsing a the 'Detail' Xml.

Questions:
Are there ANY OTHER faults that throws a SoapException?
Why is INVALID_SESION_ID fault special?
What is the recommended way of dealing with these faults? In the simplest form, I want to provide application specific error messages; or handle each kind of fault separately.
DevAngelDevAngel
Hi TKDude,

.NET does a poor job of handling enum values from our wsdls. The best way to handle the soap faults is by inspecting the StatusCode and using that to branch your error handling code. Unfortunately, StatusCode is missing from the SforceService class generated by .NET.

.NET will aggregate the info in the SoapException into the Message string of the more generic Exception class and you can parse out the StatusCode from that.

Hopefully, .NET 2.0 will do a better job in interpreting our WSI compliant wsdls.