How do I access global variables in a webservice application?

I've created a webservice application and declared some public enumerations int the global.asax. So far so good.
I created a web application with a web reference to the webservice application.
Here's my problem: How can I use the public enumerations in the webservice in my web application.
If I do a reference like:


This wont work. The only time it works is when I create a webmethod and use the enum as a parameter like so:

public void MyWebmethod (PublicEnum myEnum)
After the creation of this webmethod the enum PublicEnum is availble in my webapplication by the reference as above.

Does anyone know how I can access the public enum withous using it as a parameter?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You need to understand the nature of web services. You can't reference them and use variables declared in the web service. You should remember that the link between your app and web service is maintained through XML. XML is returned to your app whenever you invoke some method of the web service, otherwise, nothing is returned. Also, don't forget that web services are stateless.

Hi zandur,

the problem you have faced is because the enum is declared in the webservice - which is totaly different namespace from the web applications
you can use enum if you pass it as parameter the web application recognize this type because it is declared in the WSDL but if you don't the type is not passed there and you can not find it


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.