Prerequisites
What are Web services?
Web services are functional predefined, self-contained applications that are available from a Web server. Another application can contact and call the Web service application remotely and receive data in return. A simple example might be a Web server that provides weather information. Another application, regardless of whether it is Web based, can call the Web service with a ZIP code and receive current weather conditions in return.
Web services provide a conduit from an application or application environment to another application or application environment via standard formats and protocols such as XML, SOAP, WSDL, and UDDI. More and more technologies are supporting Web services as today's enterprise-level business solutions require interoperability between technology solutions.
In this section, we review both the basics of Web services as well as further explore the standards-based formats and protocols that Web services employ to seamlessly integrate otherwise often non-integrated solutions.
Examples of commonly used or public Web services
Some of the most popular and commonly used examples of Web services come from Google
, which provides the global community with many various Web Service-based solutions. One of the most popular is Google Maps
.
The example markup
illustrates a simple usage scenario of the Google Maps Web Service. In this example, the onload event of the <body> element triggers a simple JavaScript function (defined in the <header> element above), which makes a Web services call via the predefined Google Maps API. Data is then exchanged between the Google Maps Web Service and our example Web page, rendering a local area map result.
Understanding public Web services enables us to eventually architect and develop our own Web services, allowing us to integrate global community solutions and other thir-party technologies and solutions. For the most part, the only thing that is required for learning about and from these public Web services is an eagerness to learn! Most of the public Web services are free (although some may require registration), and the global community does an impressive job maintaining FAQs and tutorials which often showcase general usage examples which can be extremely helpful.
XML and Web services
XML is the basis for Web services, which uses the flexibility and definable structure of the markup language to facilitate the communication between the source and target solutions. Web services often leverage XML, XSL, and XSLT to both consume and return data result sets.
What is SOAP?
SOAP (Content Type: text/xml or application/xml) is a common and standard protocol that allows XML data to be communicated from a source to a target technology. The basic syntax of a SOAP message is made up of the elements listed in the following table.
| Element name or type |
Usage or example |
| <envelope> |
This element identifies the XML document as a SOAP message. |
| <header> |
This element contains header information regarding the specific SOAP message. |
| <body> |
This element contains the SOAP message call and response data. |
| <fault> |
(Optional) This element contains processing error data for the SOAP message. |
The following example shows the basic structure of a SOAP message.
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
</soap:Header>
<soap:Body>
<soap:Fault>
</soap:Fault>
</soap:Body>
</soap:Envelope>
What is WSDL?
Web Services Description Language (WSDL) is a common and standard XML-formatted language that is used for source and target technology interface. The basic syntax of a WSDL document is made up of the elements listed in the following table.
| Element name or type |
Usage or example |
| <definitions> |
This element indentifies the XML document as a WSDL document. |
| <porttype> |
This element identifies the operations performed by the Web Service. |
| <message> |
This element identifies the message content used by the Web Service. |
| <types> |
This element defines the Content/Data Types used by the Web Service. |
| <binding> |
This element defines the protocols used by the Web Service. |
The following example shows the basic structure of a WSDL
document.
<wsdl:definitions name="nmtoken"? targetNamespace="uri">
<import namespace="uri" location="uri"/> *
<wsdl:documentation .... /> ?
<wsdl:types> ?
<wsdl:documentation .... /> ?
<xsd:schema .... /> *
</wsdl:types>
<wsdl:message name="ncname"> *
<wsdl:documentation .... /> ?
<part name="ncname" element="qname"? type="qname"?/> *
</wsdl:message>
<wsdl:portType name="ncname"> *
<wsdl:documentation .... /> ?
<wsdl:operation name="ncname"> *
<wsdl:documentation .... /> ?
<wsdl:input message="qname"> ?
<wsdl:documentation .... /> ?
</wsdl:input>
<wsdl:output message="qname"> ?
<wsdl:documentation .... /> ?
</wsdl:output>
<wsdl:fault name="ncname" message="qname"> *
<wsdl:documentation .... /> ?
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:serviceType name="ncname"> *
<wsdl:portType name="qname"/> +
</wsdl:serviceType>
<wsdl:binding name="ncname" type="qname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
<wsdl:operation name="ncname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
<wsdl:input> ?
<wsdl:documentation .... /> ?
<-- binding details -->
</wsdl:input>
<wsdl:output> ?
<wsdl:documentation .... /> ?
<-- binding details --> *
</wsdl:output>
<wsdl:fault name="ncname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ncname" serviceType="qname"> *
<wsdl:documentation .... /> ?
<wsdl:port name="ncname" binding="qname"> *
<wsdl:documentation .... /> ?
<-- address details -->
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
What is UDDI?
Universal Description, Discovery, and Integration (UDDI) is an XML-based directory of Web services described by WSDL. Businesses and organizations can register their WSDL-based Web services in the UDDI to allow their Web services to participate in the global community and to facilitate our development to their specific WSDL standard.
UDDI business registration consists of the types that are listed in the following table.
| UDDI type |
Examples |
| White Pages |
Address, contact, and known identifiers |
| Yellow Pages |
Industrial categorizations based on standard taxonomies |
| Green Pages |
Technical information about services exposed by the business |
For more information on UDDI, visit the UDDI Home Page
!