SlideShare a Scribd company logo
1 of 10
Download to read offline
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 1
UNIT – 5 : AJAX, WSDL and SOAP
Contents:
5.1 AJAX and PHP: Similarities, Why we need to combine AJAX and PHP.
5.2 WSDL: Definition, Purpose
5.3 SOAP: Definition, Purpose
5.1 AJAX: AJAX stands for Asynchronous Java Script and XML. It allow the various client requests at
the server, the server should process the required processing, and automatically loads the page without
refreshing the page i.e without user need to move from one page to other page.
The following is the traditional client server model in which server after receive the requests from
clients, perform required processing, and shows the updated content on the web page when page is
refreshed only.
AJAX is based on the following architecture called internet request/response model using AJAX’s
asynchronous methodology.
The new ergonomic changes can occur on the new page without refreshing / user need not move the
pages.
XMLHTTPRequst: The XMLHTTPRequest object is instantiated for AJAX. This is created as an
ActiveX control by the Microsoft, whereas firefox and safari use basic Javascript object.
Methods:
a) Abort(): It stop the current request. When request is made to stop the request for a certain length
of time, this method is called.
b) getAllResponseHeaders(): It acquire full information on all HTTP headers which are being
passed.
Web page Server
New Content
on the page
after refresh
request response
Fig: Traditional server request and response
model
Web page
Web Server
Request / Response1
Request / Response2
Request / Response3
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 2
c) getResponseHeader(“headername”): This get information of particular part of the header.
Example: getResponse Header(“content-length”) is used to obtain size of the particular
document.
d) Open(“method”,”url”,”async”,”username”,”pass”) : This open a connection to a specific file
on the server.
e) setRequestHeader(“label”,”value”): This give a label of sorts to a header by passing string
label, and value of the label.
f) Send(“content”): This send request to the server. The response will be received immediately if
the request is sent asynchronously. This is allowed to send form element values.
Properties: Every object will have a complete set of properties which can be manipulated to obtain the
required work.
a) onreadyStateChange: This is an event handler by which to trigger certain blocks of code or
functions when there is change of state.
b) readyState: This will give full information of part of process of the current request. It is useful
for exceptional handling and is considered to be important while deciding to perform certain
actions.
c) responseText: This return script output in the form of text after request gone through.
d) responseXML: This return the response of the script in the XML format only.
e) Status: This is the response code returned from the request. Ex: status denote 404 if the request
is not found.
f) statusText: This return the response code in the text so that user can know in depth knowledge
about the error.
8.3 AJAX and PHP: In PHP, the large community of developers can share the PHP code although the
code is hidden on the web. The AJAX which is Java Script based technology used at client side, and the
code is not hidden.
AJAX is Java script based technology. This is open sort of technology that won’t hide the code. The
code written in java script can be viewed as client side technology
PHP and AJAX work very well together due to their functionalities. PHP is robust, object oriented
language, and AJAX is java based technology and is a robust language, but modeled after object
oriented model. Hence, both the technologies are combined to obtain best solution for future use.
Therefore, when both of them combined, best outcome will be out and good results are obtained when
merged.
5.2 WSDL:
Web Services Description Language (WSDL)
Web Services Description Language (WSDL) is a format for describing a Web Services interface. It is a
way to describe services and how they should be bound to specific network addresses. WSDL has three
parts:
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 3
• Definitions
• Operations
• Service bindings
Definitions are generally expressed in XML and include both data type definitions and message
definitions that use the data type definitions. These definitions are usually based upon some agreed upon
XML vocabulary. This agreement could be within an organization or between organizations.
Vocabularies within an organization could be designed specifically for that organization. They may or
may not be based on some industry-wide vocabulary. If data type and message definitions need to be
used between organizations, then most likely an industry-wide vocabulary will be used. For more on
XML vocabularies, click here.
XML, however, is not necessary required for definitions. The OMG Interface Definition Language
(IDL), for example, could be used instead of XML. If a different definitional format were used, senders
and receivers would need to agree on the format as well as the vocabulary. Nevertheless, over time,
XML-based vocabularies and messages are likely to dominate. XML Namespaces are used to ensure
uniqueness of the XML element names in the definitions, operations, and service bindings.
Operations describe actions for the messages supported by a Web service. There are four types of
operations:
• One-way: Messages sent without a reply required
• Request/response: The sender sends a message and the received sends a reply.
• Solicit response: A request for a response. (The specific definition for this action is pending.)
• Notification: Messages sent to multiple receivers. (The specific definition for this action is
pending.)
Operations are grouped into port types. Port types define a set of operations supported by the Web
service.
Service bindings connect port types to a port. A port is defined by associating a network address with a
port type. A collection of ports defines a service. This binding is commonly created using SOAP, but
other forms may be used. These other forms could include CORBA Internet Inter-ORB Protocol (IIOP),
DCOM, .NET, Java Message Service (JMS), or WebSphere MQ to name a few.
The following figure shows the relationship of the basic parts of WSDL:
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 4
5.3 SOAP:
SOAP
SOAP provides the envelope for sending Web Services messages over the Internet/Internet. It is part of
the set of standards specified by the W3C. SOAP is an alternative to Representational State Transfer
(REST) and JavaScript Object Notation (JSON).
OAP is an acronym for Simple Object Access Protocol. It is an XML-based messaging protocol for
exchanging information among computers. SOAP is an application of the XML specification.
Points to Note
• SOAP is a communication protocol designed to communicate via Internet.
• SOAP can extend HTTP for XML messaging.
• SOAP provides data transport for Web services.
• SOAP can exchange complete documents or call a remote procedure.
• SOAP can be used for broadcasting a message.
• SOAP is platform- and language-independent.
• SOAP is the XML way of defining what information is sent and how.
• SOAP enables client applications to easily connect to remote services and invoke remote
methods.
Although SOAP can be used in a variety of messaging systems and can be delivered via a variety of
transport protocols, the initial focus of SOAP is remote procedure calls transported via HTTP.
Other frameworks including CORBA, DCOM, and Java RMI provide similar functionality to SOAP, but
SOAP messages are written entirely in XML and are therefore uniquely platform- and language-
independent.
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 5
The SOAP envelope contains two parts:
1. An optional header providing information on authentication, encoding of data, or how a recipient of a
SOAP message should process the message.
2. The body that contains the message. These messages can be defined using the WSDL specification.
SOAP commonly uses HTTP, but other protocols such as Simple Mail Transfer Protocol (SMTP) may
by used. SOAP can be used to exchange complete documents or to call a remote procedure.
NOTE: SOAP at one time stood for Simple Object Access Protocol. Starting with SOAP Version 1.2,
the letters in the acronym have no particular meaning.
• SOAP stands for Simple Object Access Protocol
• SOAP is an application communication protocol
• SOAP is a format for sending and receiving messages
• SOAP is platform independent
• SOAP is based on XML
• SOAP is a W3C recommendation
Why SOAP?
It is important for web applications to be able to communicate over the Internet.
The best way to communicate between applications is over HTTP, because HTTP is supported by all
Internet browsers and servers. SOAP was created to accomplish this.
SOAP provides a way to communicate between applications running on different operating systems,
with different technologies and programming languages.
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 6
SOAP Building Blocks
A SOAP message is an ordinary XML document containing the following elements:
• An Envelope element that identifies the XML document as a SOAP message
• A Header element that contains header information
• A Body element that contains call and response information
• A Fault element containing errors and status information
All the elements above are declared in the default namespace for the SOAP envelope:
Syntax Rules
Here are some important syntax rules:
• A SOAP message MUST be encoded using XML
• A SOAP message MUST use the SOAP Envelope namespace
• A SOAP message MUST use the SOAP Encoding namespace
• A SOAP message must NOT contain a DTD reference
• A SOAP message must NOT contain XML Processing Instructions
Skeleton SOAP Message
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Header>
...
</soap:Header>
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 7
<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
Example:
he SOAP Envelope Element
The required SOAP Envelope element is the root element of a SOAP message. This element defines the
XML document as a SOAP message.
Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
...
Message information goes here
...
</soap:Envelope>
The xmlns:soap Namespace
Notice the xmlns:soap namespace in the example above. It should always have the value of:
"http://www.w3.org/2003/05/soap-envelope/".
The namespace defines the Envelope as a SOAP Envelope.
If a different namespace is used, the application generates an error and discards the message.
The encodingStyle Attribute
The encodingStyle attribute is used to define the data types used in the document. This attribute may
appear on any SOAP element, and applies to the element's contents and all child elements.
A SOAP message has no default encoding.
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 8
Syntax
soap:encodingStyle="URI"
Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
...
Message information goes here
...
</soap:Envelope>
The SOAP Header Element
The optional SOAP Header element contains application-specific information (like authentication,
payment, etc) about the SOAP message.
If the Header element is present, it must be the first child element of the Envelope element.
Note: All immediate child elements of the Header element must be namespace-qualified.
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Header>
<m:Trans xmlns:m="https://www.w3schools.com/transaction/"
soap:mustUnderstand="1">234
</m:Trans>
</soap:Header>
...
...
</soap:Envelope>
The example above contains a header with a "Trans" element, a "mustUnderstand" attribute with a value
of 1, and a value of 234.
SOAP defines three attributes in the default namespace. These attributes are: mustUnderstand, actor, and
encodingStyle.
The attributes defined in the SOAP Header defines how a recipient should process the SOAP message.
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 9
The mustUnderstand Attribute
The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or
optional for the recipient to process.
If you add mustUnderstand="1" to a child element of the Header element it indicates that the receiver
processing the Header must recognize the element. If the receiver does not recognize the element it will
fail when processing the Header.
Syntax
soap:mustUnderstand="0|1"
Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Header>
<m:Trans xmlns:m="https://www.w3schools.com/transaction/"
soap:mustUnderstand="1">234
</m:Trans>
</soap:Header>
...
...
</soap:Envelope>
S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 10

