SOAP Exceptions

Catching Errors in ECGridOS™

As in all good programming, trapping error situations is key to a great user experience. ECGridOS makes extensive use of SOAP Exceptions to help the developer along when problems occur.

There are two types of SOAP errors that can by thrown by ECGridOS. The first is by the Framework itself, primarily syntactic, and the second is by the ECGridOS system, syntactic and semantic.

Framework Exceptions

The most common Framework Exception is for missing parameters, as with web services all parameters are required. Additionally, an exception generated due to internal server errors will likely throw a Framework Exception.

ECGridOS Exceptions

When ECGridOS throws an exception, it creates a specifically formatted <detail></detail> node that is included in the SOAP Exception.

details XML Node

  <ErrorString>Invalid data length.</ErrorString>
  <ErrorMessage>Too Integer (max=35)</ErrorMessage>

By parsing out the details node, you can determine programmatically what happened and make corrective actions. The various ECGridOS Error Codes are listed at the bottom of this section.

The system will detect and report the attempt to create duplicate IDs, redundant Interconnect Requests, unauthorized access and a host of data errors.

The following code snippet shows how to catch and parse SOAP Exceptions in Visual Basic.

Visual Basic

Imports System.Xml

Class ErrorInfo
    Public ErrorCode As Short
    Public ErrorString As String
    Public ErrorItem As String
    Public ErrorMessage As String

Private Sub SomeFunction()
errInfo As ErrorInfo
        Dim parcels() As net.ecgridos.ParcelIDInfo = _
         ecgridos.ParcelInBoxArchiveEx(SessionID, _
                                       NetworkID, _
                                       MailboxID, _
                                       BeginDate, _
                                       EndDate, _
                                       ECGridID1, _
                                       ECGridID2, _
    Catch ex As SoapException
        errInfo = CatchException(ex)
    End Try
End Sub

Private Function CatchException(ByVal ex As SoapException) As ErrorInfo
    Dim doc As New XmlDocument
    Dim Node As XmlNode
    CatchException =
New ErrorInfo
    Node = doc.DocumentElement.SelectSingleNode(
    If Node Is Nothing Then
        'This picks up Framework generated SOAP Exceptions
        With CatchException
            .ErrorCode = -1
            .ErrorString = ex.Message
            .ErrorItem =
            .ErrorMessage = ""
        End With
        'This picks up ECGridOS generated SOAP Exceptions
            .ErrorCode =
            .ErrorString = Node.SelectSingleNode(
            .ErrorItem = Node.SelectSingleNode(
            .ErrorMessage = Node.SelectSingleNode(
        End With
    End If
End Function

ECGridOS Error Codes

1 Session timeout
2 Access denied
3 Not found
4 Invalid ID
5 Duplicate ID
6 ID exists on network
7 Invalid data type
8 Invalid data length
9 Data error
10 SQL Error

© 2008-2011, Loren Data Corp.
All rights reserved.
ECGrid is a registered service mark of Loren Data Corp.
ECGridOS is a service mark of Loren Data Corp.