Link to home
Start Free TrialLog in
Avatar of Rodney Helsens
Rodney Helsens

asked on

HOWTO: Calling a asp.net web service from Windows Service?

I have a c# class that is invoked from a windows service, I am trying to call an asp.net web service from this class, I'm a bit confused with the web references..

I have the class which the windows services calls. I need to put this class into the directory where the windows service runs, in regards to the web references.. how do I reference the web service located at http://www.anotherserver.com/services/service.asmx without hard coding this into the class?

thanks in advance

Avatar of praneetha
praneetha

you don;t want to do...

project -> add web reference -> and enter http://www.anotherserver.com/services/service.asmx

in visual studio.net

SOLUTION
Avatar of God_Ares
God_Ares

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you add the web reference and have it dynamic.
this will add a application.exe.config file to the project
there you can change the url of the web service.

http://www.codeproject.com/cs/webservices/CallXMLWebServices.asp
Avatar of Rodney Helsens

ASKER

I appreciate your comments...

I think the problem is that the windows service (which my class is called from) already has it's own app.config file, it is a seperate project.

The windows services was built by another developer, not my project...it dynamically loads classes (which inherit the appropriate interface) based on events..

I am creating this class outside of the project for the windows service... so that is where my confusion comes in with the references... can my c# class have a .config file even if I am building a .dll and dropping it into another project?

thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, thanks. I think I will share the app.config file then.. but what other files from my web service project will I need to copy over to the windows service project for it to work, besides the .dll?

I see the web references folder is created in my project. do I also need to copy this web references folder to the other project? or just the .wsdl file? or can I just copy my dll?

As you can see, I have not grasped the concept of this proxy class stuff, how it works

thanks for helping me
just the dll.
all of the other stuff is project specific stuff.