Creating the Consuming Application
Once the proxy dll is created
and placed in the
bin subdirectory, then it is a simple matter to
create the consuming application. All that is necessary is to add the
necessary reference to that dll in the consuming
application. This will be demonstrated for a web page created in a
text editor and also for a web page created in Visual Studio .NET.
As long as the signatures and return types of the exposed web service methods do not change, the proxy will continue to work. The signature of a web method consists of the name of the method and its parameter list and return value.
The web service can have additional web methods added without breaking the proxy, although the new web methods will not be visible to the consuming application until the proxy source code is regenerated and recompiled. Likewise, existing web methods can have their underlying code modified, but as long as their signature does not change, the proxy will still work fine.
Using a Text Editor
To create a web page that
will
consume a web service, create a normal ASP.NET web page. Then create
a bin subdirectory immediately below the
directory containing the .aspx file. Put the
compiled proxy dll in the
bin directory. Then in the source code of the
web page, instantiate the proxy class. This is either done in the
script block of the .aspx file, if it is coded
inline, or just inside the class definition, if it uses a code-behind
class.
Example 17-4 and Example 17-5 show a consuming web ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access