How do I access global variables in a webservice application?

Posted on 2004-10-29
Last Modified: 2008-01-09
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?
Question by:zandur
    LVL 1

    Expert Comment

    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.

    LVL 28

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: From Zero to Hero with Nodejs & MongoDB

    Interested in Node.js, but don't know where to start or how to learn it properly? Confused about how the MEAN stack pieces of MongoDB, Expressjs, Angularjs, and Nodejs fit together? Or how it's even possible to run JavaScript outside of the browser?

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now