Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.18 MB, 22 trang )
<span class='text_page_counter'>(1)</span><div class='page_container' data-page=1>
Controls help in reusability of visual as well as functional capabilities.
Custom web controls can be created in two ways:
Pagelets
Web Controls using C#
Pagelets are custom controls that look like an asp page, and have the
extension .ascx.
Web Controls render HTML automatically.
Custom Controls, which compose of other controls as well, are known
as composite controls.
The <b>System.Web.UI.INamingContainer</b> interface has no methods;
Explain Web Services
Create Web Services using ASP.net
Consume Web Services using various protocols
to be
Web Server
Web Server
Web Server
Constellation
Sites, services,
and devices
collaborate
Create a Web service
Define service interface and invocation methods
for Web services
Publish Web services on Intranet or Internet
Find Web service in order to use it
Invoke the web service in order to use it
Accessed over the web
Called using its Interface
Registered in a service registry
Standard Web protocols to communicate
Loose coupling
An important aspect of loose coupling is that Web
services are integrated <b>just-in-time</b> when they
are necessary.
Cross business integration
Improved efficiency
Closer customer relationships
Facilitation of just-in-time integration
Complexity reduction
Legacy applications
Potential risk of security in exposing the
application assets of an organization
XML support is inevitable
Cost of deploying the Web service technology is
slightly high
<%@ <b>WebService</b> <b>Language</b>="C#" <b>class</b>="TestWS" %>
<b>using System.Web.Services</b>;
class TestWS
{
<b>[WebMethod]</b>
public string SayHello(string name)
{
return "Hello " + name;
}
}
<b>Save the file with .asmx extension </b>
<b>Specifies that this asp page is a web service </b>
<b>Language in which the Web service is written </b>
<b>Class containing Web methods </b>
<b>Import namespace </b>
Methods using which a web service can be
HTTP-GET
HTTP-POST
SOAP
Using Web Service Proxies
<html><body>
<p>Calling a web service using the POST method </p>
<form name="form1" <b>method="POST" </b>
<b>action="http://localhost/test1.asmx/SayHello"</b>>
<p> Enter your name :
<input type="text" name="name">
</p>
<p>
<input type="submit">
</p>
</form>
</body>
</html>
Lightweight protocol used to exchange
information in a decentralized, distributed
computing environment.
Helps to access objects, services, and
Provides the extensibility required by HTTP
with the help of XML.
HTTP/XML based protocol that is capable of
invoking a method with specific values.
<b>SOAP – Simple Object Access Protocol </b>
Information about the web service, such as
the methods it contains, and the parameters
that need to be passed to these methods,
are described through WSDL language
Based on XML
Uses tags to define attributes of the service
<b>WSDL http://localhost/aspex/CH17/WebServiceDemo.asmx /n:FirstWS</b>
The file TestWS.cs created is converted into a .dll file using command:
<script language="C#" runat=server>
public void Page_Load(Object Sender, EventArgs e)
<b> FirstWS.TestWS WSObj = new FirstWS.TestWS();</b>
<b> Text1.Text = WSObj.SayHello("Scooby");</b>
}
</script>
<form>
<asp:TextBox id=Text1 runat=server/>
</form>
UDDI is used to locate:
Information on Web services offered by a business partner
List of providers for a particular Web service
Technical details about exposing a particular Web service
Companies offering a particular Web service
Helps to <b>register services</b> provided by the service
providers, so that they can be shared
Helps the <b>service consumers</b> or <b>Web users</b> to locate
the Web services
UDDI
API
Schema
UDDI
Services
UDDI
Specifications
(Business
Registrations)
<b>A service has two characteristics: </b>Interface and Registration.
Web services reduce the “communication-gap” among the Web applications,
enhancing interactivity. Web sites thereby group together to form a
constellation, providing users with a rich user experience
Advantages of Web Services
Cross business integration
Improved efficiency
Closer customer relationships
Facilitation of just-in-time integration
The extension of a Web service file in .NET is <b>.asmx</b>.
The [WebMethod] tag notifies the ASP.NET compiler that the method to follow
should be a Web method, which is to be exported onto the Web.
A Web service could be called from a browser, an ASP page or even another
WSDL is the short form for <b>Web Services Description Language</b>.
WSDL is the grammar for a Web service, or moreover, could be
thought of as a language that describes or portrays a Web service.
The proxy class does not contain any application logic. Instead, it
contains the transporting logic as to how the parameters would be
passed and the result retrieved.
The proxy class will also contain a list of all the methods that are
present in the Web service and their prototypes.
A proxy class can be created from any WSDL file.
UDDI is the abbreviation for <b>Universal Description, Discovery and </b>
<b>Integration</b>.
UDDI helps in registering the services provided by the service providers