Show/Hide Toolbars

Therefore Web API Programming Interface 1.0

 

If you connect to a Web API server from any .Net code (for example C# or VB.NET) in case of a server side error, you will get FaultException which represents a SOAP fault.

In a client, catch FaultException objects to handle faults. Exceptions which have occurred during the Web API Server process are logged in the Event Log.

 

For debugging purposes you can turn on a mode to include exception details in faults. See 'API - Detailed Exception' setting in Web API Configuration section of this document for more details.

 

 

Sample code for handling exceptions. You can process different exception types in different ways.

For more details contant your msdn documentation specialist.

 

 try

 {

         GetCategoriesTreeresponse categoryTree = channel.GetCategoriesTree(new GetCategoriesTreeParams());

         //process response

         categoryTree.TreeItems...

 }

 catch (FaultException e)

 {

         //process Web API specific exceptions here

         ...

 }

 catch (CommunicationException e)

 {

         ...

 }

 catch (TimeoutException e)

 {

         ...

 }

 catch (Exception e)

 {

         ...

 }

 

 

A Sample of a SOAP fault response from the server:

 

HTTP/1.1 500 Internal Server Error

Content-Length: 789

Content-Type: text/xml; charset=utf-8

Server: Microsoft-HTTPAPI/2.0

WWW-Authenticate: **************=

Date: Wed, 4 Mar 2015 01:01:01 GMT

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

 <s:Body>

         <s:Fault>

                 <faultcode>

                         s:Client

                 </faultcode>

                 <faultstring xml:lang="en-US">

                         Incorrect usage. Category Field No: 1679.

This Field does not belong to category/case definition No: 29

                 </faultstring>

         </s:Fault>

 </s:Body>

</s:Envelope>

 

 

© 2024 Therefore Corporation, all rights reserved.