Concepts
A Web Service (commonly called a service) comprises
some content, or some process, or both, with an open programmatic interface.
Simple examples: currency converter, stock quotes, dictionary. More complex
examples: travel planner, procurement workflow system. A service has the following
characteristics:
About WSDL
The Web Services Description Language (WSDL) is an XML language
for describing the syntax of Web Service interfaces and their locations. The
WSDL specification calls it "an
XML format for describing network services as a set of endpoints operating
on messages containing either document-oriented or procedure-oriented information."
Within that context, the diagram below illustrates the elements that are present
in a WSDL document, and shows how they are related.

Programmers or automated development tools can create WSDL
files to describe a service and can make the description available over the
Internet. Client-side programmers and development tools can use published
WSDL descriptions to obtain information about available Web Services and to
build and create proxies or program templates that access available services.
A WSDL document has a definitions element that
contains the types, message, portType,
binding, and service elements as described in the
following table.
| definitions |
Defines one or more services. A definition
element supports the following attributes:
name is optional.
-
targetNamespace is the logical namespace for information
about this service. WSDL documents can import other WSDL documents,
and setting targetNamespace to a unique value ensures
that the namespaces do not clash.
xmlns is the default namespace of the WSDL document,
and it is set to http://schemas.xmlsoap.org/wsdl/. All
the WSDL elements, such as <definitions>, <types>
and <message> reside in this namespace.
-
xmlns:xsd and xmlns:soap are standard
namespace definitions that are used for specifying SOAP-specific information
as well as data types.
xmlns:tns stands for this namespace.
|
| types |
Provides information about any complex data types used in the WSDL document.
When simple types are used, the WSDL document does not need this section. |
| message |
An abstract definition of the data being communicated. |
| operation |
An abstract description of the action supported by the service. |
| portType |
An abstract set of operations supported by one or more endpoints. |
| binding |
Describes how the operation is invoked by specifying concrete protocol
and data format specifications for the operations and messages. |
| port |
Specifies a single endpoint as an address for the binding, thus defining
a single communication endpoint. |
| service |
Specifies the port address(es) of the binding. The service is a collection
of network endpoints or ports. |
The following listing shows the
WSDL code for the Exchange Web Service used by the FBS.
<?xml version = '1.0' encoding = 'windows-1252'?> <!--Generated by the Oracle9i JDeveloper Web Services WSDL Generator--> <!--Date Created: Tue Apr 23 15:09:13 IST 2002--> <definitions name="Exchange" targetNamespace= "http://tempuri.org/jdeveloper/generated/oracle/otnsamples/ibfbs/admin/ejb/Exchange" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns= "http://tempuri.org/jdeveloper/generated/oracle/otnsamples/ibfbs/admin/ejb/Exchange" xmlns:ns1= "http://tempuri.org/jdeveloper/generated/oracle/otnsamples/ibfbs/admin/ejb/Exchange/schema"> <types> <schema targetNamespace= "http://tempuri.org/jdeveloper/generated/oracle/otnsamples/ibfbs/admin/ejb/Exchange/schema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"/> </types> <message name="processOrder0Request"> <part name="toAddress" type="xsd:string"/> <part name="symbol" type="xsd:string"/> <part name="tradeDate" type="xsd:dateTime"/> <part name="tradeType" type="xsd:string"/> <part name="qty" type="xsd:int"/> </message> <message name="processOrder0Response"> <part name="return" type="xsd:int"/> </message> <portType name="ExchangePortType"> <operation name="processOrder"> <input name="processOrder0Request" message="tns:processOrder0Request"/> <output name="processOrder0Response" message="tns:processOrder0Response"/> </operation> </portType> <binding name="ExchangeBinding" type="tns:ExchangePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="processOrder"> <soap:operation soapAction="" style="rpc"/> <input name="processOrder0Request"> <soap:body use="encoded" namespace="oracle.otnsamples.ibfbs.admin.ejb.Exchange" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output name="processOrder0Response"> <soap:body use="encoded" namespace="oracle.otnsamples.ibfbs.admin.ejb.Exchange" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="Exchange"> <port name="ExchangePort" binding="tns:ExchangeBinding"> <soap:address location="http://incq212e.idc.oracle.com:8888/ibfbs/ExchangeService"/> </port> </service> </definitions>
|
About SOAP
The Simple Object Access
Protocol (SOAP) is a lightweight, XML-based protocol for exchanging information
in a decentralized, distributed environment. SOAP supports different styles
of information exchange, including:
- Remote Procedure Call style (RPC), which allows for request-response
processing, where an endpoint receives a procedure oriented message and
replies with a correlated response message.
- Message-oriented information exchange, which supports
organizations and applications that need to exchange business or other types
of documents where a message is sent but the sender may not expect or wait
for an immediate response.
SOAP has the following features:
- Protocol independence
- Language independence
- Platform and operating system independence
- Support for SOAP XML messages incorporating attachments
(using the multipart MIME structure)
A SOAP message consists of a SOAP envelope that encloses
two data structures, the SOAP header and the SOAP body, and information about
the name spaces used to define them. The header is optional; when present,
it conveys information about the request defined in the SOAP body. For example,
it might contain transactional, security, contextual, or user profile information.
The body contains a Web Service request or reply to a request in XML format.
The high-level structure of a SOAP message is shown in the following figure.

Here is a SOAP message that corresponds to the WSDL listed
above:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:processOrder xmlns:m="http://tempuri.org/jdeveloper/generated/oracle/otnsamples/ibfbs/admin/ejb/Exchange">
<m:toAddress>abcd@yahoo.com</m:toAddress>
<m:symbol>ORCL</m:symbol>
<m:tradeDate>2001-12-15T13:20:00-05:00</m:tradeDate>
<m:tradeType>B</m:tradeType>
<m:qty>50</m:qty>
</m:processOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
|
SOAP messages, when used to carry Web Service requests and
responses, can conform to the WSDL definition of available Web Services. WSDL
can define the SOAP message used to access the Web Services, the protocols
over which such SOAP messages can be exchanged, and the Internet locations
where these Web Services can be accessed. The WSDL descriptors can reside
in UDDI or other directory services, and they can also be provided via configuration
or other means such as in the body of SOAP request replies.
The SOAP specification provides a standard way to encode
requests and responses. It describes the structure and data types of message
payloads using XML Schema. The way that SOAP is used for the message and response
of a Web Service is:
- The SOAP client uses an XML document
that conforms to the SOAP specification and which contains a request for
the service.
- The SOAP client sends the document
to a SOAP server, and the SOAP servlet running on the server handles the
document using, for example, HTTP or HTTPS.
- The Web service receives the SOAP
message, and dispatches the message as a service invocation to the application
providing the requested service.
- A response from the service is returned to the
SOAP server, again using the SOAP protocol, and this message is returned
to the originating SOAP client.
SOAP provides a way to leverage the industry investment
in XML. Also, since SOAP is typically defined over "firewall friendly"
protocols such as HTTP and SMTP, the industry investment in firewall technology
is leveraged as well. Thus, by defining SOAP as an essential part of Web Services,
the industry will likely enjoy volume production use of Web Services far sooner
than if other strategies had been employed.