Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-22
8
Medium Priority
?
1,400 Views
Last Modified: 2012-06-27
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

0
Comment
Question by:Rodney Helsens
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Expert Comment

by:praneetha
ID: 12123224
you don;t want to do...

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

in visual studio.net

0
 
LVL 7

Assisted Solution

by:God_Ares
God_Ares earned 400 total points
ID: 12123365
do you or don't you want to make a proxy class? like praneetha is describing. Dou you want to call the same service from other locations/urls? Or should nothing be known of the webservice except it's adress, and dynamicly call functions?

regards

Floris Briolas
0
 
LVL 5

Expert Comment

by:tomasX2
ID: 12123970
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 9

Author Comment

by:Rodney Helsens
ID: 12124168
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
0
 
LVL 15

Assisted Solution

by:praneetha
praneetha earned 600 total points
ID: 12124183
can my c# class have a .config file even if I am building a .dll and dropping it into another project?


yes you can....
0
 
LVL 5

Accepted Solution

by:
tomasX2 earned 1000 total points
ID: 12124213
you could add the necessary configuration settings to the app.config thats already there....
in other words you share the app.config file.

Just put the settings into the app.config file.
0
 
LVL 9

Author Comment

by:Rodney Helsens
ID: 12124314
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
0
 
LVL 5

Expert Comment

by:tomasX2
ID: 12124328
just the dll.
all of the other stuff is project specific stuff.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

971 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