Solved

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

Posted on 2008-06-09
8
727 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:DidierSanDiego
  • 5
  • 3
8 Comments
 
LVL 1

Expert Comment

by:picsnet
Comment Utility
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.  
0
 
LVL 1

Expert Comment

by:picsnet
Comment Utility
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.  
0
 

Author Comment

by:DidierSanDiego
Comment Utility
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
0
 
LVL 1

Expert Comment

by:picsnet
Comment Utility
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
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Accepted Solution

by:
DidierSanDiego earned 0 total points
Comment Utility
I was able to add the Web Reference following these steps:

- Right Click "References" in the Solution Explorer
- Click "Add Service Reference"
- Click Advanced...
- Click "Add Web Reference..." (Notice the warning saying: "Add a Web Reference instead of a Service Reference. This will generate code based on .NET Framework 2.0 Web Services technology.")

I am guessing that there is a new way of creating and accessing Web Services on the .NET Framework 3.5.
0
 
LVL 1

Expert Comment

by:picsnet
Comment Utility
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.  
0
 

Author Comment

by:DidierSanDiego
Comment Utility
Thank you very much for the help.

Didier
0
 
LVL 1

Assisted Solution

by:picsnet
picsnet earned 500 total points
Comment Utility
no prob... i've gotten help here about 250 times... i my as well answer one...  I never go look for questions... They just added a new feature apparently that sends questions related to ones you've asked before to you...

Obviously its a good feature cause i sorta knew the answer, and it wasn't much effort to help.  

Tony
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How do I get the id from URL? 19 46
Limiting string to two deciamls 18 30
Unable  to create new object 9 19
XML & .net 5 16
IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

10 Experts available now in Live!

Get 1:1 Help Now