Microsoft Office Tutorials and References
In Depth Information
Chapter 14: Building Custom Solutions
Status Class
Each of the Excel Services web service methods has an out parameter or a return value of type Status .
The status object is used to return alerts with a next component state of Continue and for status
messages. The default Status return value is null (not a zero-length array), which occurs when there are
no alerts or status. The API returns an array of status structures when there are one or more alert or
status messages. The items in the array are in the order they were received from the ECS. The status
array is returned along with the normal return value of the method.
Following is an example of when a status is returned. In this example, an unsupported culture is used
for the OpenWorkbook method’s uiCulture parameter. The status structure includes three properties:
Message , Name , and Severity .
xlSessionId = xlEcsApi.OpenWorkbook(
out xlStatus);
Console.WriteLine(“Message: {0}”, xlStatus[0].Message);
Console.WriteLine(“Name: {0}”, xlStatus[0].Name);
Console.WriteLine(“Severity: {0}”, xlStatus[0].Severity);
This code writes the following information to the console, which shows the properties of the Status
that was returned for the OpenWorkbook method call. In this case, Excel Services is an English
installation (operating system and MOSS).
Message: UI culture (aa-zz) is not supported. Excel Services is using English
(U.S.) (en-US) instead.
Name: UnsupportedUICulture
Severity: Error
SOAP Fault Message
The ECS and WFE Excel Services components can return a second type of alert referred to as a Stop alert.
This type of alert is returned when the called method must be stopped and is not allowed to finish. The
out parameters of the method and the normal return value of the method are not output when a Stop
alert is returned.
Unexpected exceptions can also be returned. These exceptions and the Stop alerts are returned to the
caller as a SOAP Fault message. The following code is an example of a try-catch statement used to
catch a SOAP Fault for an Excel Services web service call:
//Excel Services Web Service method called from here
Search JabSto ::

Custom Search