More Related Content

Similar to WIT UNIT-5.pdf

Web services for developer
Web services for developerWeb services for developer
Web services for developerRafiq Ahmed
 
53 hui homework2
53 hui homework253 hui homework2
53 hui homework2huis89
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni InturiSreeni I
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Jackson F. de A. Mafra
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservicesGagandeep Singh
 
Web Service Interaction Models | Torry Harris Whitepaper
Web Service Interaction Models | Torry Harris WhitepaperWeb Service Interaction Models | Torry Harris Whitepaper
Web Service Interaction Models | Torry Harris WhitepaperTorry Harris Business Solutions
 
Soap and restful webservice
Soap and restful webserviceSoap and restful webservice
Soap and restful webserviceDong Ngoc
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxkarthiksmart21
 
Web Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxWeb Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxssuser403d87
 
Xml web services
Xml web servicesXml web services
Xml web servicesRaghu nath
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architectureYisal Khan
 
Using mule configuration patterns
Using mule configuration patternsUsing mule configuration patterns
Using mule configuration patternsSindhu VL
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web servicesNeil Ghosh
 

Similar to WIT UNIT-5.pdf (20)

Web services for developer
Web services for developerWeb services for developer
Web services for developer
 
53 hui homework2
53 hui homework253 hui homework2
53 hui homework2
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
Wt unit 6 ppts web services
Wt unit 6 ppts web servicesWt unit 6 ppts web services
Wt unit 6 ppts web services
 
