Creating Custom Exception Classes for Web Services
Go Up to Using Web Services Index
When your Web Service application raises an exception in the course of trying to execute a SOAP request, it automatically encodes information about that exception in a SOAP fault packet, which it returns instead of the results of the method call. The client application then raises the exception.
By default, the client application raises a generic exception of type InvokeRegistry.ERemotableException with the information from the SOAP fault packet. You can transmit additional, application-specific information by deriving an ERemotableException descendant. The values of any published properties you add to the exception class are included in the SOAP fault packet so that the client can raise an equivalent exception.
To use an ERemotableException descendant, you must register it with the remotable type registry. Thus, in the unit that defines your ERemotableException descendant, you must add the InvokeRegistry unit to the uses clause and add a call to the RegisterXSClass method of the object that the global RemTypeRegistry function returns.
If the client also defines and registers your ERemotableException descendant, then when it receives the SOAP fault packet, it automatically raises an instance of the appropriate exception class, with all properties set to the values in the SOAP fault packet.
To allow clients to import information about your ERemotableException descendant, you must register it with the invocation registry as well as the remotable type registry. Add a call to the RegisterException method of the object that the global InvRegistry function returns.