Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Unit-4 - ASP - Net and Web Development - Part-4

Uploaded by

msself02
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Unit-4 - ASP - Net and Web Development - Part-4

Uploaded by

msself02
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

UNIT – 4

ASP.Net and Web Development


PART – 4_Web Services
Outline
 Creating and Consuming Web Services
 XML WebServices
 Designing XML WebServices
 Protocols and Terms
 Create Web Service
Creating & Consuming Web Service
• Web service means when one website requests other website for providing
particular service.
• Web service means communication in between websites regardless of in
which programming language it develops.
• Web Service is an application that is designed to interact directly with
other applications over the internet.
• Web Services are small units of code and independent of operations system
as well as programming language.
• Web service client is an application which uses a Web service.
• Once Web Service is developed it uploads to the server then it is used by
web methods.
• For example, Yahoo provides web service of whether forecasting, news
updates, stock market status etc.. We call these services by calling
methods of it and display the information in our website.
• Some website provides paid web service.
Creating & Consuming Web Service

Customer Internal System


Request

Processing

Internet
SOAP / HTTP

DataBase
Response
XML Web Service
• Main advantage of Web Service is Web Service messages are formatted as
XML, a standard way for communication between two incompatible
system. And this message is sent via HTTP, so that they can reach any
machine on the internet without being blocked by firewall.
• Advantages of Web service over COM and DCOM are :
1. COM provides platform services to a component while web service is
simply a program that communicates through message.
2. DCOM is based on the original Distributed Computing Environment
standard Remote Procedure Call while XML Web services are based
on open Web standard that are broadly supported.
3. Web services supports interoperability that means Cross platform
support.
4. Web services are loosely coupled means it can be extended.
Designing XML Web Service
• Surety of asynchronous communication done between a Web Application
that requests a Web Service and a Web server that provides the Web
Service.
• Try to create minimum methods.
• Follows oops concept to create Web Service.
• Minimize the time of response from Web Server to Web Application using
catch concept.
How web service work?
1. Discovery – Searches UDDI site for the specific Web Service.
2. Description – A detail of the selected Web service is returned to the client
application as a WSDL file.
3. Proxy creation – A local proxy to the remote service is created.
4. SOAP Message Creation – A SOAP / XML message is created and sent to
the URL specified in the WSDL file.
5. Listener – A SOAP listener at the host site receives the call and interprets
it for the Web service.
6. The Web Service – Performs its function, and returns the result back to
the client, via the listener and the proxy.
Protocols and Terms
1. XML
• It stands for Extensible Markup Language.
• XML is platform independent language.
• XML is a common standard for storing, carrying and exchanging data.
• Web service is called by web method and the argument – return values are
passed or returned as XML language.

2. SOAP
• SOAP stands for Simple Object Access Protocol.
• SOAP is a communication protocol.
• SOAP defines a uniform way of passing XML-encoded data.
• SOAP is remote procedure calls transported via HTTP.
• SOAP is a way by which method calls are translate into XML format and
sent via HTTP.
Protocols and Terms
3. WSDL
• WSDL stands for Web services Description Language.
• WSDL is an XML-based language used to define web service and to
describe how to access them.
• WSDL is an XML document.
• WSDL specifies the location, purpose, methods and format of the methods
of the Web service.
• It contains tags like <types>,<message>,<portType> and <binding> to
specify Web service.
• WSDL is an integral part of UDDI, an XML-based worldwide business
registry.
• WSDL is the language that UDDI uses.
Protocols and Terms
4. UDDI
• UDDI stands for Universal Description, Discovery and Integration.
• UDDI is a directory service where business can register and search foe
Web service.
• UDDI is a directory for storing information about web services.
• UDDI allows you to find web services by connecting to a directory.
• A description of the selected Web service is returned to the client
application as a WSDL file.
• UDDI is platform independent, open framework.
• UDDI can communicate via SOAP, CORBA, Java RMI Protocol.
• UDDI is built into the Microsoft .NET platform.
Web Service Example
• Step – 1 : Create new ASP.NET Website and add WebService.
Web Service Example
Web Service Example
Web Service Example
• Step – 2 : Default view of Web Service.

WebService :

using System.Xml.Linq;
<summary>
Summary Description for WebService
</summary>

[WebService(Namespace = “http://tempuri.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
Web Service Example
public class WebService : System.Web.Services.WebService
{
public WebService()
{
}
[WebMethod]
{
public string HelloWorld()
{
return “Hello World”;
}
}
}
Web Service Example
• Step – 3 : Add Web Method

[WebMethod]
public int add(int a , int b)
{
return a + b ;
}
Web Service Example
[WebMethod]
public string CheckOddandEvenMethods(int a)
{
string results;
if (a % 2 == 0)
{
return results = a + "_" + "Is a Even Number";
}
else
{
return results = a + "_" + "Is a odd Number"; }
}
}
Web Service Example
• Step – 4 : Run it
Web Service Example
Web Service Example
• Step – 5 : Now create new ASP.NET Website to check and add web
Service Reference
Web Service Example
Web Service Example
Web Service Example
Web Service Example

You Can call Methods of


WebService
Like
MyFood()
CheckOddandEvenMethods()
Web Service Example
Question
1. What is web service? Explain how to create and consume web service.
(Winter 2014)
2. Explain web service architecture in brief. (Winter 2014)
3. Write a short note on XML Web Service. (Summer 2014 , Winter 2013)
4. What is Web service? Create a web service to add two numbers. Also
give code to consume it. (Summer 2017 , Winter 2018, Summer 2018)
5. What is End to DLL Hell? (Summer 2017)
6. What is Web Services? Create a Web Service of your choice. Also give
code to consume it. (Winter 2017)
You
a n k
T h

You might also like