RIA Data and Security, 2007
RIA Data and Security, 2007RIA Data and Security, 2007
RIA Data and Security, 2007
 
SOAP WEB TECHNOLOGIES
SOAP WEB TECHNOLOGIESSOAP WEB TECHNOLOGIES
SOAP WEB TECHNOLOGIES
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservices
 
Web Service Interaction Models | Torry Harris Whitepaper
Web Service Interaction Models | Torry Harris WhitepaperWeb Service Interaction Models | Torry Harris Whitepaper
Web Service Interaction Models | Torry Harris Whitepaper
 
Xml.ppt
Xml.pptXml.ppt
Xml.ppt
 
Soap and restful webservice
Soap and restful webserviceSoap and restful webservice
Soap and restful webservice
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptx
 
Web Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxWeb Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptx
 
Java web services
Java web servicesJava web services
Java web services
 
Service view
Service viewService view
Service view
 
Xml web services
Xml web servicesXml web services
Xml web services
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architecture
 
Using mule configuration patterns
Using mule configuration patternsUsing mule configuration patterns
Using mule configuration patterns
 
Web services
Web servicesWeb services
Web services
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 

Recently uploaded

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

WIT UNIT-5.pdf

  • 1. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 1 UNIT – 5 : AJAX, WSDL and SOAP Contents: 5.1 AJAX and PHP: Similarities, Why we need to combine AJAX and PHP. 5.2 WSDL: Definition, Purpose 5.3 SOAP: Definition, Purpose 5.1 AJAX: AJAX stands for Asynchronous Java Script and XML. It allow the various client requests at the server, the server should process the required processing, and automatically loads the page without refreshing the page i.e without user need to move from one page to other page. The following is the traditional client server model in which server after receive the requests from clients, perform required processing, and shows the updated content on the web page when page is refreshed only. AJAX is based on the following architecture called internet request/response model using AJAX’s asynchronous methodology. The new ergonomic changes can occur on the new page without refreshing / user need not move the pages. XMLHTTPRequst: The XMLHTTPRequest object is instantiated for AJAX. This is created as an ActiveX control by the Microsoft, whereas firefox and safari use basic Javascript object. Methods: a) Abort(): It stop the current request. When request is made to stop the request for a certain length of time, this method is called. b) getAllResponseHeaders(): It acquire full information on all HTTP headers which are being passed. Web page Server New Content on the page after refresh request response Fig: Traditional server request and response model Web page Web Server Request / Response1 Request / Response2 Request / Response3
  • 2. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 2 c) getResponseHeader(“headername”): This get information of particular part of the header. Example: getResponse Header(“content-length”) is used to obtain size of the particular document. d) Open(“method”,”url”,”async”,”username”,”pass”) : This open a connection to a specific file on the server. e) setRequestHeader(“label”,”value”): This give a label of sorts to a header by passing string label, and value of the label. f) Send(“content”): This send request to the server. The response will be received immediately if the request is sent asynchronously. This is allowed to send form element values. Properties: Every object will have a complete set of properties which can be manipulated to obtain the required work. a) onreadyStateChange: This is an event handler by which to trigger certain blocks of code or functions when there is change of state. b) readyState: This will give full information of part of process of the current request. It is useful for exceptional handling and is considered to be important while deciding to perform certain actions. c) responseText: This return script output in the form of text after request gone through. d) responseXML: This return the response of the script in the XML format only. e) Status: This is the response code returned from the request. Ex: status denote 404 if the request is not found. f) statusText: This return the response code in the text so that user can know in depth knowledge about the error. 8.3 AJAX and PHP: In PHP, the large community of developers can share the PHP code although the code is hidden on the web. The AJAX which is Java Script based technology used at client side, and the code is not hidden. AJAX is Java script based technology. This is open sort of technology that won’t hide the code. The code written in java script can be viewed as client side technology PHP and AJAX work very well together due to their functionalities. PHP is robust, object oriented language, and AJAX is java based technology and is a robust language, but modeled after object oriented model. Hence, both the technologies are combined to obtain best solution for future use. Therefore, when both of them combined, best outcome will be out and good results are obtained when merged. 5.2 WSDL: Web Services Description Language (WSDL) Web Services Description Language (WSDL) is a format for describing a Web Services interface. It is a way to describe services and how they should be bound to specific network addresses. WSDL has three parts:
  • 3. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 3 • Definitions • Operations • Service bindings Definitions are generally expressed in XML and include both data type definitions and message definitions that use the data type definitions. These definitions are usually based upon some agreed upon XML vocabulary. This agreement could be within an organization or between organizations. Vocabularies within an organization could be designed specifically for that organization. They may or may not be based on some industry-wide vocabulary. If data type and message definitions need to be used between organizations, then most likely an industry-wide vocabulary will be used. For more on XML vocabularies, click here. XML, however, is not necessary required for definitions. The OMG Interface Definition Language (IDL), for example, could be used instead of XML. If a different definitional format were used, senders and receivers would need to agree on the format as well as the vocabulary. Nevertheless, over time, XML-based vocabularies and messages are likely to dominate. XML Namespaces are used to ensure uniqueness of the XML element names in the definitions, operations, and service bindings. Operations describe actions for the messages supported by a Web service. There are four types of operations: • One-way: Messages sent without a reply required • Request/response: The sender sends a message and the received sends a reply. • Solicit response: A request for a response. (The specific definition for this action is pending.) • Notification: Messages sent to multiple receivers. (The specific definition for this action is pending.) Operations are grouped into port types. Port types define a set of operations supported by the Web service. Service bindings connect port types to a port. A port is defined by associating a network address with a port type. A collection of ports defines a service. This binding is commonly created using SOAP, but other forms may be used. These other forms could include CORBA Internet Inter-ORB Protocol (IIOP), DCOM, .NET, Java Message Service (JMS), or WebSphere MQ to name a few. The following figure shows the relationship of the basic parts of WSDL:
  • 4. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 4 5.3 SOAP: SOAP SOAP provides the envelope for sending Web Services messages over the Internet/Internet. It is part of the set of standards specified by the W3C. SOAP is an alternative to Representational State Transfer (REST) and JavaScript Object Notation (JSON). OAP is an acronym for Simple Object Access Protocol. It is an XML-based messaging protocol for exchanging information among computers. SOAP is an application of the XML specification. Points to Note • SOAP is a communication protocol designed to communicate via Internet. • SOAP can extend HTTP for XML messaging. • SOAP provides data transport for Web services. • SOAP can exchange complete documents or call a remote procedure. • SOAP can be used for broadcasting a message. • SOAP is platform- and language-independent. • SOAP is the XML way of defining what information is sent and how. • SOAP enables client applications to easily connect to remote services and invoke remote methods. Although SOAP can be used in a variety of messaging systems and can be delivered via a variety of transport protocols, the initial focus of SOAP is remote procedure calls transported via HTTP. Other frameworks including CORBA, DCOM, and Java RMI provide similar functionality to SOAP, but SOAP messages are written entirely in XML and are therefore uniquely platform- and language- independent.
  • 5. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 5 The SOAP envelope contains two parts: 1. An optional header providing information on authentication, encoding of data, or how a recipient of a SOAP message should process the message. 2. The body that contains the message. These messages can be defined using the WSDL specification. SOAP commonly uses HTTP, but other protocols such as Simple Mail Transfer Protocol (SMTP) may by used. SOAP can be used to exchange complete documents or to call a remote procedure. NOTE: SOAP at one time stood for Simple Object Access Protocol. Starting with SOAP Version 1.2, the letters in the acronym have no particular meaning. • SOAP stands for Simple Object Access Protocol • SOAP is an application communication protocol • SOAP is a format for sending and receiving messages • SOAP is platform independent • SOAP is based on XML • SOAP is a W3C recommendation Why SOAP? It is important for web applications to be able to communicate over the Internet. The best way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this. SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
  • 6. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 6 SOAP Building Blocks A SOAP message is an ordinary XML document containing the following elements: • An Envelope element that identifies the XML document as a SOAP message • A Header element that contains header information • A Body element that contains call and response information • A Fault element containing errors and status information All the elements above are declared in the default namespace for the SOAP envelope: Syntax Rules Here are some important syntax rules: • A SOAP message MUST be encoded using XML • A SOAP message MUST use the SOAP Envelope namespace • A SOAP message MUST use the SOAP Encoding namespace • A SOAP message must NOT contain a DTD reference • A SOAP message must NOT contain XML Processing Instructions Skeleton SOAP Message <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Header> ... </soap:Header>
  • 7. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 7 <soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope> Example: he SOAP Envelope Element The required SOAP Envelope element is the root element of a SOAP message. This element defines the XML document as a SOAP message. Example <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> ... Message information goes here ... </soap:Envelope> The xmlns:soap Namespace Notice the xmlns:soap namespace in the example above. It should always have the value of: "http://www.w3.org/2003/05/soap-envelope/". The namespace defines the Envelope as a SOAP Envelope. If a different namespace is used, the application generates an error and discards the message. The encodingStyle Attribute The encodingStyle attribute is used to define the data types used in the document. This attribute may appear on any SOAP element, and applies to the element's contents and all child elements. A SOAP message has no default encoding.
  • 8. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 8 Syntax soap:encodingStyle="URI" Example <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> ... Message information goes here ... </soap:Envelope> The SOAP Header Element The optional SOAP Header element contains application-specific information (like authentication, payment, etc) about the SOAP message. If the Header element is present, it must be the first child element of the Envelope element. Note: All immediate child elements of the Header element must be namespace-qualified. <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Header> <m:Trans xmlns:m="https://www.w3schools.com/transaction/" soap:mustUnderstand="1">234 </m:Trans> </soap:Header> ... ... </soap:Envelope> The example above contains a header with a "Trans" element, a "mustUnderstand" attribute with a value of 1, and a value of 234. SOAP defines three attributes in the default namespace. These attributes are: mustUnderstand, actor, and encodingStyle. The attributes defined in the SOAP Header defines how a recipient should process the SOAP message.
  • 9. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 9 The mustUnderstand Attribute The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process. If you add mustUnderstand="1" to a child element of the Header element it indicates that the receiver processing the Header must recognize the element. If the receiver does not recognize the element it will fail when processing the Header. Syntax soap:mustUnderstand="0|1" Example <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Header> <m:Trans xmlns:m="https://www.w3schools.com/transaction/" soap:mustUnderstand="1">234 </m:Trans> </soap:Header> ... ... </soap:Envelope>
  • 10. S.Hrushikesava Raju,Associate Professor, CSE Dept., SIETK,Narayanavanam Road,Puttur Page 10