Link to home
Start Free TrialLog in
Avatar of DidierSanDiego
DidierSanDiego

asked on

How do I consume a Web Service from a C# Library Project ?

Hello,

I have no problem consuming a web service from an ASP.NET Web Application project. I add a Web Reference and after that  I can easily consume the web service and its methods.

Now if I want to create a C# Class Library Project to test my Web Service, how do I create a Web Reference to the service in order to consume it?

Thank you.

Didier
Avatar of picsnet
picsnet

You do it the same way.  I had a hell of a time with it though when I tried to do it the first time.  I can't remember what I did though to fix it.  I'll look for my old question and see if I told what I did...

ServiceEmailer.Emailer objEmailer = new ServiceEmailer.Emailer();     from class library... I  had added the web reference to the class library.  
Here was what I did to fix my problems...

Apparently it was something dumb and easy... i deleted the app.config, settings, and those kinda files.  Added the webservice and it worked.  
Avatar of DidierSanDiego

ASKER

Hello,

Thank you for your prompt reply.

I am unable to find a way to add a Web Reference from my project. How did you do this?

The only option I have is to add a Service Reference.

Didier
Add System.Web.WebServices to your project as a reference, maybe System.EnterpriseServices also... I got that as a reference, but I don't remember why... It could be anything.  

Then you might want to make sure that show all files icon is selected in the solution explorer
ASKER CERTIFIED SOLUTION
Avatar of DidierSanDiego
DidierSanDiego

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
don't know... I use 2008, but I have to use 2.0 framework still for older computers.  
i just add system.web.servservices to my project, and then i add a web reference.  

Or I might have just added the web reference, and then it brought in all those other references.... Hard to remember, I do web services so little.  
Thank you very much for the help.

Didier
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