This document gives fair knowledge of invoking web services using Oracle 9i. Oracle9i allows direct access to web services from PL/SQL using the UTL_HTTP package. This document explains step by step process to invoke web services using UTL_HTTP. Communication between client and server is implemented by SOAP protocol.
What is WSDL?
WSDL stands for Web Services Description Language. It is written in XML and treated as an XML document. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes. WSDL is not yet a W3C standard. It is a language proposed by IBM and Microsoft for describing the capabilities of web services. WSDL is a specification defining how to describe web services in a common XML grammar. WSDL describes four critical pieces of data:
1) Public functions available with the web service
2) Data type information for all message requests and message responses
3) Binding information about the transport protocol to be used (GET or POST method to be used)
4) Address information for locating the specified service (URL to be used to access web service)
In a nutshell, WSDL represents a contract between the service requestor and the service provider, The crucial difference is that WSDL is platform- and language-independent and is used primarily (although not exclusively) to describe SOAP services. Using WSDL, a client can locate a web service and invoke any of its publicly available functions. WSDL therefore represents a cornerstone of the web service architecture, because it provides a common language for describing services and a platform for automatically integrating those services.
The WSDL Specification
WSDL is an XML grammar for describing web services. Some of the major elements are mentioned below. Examples mentioned in each specification are taken from the WSDL example which is attached as a screen shot.
• Definitions
The definitions element must be the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described.
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://fxpress.com/webservices" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://fxpress.com/webservices" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
• Types
The types element describes all the data types used between the client and server. WSDL is not tied exclusively to a specific typing system, but it uses the W3C XML Schema specification as its default choice. If the service uses only XML Schema built-in simple types, such as strings and integers, the types element is not required.
<s:element name="GetForeignCurrencyCalendarMonthEndRates"><s:complexType><s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="month" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="year" type="s:int" />
</s:sequence></s:complexType></s:element>
<s:element name="GetForeignCurrencyCalendarMonthEndRatesResponse">
<s:complexType><s:sequence>
<s:element minOccurs="0" maxOccurs="1"name="GetForeignCurrencyCalendarMonthEndRatesResult">
<s:complexType><s:sequence><s:element ref="s:schema" />
• Message
The message element describes a one-way message, whether it is a single message request or a single message response. Message parameters or message return values are defined in
<wsdl:message name="GetForeignCurrencyCalendarMonthEndRatesSoapIn">
<wsdl:part name="parameters" element="tns:GetForeignCurrencyCalendarMonthEndRates" />
</wsdl:message>
<wsdl:message name="GetForeignCurrencyCalendarMonthEndRatesSoapOut">
<wsdl:part name="parameters" element="tns:GetForeignCurrencyCalendarMonthEndRatesResponse"/>
</wsdl:message>
• PortType
The portType element defines the operation adopted for client server communication.
For example, a portType can combine one request and one response message into a single request/response operation, most commonly used in SOAP services.
<wsdl:port name="BoeingRetrievalSoap" binding="tns:BoeingRetrievalSoap">
<soap:addresslocation="https://treasury2.fxpress.com/Secure/WebServices/BoeingRetrievalTest
/BoeingRetrieval.asmx" />
</wsdl:port>
• Binding
The binding element provides specific details on how a portType operation will actually be transmitted over the wire. HTTP GET and POST bindings are generally used in the operation. The HTTP GET binding adds any input parameters to the operation to the uniform resource locator (URL). But, the HTTP POST binding sends the parameters in the request body.
GET
The GET binding request does not send a request document. Instead, you attach all of the necessary parameters in the query string to the URL You can attach a query string to the URL with a question mark (?). The delimiter between any parameter=value pair is the ampersand (&). The following example is a GET binding request that uses a query string with the question mark, and a delimiter. In this way whatever you will send will be seen by other user so can say that it is not even secure.
http://server:port/contextRoot/group/dadx/operationName?param1=abc¶m2=1234¶m3=thi&20is&20a&20parameter
POST
The Post method is more powerful request. By using Post we can request as well as send some data to the server. We use post method when we have to send a big chunk of data to the server, like when we have to send a long enquiry form then we can send it by using the post method.
A POST binding issues an HTTP POST request. A POST bind request sends a request document. The document contains the request parameter, but the parameter is not in XML format. An HTTP client application, such as a Web browser, creates the request document. A Web browser usually creates a request document from input forms that are sent to the server.
No comments:
Post a Comment