xWeb Exception

An xWeb web method returns errors as SOAP Faults containing a specialized NetForum exception called XWebException. These exceptions can be trapped by your application and managed by inspecting <MessageDetail> and can be used for general diagnostics.

The xWebException is included in a more informatively typed object, depending on the type of error. There are three baseline types - SystemExceptionInfo, InvalidTokenExceptionInfo, and InvalidCredentialsExceptionInfo. This object type can be used to determine what kind of error message to provide to the user or to indicate that the call should be retried. These objects correspond to the following:

  • SystemExceptionInfo - Generic error, returned if not one of the two below
  • InvalidTokenExceptionInfo - The Authentication token passed in the SOAP header is not valid, either due to timeout or a previously failed call
  • InvalidCredentialsExceptionInfo - This is only returned from the Authenticate method when invalid username/password are provided

Sample

Here is an error message returned by the CreatePayment web method for an invalid credit card. Note that the actual error message is in the <MessageDetail> node.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: An error occurred
at Avectra.netForum.xWeb.xWebSecure.netForumXMLSecure.CreatePayment(XmlNode oNode) in c:\Inetpub\wwwroot\nf2_2007_01_03\xWeb\App_Code\Secure\netForumXML.asmx.cs:line 1168</faultstring>
<faultactor>http://localhost/nf2_2007_01_03/xweb/secure/netForumXML.asmx</faultactor>
<detail>
<SystemExceptionInfo xmlns="http://www.avectra.com/2005/">
<XWebException>
<Message>An error occurred</Message>
<MessageDetail>Invalid Credit Card Expiration Date. Invalid expiration date: 1206</MessageDetail>
<UserMessage/>
<Number>199</Number>
<Source>xWebClasses</Source>
<Class/>
<Library/>
<Method/>
<Line>0</Line>
<StackTrace>at Avectra.netForum.xWeb.FacadeData.CreatePaymentService(XmlNode InvoiceNode) in C:\Inetpub\wwwroot\nf2_2007_01_03\netForum2WebServices\xWebClasses\FacadeWebService.cs:line 3824
at Avectra.netForum.xWeb.xWebSecure.netForumXMLSecure.CreatePayment(XmlNode oNode) in c:\Inetpub\wwwroot\nf2_2007_01_03\xWeb\App_Code\Secure\netForumXML.asmx.cs:line 1147</StackTrace>
<SQLCommand/>
<ErrorType>GeneralError</ErrorType>
<ErrorKey>88fce459-6860-4ffc-a096-0b20be275a88</ErrorKey>
<Errors/>
</XWebException>
</SystemExceptionInfo>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

Here is the schema of the XWebException object:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" targetNamespace="http://www.avectra.com/2005/" xmlns:mstns="http://www.avectra.com/2005/" xmlns="http://www.avectra.com/2005/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="XWebException">
<xs:complexType>
<xs:sequence>
<xs:element name="Message" type="xs:string" minOccurs="0" />
<xs:element name="MessageDetail" type="xs:string" minOccurs="0" />
<xs:element name="UserMessage" type="xs:string" minOccurs="0" />
<xs:element name="Number" type="xs:string" minOccurs="0" />
<xs:element name="Source" type="xs:string" minOccurs="0" />
<xs:element name="Class" type="xs:string" minOccurs="0" />
<xs:element name="Library" type="xs:string" minOccurs="0" />
<xs:element name="Method" type="xs:string" minOccurs="0" />
<xs:element name="Line" type="xs:string" minOccurs="0" />
<xs:element name="StackTrace" type="xs:string" minOccurs="0" />
<xs:element name="SQLCommand" type="xs:string" minOccurs="0" />
<xs:element name="ErrorType" type="xs:string" minOccurs="0" />
<xs:element name="ErrorKey" type="xs:string" minOccurs="0" />
<xs:element name="Errors" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="XWebException" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

XWeb Exception Properties

  • Message - The exception message.
  • MessageDetail - More specific message and error code that is generated from within NetForum. Could contain technical details. This property will be the most useful to you in your diagnostics.
  • UserMessage - a non-technical "friendly" message that could be shown to an end user. May not always be available.
  • Number - the error number.
  • Source - the DLL library in which the error occurred.
  • Class -
  • Library -
  • Method -
  • Line - The line on which the error occurred.
  • StackTrace -
  • SQLCommand - If the error was thrown by a SQL command, this will be the SQL command that generated the error. This could happen from a syntax error, a violation of a constraint, or any other SQL error.
  • ErrorType - The Avectra.netForum.Common.ErrorNumber, enumerator (GeneralError, ValidationFailed, etc.), an internal NetForum error handling concept. In most cases the value will be GeneralError.
  • ErrorKey - The primary key of the Error Log record that is logged in fw_error_log table, if any.
  • Errors - May contain additional error(s).