Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1679
  • Last Modified:

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?
1 Solution
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


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now