Solved

Consuming and creating a webservice refernce WITHOUT using the VS Studio option “Add Reference”?

Posted on 2014-04-24
4
195 Views
Last Modified: 2014-04-24
I'm trying to create class/object and have it consume a web service from within the class/object WITHOUT using the VS Studio option “Add Reference”?
 
I’m trying to create a dll that developers can add to their project without having to add a web reference. I want my object/class to do it without them having to deal with it.
 
VB.NET syntax, but I would take C# example as well.
0
Comment
Question by:sweoff
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 40020752
You can create a project who's output is a library.  

Add the reference in your own library, and then expose the function calls inside a class.

When you compile you'll have a DLL that you can publish, and then they can add a reference to the DLL.

I'm not sure that it's really worth it though . . . any developer should be able to figure out how to use the service reference, and keep in mind that every time you update the service you'll also have to update the DLL.
0
 

Author Closing Comment

by:sweoff
ID: 40020840
Thanks!
0
 

Author Comment

by:sweoff
ID: 40020852
Can I make a parameter within the class to pass the URL for the web Reference?
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 40021089
I would make it part of your constructor.

so Class MyWebServiceClass
{
  private string _URL;
  public string URL {get return _URL; }
  public MyWebService ws;

  MyWebService()
{
   ws = new MyWebService();
   _URL =  "defaulturl";
   ws.Url =  _URL
}

  MyWebService (string theUrl)
 {
   _URL = theUrl;
    ws = new MyWebService();
   ws.URL = _URL;
}
     
}

something like that . ..  all pseduo code.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

12 Experts available now in Live!

Get 1:1 Help Now