Try OpenEdge Now
skip to main content
Web Services
Creating OpenEdge SOAP Web Services : Testing and Debugging OpenEdge SOAP Web Services : Working with SOAP faults : Handling SOAP faults programmatically
 
Handling SOAP faults programmatically
The client application should handle all SOAP faults. Many SOAP client toolkits convert SOAP faults to client exceptions that can be handled in a try...catch block. The following code is a VB.NET fragment from the sample applications that are available on the Documentation and Samples (doc_samples) directory of the OpenEdge product DVD:
Try
   ' Code to access the Web service
   ...
   Catch soapEx As System.Web.Services.Protocols.SoapException
      Dim detail As String, reqId As String
         detail = parseSoapException(soapEx.Detail, reqId)
         MsgBox(detail, MsgBoxStyle.Critical, soapEx.Message)
End Try
In this example, parseSoapException( ) is a client helper function to parse the SOAP fault detail provided in .NET sample code. You can find more examples like this in both the .NET and Java sample client applications. For more information on these sample applications, see Sample SOAP Web service applications.