Solved

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

Posted on 2014-04-24
4
197 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 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