Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
Adding Existing Item to vb.net Project causes Errors 4 43
VB: Convert 2 dates to specific format 24 52
SQL Help 27 57
Get month and date in a format 4 31
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…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

790 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