Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-04-24
4
Medium Priority
?
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 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 41

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.   …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

636 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