CP3024 Lecture 10 Web Services
What are Web Services? “encapsulated, loosely coupled, contracted software objects offered via standard protocols” ZapThink Research
Web Services Encapsulated –Web Service implementation is invisible to entities outside the service –Exposes an interface but hides details Loosely Coupled –Service and consumer software can be redesigned independently
Web Services Contracted –Description of service is available to consumer Standard Protocols –TCP/IP –HTTP –XML –SOAP –WSDL –UDDI
Self-describing Every web service has a published public interface –Minimum of human readable documentation –SOAP services should have interfaces written in XML
Discoverable Simple mechanism for publishing details about a web service Simple mechanism for finding a service and its interface Mechanism could be completely decentralised or centralised registry
A Web Service.. Is available over network Uses standardised XML messaging Is independent of any given OS or language Is self describing via XML Is easily discoverable
Web Usage Shift Human-centric Web –Majority of web transactions initiated by a human Application-centric Web –Inter-application interchanges –E.g. credit card approval
A Web Service In Action XML
Possible Protocols HTTP POST/GET XML-RPC SOAP –Simple Object Access Protocol
Example Service Return a set of keys given a set of functional dependencies Service called keyservice Method called getCandidateKeys String argument fdSet Argument sent “{{a}->{b}}”
XML-RPC Service Invocation keyservice.getCandidateKeys {{a}->{b}}
XML-RPC Response {{a}}
SOAP SOAP envelope specification –Rules for encapsulating the data being transferred Data encoding rules –Rules for encoding data types RPC conventions –Rules for invoking remote methods
Example Service Request <SOAP-ENV:Envelope xmlns:SOAP-ENV= xmlns:xsi= " xmlns:xsd=" <ns1:getCandidateKeys xmlns:ns1="urn:examples:keyservice" SOAP-ENV:encodingStyle= " {{a}->{b}}
Example Service Reply <SOAP-ENV:Envelope xmlns:SOAP-ENV= " xmlns:xsi= " xmlns:xsd=" <ns1:getCandidateKeysResponse xmlns:ns1="urn:examples:keyservice" SOAP-ENV:encodingStyle= " {{a}}
Soap Message Structure of SOAP Messages Envelope (required) Header (optional) Body (required) Fault (optional)
Fault Response <SOAP-ENV:Envelope xmlns:SOAP-ENV= " xmlns:xsi= " xmlns:xsd=" SOAP-ENV:Server Exception from service object: FD: Unexpected end of input /soap/servlet/rpcrouter
Web Services Definition Language (WSDL) Uses XML to describe a web service –Describes the interface of available functions –Specifies data type information for all requests and responses –Holds binding information about the transport protocol –Contains address information to locate the service
Major Elements definitions –types –message –portType –binding –ports –service
WSDL definitions <definitions name="KeyService" targetNamespace= " xmlns=" xmlns:soap= " xmlns:tns= " xmlns:xsd="
WSDL types Optional element Defines complex types e.g. arrays and structures Not used in the example
WSDL message
WSDL portType <output message="tns:getKeys“ name="Response"/>
WSDL binding <soap:binding style="rpc" transport=" <soap:body encodingStyle= namespace="urn:examples:keyservice" use="encoded"/>
WSDL Binding <soap:body encodingStyle= " namespace="urn:examples:keyservice" use="encoded"/>
WSDL Service WSDL File for KeyService <soap:address location= “ />
WSDL In Action Can use WSDL description to generate client code Can use WSDL description to automatically invoke a service Can generate WSDL from server code
Available WSDL Services
Generic Soap Client
UDDI Universal Description, Discovery and Integration Specification for distributed directory of businesses –Data stored in an XML format UDDI business registry –Launched May 2001 by IBM and Microsoft
UDDI Development Developed by IBM, Microsoft and Ariba –Ariba/IBM collaboration on B2B –IBM/Microsoft collaboration on SOAP –Microsoft/Ariba collaboration on BizTalk and cXML Three revisions and then transfer to standards body Launched September 2000
UDDI Development Version 2.0 announced July 2001 –Internationalisation –Complex organisations –Better searching mechanisms Version 3.0 announced July 2002 –Increased security –Improved WSDL support –Multi-registry topologies –Proactive notifications
UDDI Technical Architecture UDDI data model –XML schema describing businesses and web services UDDI API –SOAP based API for publishing and searching UDDI data UDDI cloud services –Sites implementing UDDI which synchronise regularly
UDDI Data Model businessEntity –Information about a business businessService –Information about a web service bindingTemplate –Information about accessing a service tModel –Pointer to external technical specification
businessService Relationships businessEntitybindingTemplatetModel
UDDI Inquiry API find_binding find_business find_service find_tModel get_bindingDetail get_businessDetail get_serviceDetail get_tModelDetail
UDDI Publishing API get_authToken discard_authToken save_binding save_business save_service save_tModel delete_binding delete_business delete_service delete_tModel
Use Of UDDI Publishing –Advertise services –Allow discovery of standards in use Searching –Locate details about electronic services of business partners –Search for suppliers
Summary Web Services –Mechanism for electronic business on the Web Based on XML SOAP WSDL UDDI