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?

Improve company productivity with a Business Account.Sign Up

mmarinovConnect With a Mentor Commented:
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

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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.