Results 1 to 2 of 2

Thread: How to pass ValidationErrors in WCF fault

  1. #1
    Join Date
    Aug 2009
    Posts
    10

    Default How to pass ValidationErrors in WCF fault

    I am using the ParameterValidation aspect to validate the parameters provided to my WCF methods. This is working great.

    I am also using the ExceptionHandling aspect to wrap any exceptions that occur in my service methods in a WCF fault. To keep the code clean, I have a custom class that subclasses FaultException<ExceptionDetail> so I simply pass the exception into the constructor and the ExceptionDetail is automatically created and populated for me. This is working great as well.

    Unfortunately, the BCL implementation of FaultException and ExceptionDetail have no knowledge of the ValidationErrors property on the ValidationException so I lose visibility into the actual errors. How can I best get the errors included in my FaultException so I can report why validation failed in the client interface?

  2. #2
    Join Date
    Oct 2005
    Location
    Toulouse, France
    Posts
    1,407

    Default

    Hi,

    We will have to create your own ExceptionDetail class because you have to resolve message errors on the server side.

    Another solution is to create a custom advice for handling Validation exception.

    HTH,
    Bruno
    My english is as poor as my taylor is rich

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •