Results 1 to 5 of 5

Thread: Exceptions with Web Services

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Malaysia
    Posts
    64

    Unhappy Exceptions with Web Services

    I have a web service that I want to throw some custom exceptions (lets say MyCustomException) and have the client be able to catch the exception in a Try...Catch block.

    But the problem is the Client does not have a reference to MyCustomException so as such I cannot catch it, is there anyway around this?

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    he can send a string saying "EXCEPTION"+MESSAGE and in the client u put a part that if says EXPCEPTION he will throw the exception..dont know if i explained well lol

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Malaysia
    Posts
    64
    Actually I have a MyCustomException class at the web service side that inherits from the ApplicationException class.

    I'm doing a (on the web service):


    if ('something that will be an error) then
    Throw New MyCustomException("Some message')
    end if

    and on the client side i want to do a:

    Try
    'Whatever
    Catch ex as MyCustomException
    'do something here
    Catch e as Exception
    'do something here for something unexpected
    End Try


    i'm not sure if this is the way to do it. I'm new to this exception thingy

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Isn't the Exception class included with your Web service proxy class? I dont see why what you have shouldnt work if so.
    Unless I dont quite understand what you mean.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Malaysia
    Posts
    64
    that's wat i'm scratching my head over also. I tried to catch the custom exception but it's like the class is not even there although i used the full name of the class. Another class (not an exception) I can see.

Posting Permissions

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



Click Here to Expand Forum to Full Width