LEADTOOLS WCF (Leadtools.Services.Raster.FaultContracts assembly)

RasterFault Class

Show in webframe
Example 





Members 
The RasterFault class provides information about exceptions that occur on the client side.
Object Model
Syntax
[DataContractAttribute()]
public class RasterFault 
'Declaration
 
<DataContractAttribute()>
Public Class RasterFault 
'Usage
 
Dim instance As RasterFault

            

            
[DataContractAttribute()]
public ref class RasterFault 
Remarks

The RasterFault class defines an ErrorId and an ErrorMessage property that can be examined to determine the cause of an error.

Example
Copy Code  
Imports Leadtools.Services
Imports leadtools.services.datacontracts._2009._01
Imports leadtools.services.raster.datacontracts._2009._01
Imports leadtools.services.raster.faultcontracts._2009._01
Imports leadtools.services.imageprocessing.datacontracts._2009._01

Public Sub RasterFaultExample()
   Dim client As EffectsProcessingServiceClient = New EffectsProcessingServiceClient()
   Dim sourceBinaryData As RawBinaryData = New RawBinaryData()
   sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp"))

   Dim convertOptions As RasterConvertOptions = New RasterConvertOptions()

   convertOptions.Source = sourceBinaryData
   convertOptions.Destination = Nothing
   convertOptions.Format = RasterImageFormat.Bmp
   convertOptions.FirstPage = 1
   convertOptions.LastPage = 1
   convertOptions.BitsPerPixel = 24
   convertOptions.QualityFactor = 2

   Dim destBinaryData As RawBinaryData = Nothing
   Dim response As CommandResponse = Nothing
   Try
      Dim request As SharpenRequest = New SharpenRequest()

      request.ConvertOptions = convertOptions
      request.RegionData = Nothing
      request.Sharpness = 5000

      ' pass invalid argument
      response = client.Sharpen(request)
   Catch ex As FaultException
      Console.WriteLine(ex.Message)
   Finally
      If Not response Is Nothing Then
         If Not response.Destination Is Nothing Then
            If TypeOf response.Destination Is RawBinaryData Then
               File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "fault.bmp"), (TryCast(response.Destination, RawBinaryData)).Data)
            End If
         End If
      End If
   End Try

   client.Close()
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools.Services;
using leadtools.services.datacontracts._2009._01;
using leadtools.services.raster.datacontracts._2009._01;
using leadtools.services.raster.faultcontracts._2009._01;
using leadtools.services.imageprocessing.datacontracts._2009._01;

public void RasterFaultExample()
{
   EffectsProcessingServiceClient client = new EffectsProcessingServiceClient();
   RawBinaryData sourceBinaryData = new RawBinaryData();
   sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir,"image1.cmp"));

   RasterConvertOptions convertOptions = new RasterConvertOptions();

   convertOptions.Source = sourceBinaryData;
   convertOptions.Destination = null;
   convertOptions.Format = RasterImageFormat.Bmp;
   convertOptions.FirstPage = 1;
   convertOptions.LastPage = 1;
   convertOptions.BitsPerPixel = 24;
   convertOptions.QualityFactor = 2;

   RawBinaryData destBinaryData = null;
   CommandResponse response = null;
   try
   {
      SharpenRequest request = new SharpenRequest();

      request.ConvertOptions = convertOptions;
      request.RegionData = null;
      request.Sharpness = 5000;

      // pass invalid argument
      response = client.Sharpen(request);
   }
   catch (FaultException ex)
   {
      Console.WriteLine(ex.Message);
   }
   finally
   {
      if (response != null)
      {
         if (response.Destination != null)
         {
            if (response.Destination is RawBinaryData)
               File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "fault.bmp"), (response.Destination as RawBinaryData).Data);
         }
      }  
   }

   client.Close();
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms

See Also

Reference

RasterFault Members
Leadtools.Services.Raster.FaultContracts Namespace

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Applications developed with LEADTOOLS WCF components require runtime licenses. Server licensing is required for applications on a server. For more information, refer to: LEADTOOLS Toolkit Features