WebServices - June 2023
WebServices - June 2023
WebServices - June 2023
References
Directory UDDI
directory
http://www.uddi.org
UDDI or
service
other
Locate a Service
http://www.ibuyspy.com/ibuyspy.disco
Request Discovery Document
Description WSDL
Web Service
http://www.ibuyspy.com/ibuyspycs/InstantOrder.asmx?wsdl
Request Service Description
MyService.asmx, MyService.asmx.cs
Page Directive:
<%@ Webservice Language=“C#”
Class=“myService” %>
Class [derived from System.Web.Ser-
vices.WebService]
Methods decorated with [WebMethod]
Virtual Directory hosting this Application
Consuming Web Services
Web Server S
Web service
description
Public web
method
Client of DemoWebService
Instantiating
web service
proxy Adding web
reference
creates
proxy
SOAP Request and Response
HTTP GET and POST exchanges
demo1.wsdl
demo1.disco
Web Service Application Structure
WebService Properties
HttpApplicationState
Share state among all users of an application.
HttpSessionState
Share state from page to page for one user.
HttpContext
Provides access to the server Request and Response objects.
HttpServerUtility
Provides CreateObject, Execute, and MapPath methods.
User
Supports authentication of user.
WebMethods
WebMethod methods can pass many of the C# and
CLR types
User defined objects can also be passed if they are se-
rializable:
.Net XML serializer will not serialize non-public members
Due to limitations of WSDL language
User defined types can only be passed with SOAP. GET and
POST won’t work.
The WSDL contract contains a schema description of any user
defined objects passed by a WebMethod
Web Service Clients
// use proxy
string result = proxy.demoMethod("string from client");
AutoGenerated Proxy
FileXferService
Public Interface:
string[] RequestFileNames();
Byte[] RequestFile(string FileName);
Browser
View
Client Application View
Creating a Web Service Project
Resulting “Generic” Web Service
Resulting “Generic” Test
Sample Soap Request
Sample “Generic” HTTP GET and POST
Create Console Client
You have to locate the
folder and asmx file, us-
Thank you