Using Enum with Web Services Proxy

asp.net United States
  • 17 years ago

    Does anyone know of a way to have a web service proxy access a public enum from a Web Service.  When I create my enum in the Web Service, its values and enum declaration don't come across in the proxy class.  I am using it to generate a return code for a soap message and want to compare the return code in the soap message to the enum constants for exception handling.


    try{
        myObject.DoSomething();  //Generates SOAP Fault
    }
    catch(SoapException se){
        //Convert the SOAP Fault:detail errorcode to integer and compare it to the enumeration constant.
        int theErrorCode = Convert.ToInt32(se.Details.SelectSingleNode("ErrorCode").InnerText);
        if (theErrorCode = myObject.ErrorEnum.EnumCodeOne){
            proccess request...
        }
        else if(theErrorCode = myObject.ErrorEnum.EnumCodeTwo){
            process other request
        }
    }


    Any ideas on how to do this other than explicitly modifiying the proxy and placing the enum in there manually?

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay