Web Service Atg

Preview:

Citation preview

J.Amirtharaj Solomonjamirtha@covansys.comTechnology Group

WEB SERVICES

The Web Services fundamental ArchitectureCore technologies:

SOAPUDDIWSDL

Tools and Resources

WEB SERVICES

What are Web Services?A Web service represents a unit of business,

application, or system functionality that can be accessed over the Web.

Eg.Business Information with rich content

airline schedulesstock quotescredit checkcredit card validation

Web Services

Eg.Transactional Web Services for

B2B or B2Cairline reservationsrental car agreementspurchase order

Web Services

CharacteristicsIt is accessible over the Web.It provides an interface that can be

called from another program.It is registered and can be located

through a Web service registry.It communicates using messages

over standard Web protocols.

Web Services fundamental Architecture

Web Services

Publishing services uses the Universal Description, Discovery and Integration (UDDI).

Locating services uses a combination of UDDI and the Web Services Description Language (WSDL).

Binding to services leverages WSDL and the Simple Object Access Protocol (SOAP).

Foundation for Web Services

Ubiquitous Communications: InternetUbiquitous Communications: Internet

Universal Data Format:Universal Data Format: XMLXML

Service Interactions:Service Interactions: SOAPSOAP

Formal Service Descriptions:Formal Service Descriptions: WSDLWSDL

Broad Industry Support, Simple ProcessBroad Industry Support, Simple Process

Publish and Discover Services:Publish and Discover Services: UDDIUDDI

What is SOAP ?

SOAP is a protocol specification for invoking methods on servers, services, components and objects. SOAP codifies the existing practice of using XML and HTTP as a method invocation mechanism. The SOAP specification mandates a small number of HTTP headers that facilitate firewall/proxy filtering. The SOAP specification also mandates an XML vocabulary that is used for representing method parameters, return values, and exceptions.

SOAP

SOAP 1.0: Userland, Microsoft, DevelopMentor

SOAP 1.0 was specific to COM and HTTP

SOAPSOAP 1.1 (April 23, 2000) - includescontributions from IBM and Lotussubstitutable Transport bindings (not just HTTP)substitutable Language bindings (e.g. Java)substitutable Data encodings (pluggable)completely vendor-neutralindependent of: programming language, object

model, operating system, or platform

SOAPRequest and Response messagesRequest invokes a method on a remote

objectResponse returns result of running the

methodSOAP defines an "envelope""envelope" wraps the message itselfmessage is a different vocabularynamespace prefix is used

SOAP - Headers

POST /foobar HTTP/1.1

Host: 209.110.197.12

Content-Type: text/plain

Content-Length: 12

•Request

•Response200 OK

Content-Type: text/plain

Content-Length: 12

Connection: close

SOAP <?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">

<SOAP-ENV:Body><ns1:createOrder xmlns:ns1="urn:ejbsessionbmp" SOAP-

ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<orderdetails xmlns:ns2="urn:xml-soap-createorderevent" xsi:type="ns2:orderdetails">

<quantity xmlns:ns3="http://xml.apache.org/xml-soap" xsi:type="ns3:Vector">

<item xsi:type="xsd:string">2</item><item xsi:type="xsd:string">4</item></quantity>

SOAP Envelope Namespacefor wrapping messages

Method Call

SOAP<shipToCode xsi:type="xsd:string">1</shipToCode><custPartId xmlns:ns4="http://xml.apache.org/xml-soap"

xsi:type="ns4:Vector"><item xsi:type="xsd:string">FrtLeftA</item><item xsi:type="xsd:string">RearLeftA</item></custPartId><orderType xsi:type="xsd:int">1</orderType><orderSeqNo xsi:type="xsd:string">11</orderSeqNo><custOrderReference xsi:type="xsd:string">COR</custOrderReference><BCPCode xsi:type="xsd:string">1</BCPCode></orderdetails></ns1:createOrder></SOAP-ENV:Body></SOAP-ENV:Envelope>

SOAP hides the serviceimplementation from requester

Web Server

Soap Server

EJB CORBA COBOL

?????????????????Standard XML request/response

SOAP and Security

the standard authentication (e.g., SSL) mechanisms that are HTTP-friendly can be used with SOAP

firewalls can filter the soap payload based on the HTTP header information (interface and method names ).

What is UDDI?Universal Description, Discovery, and IntegrationA project to speed interoperability and adoption

for web servicesStandards-based specifications for service

description and discoveryShared operation of a web-based business

registryPartnership among industry and business leaders

more than 70 companies have signed up so far

What Problems UDDI Solves?

A mid-sized manufacturer needs to create 400 online relationships with customers, each with their own set of standard and protocols

BroaderB2B

A flower shop in Australia wants to be “plugged in” to every marketplace in the world, but doesn’t know how

SmarterSearch

A B2B marketplace cannot get catalog data for relevant suppliers in its industry, along with connections to shippers, insurers, etc.

Easier Aggregation

Describe Services

Discover Services

IntegrateThemTogether

UDDI v1 Implementation

UDDI RegistryProgrammatic descriptions of web

servicesProgramming model, schema, and

platform agnosticUses XML, HTTP, and SOAPFree on the Internet

UDDI Registry EntriesStandards Bodies,

Agencies, Programmers, Publishers register specifications for their Service Types

Service providers register precise information about themselves and their Web services

•Business name•General business description•Contact info

Names, phone numbers,

fax numbers, web sites, etc.

•Known identifiersList of unique identifiers for a business eg.D-U-N-S, Thomas, domain name, stock ticker symbol, other

Business categories•3 base taxonomies in V1

�Industry: NAICS (Industry codes - US Govt.)�Product/Services: UNSPSC (ECCMA)�Location: Geographical taxonomy (ISO 3166)…easy extension in upcoming releases

New set of information businesses use to describe how to “do e-commerce” with them

•Nested model�Business process (functional)�Service specifications (technical)�Binding information (implementation)

•Programming/platform/implementation agnostic•Services can also be categorized

How UDDI Works

UDDI Registry

3. UDDI Registry assigns a programmatically unique identifier to each service and registration

Marketplaces, search engines, and business applications query the registry to discover services at other companies and to facilitate integration

44..

Service Types

11..

ImplementationsImplementers populate the registry withdescriptions of their businesses and the services they expose

22..

Large businesses apply the same architecture and technologies internally

55..

Software companies, standards bodies, and developers populate the registry with descriptions (specifications) of types of services

Public Registry Operation

IBM

HP (planned)

Microsoftother

other

Peer registry nodes (websites)Information registered

with any nodeRegistrations replicated

on a daily basisComplete set of

“registered” recordsavailable at all nodes

Common set ofSOAP APIs supportedby all nodes

Compliance enforced by business contract

All technologies applied

Interoperability verified constantly

UDDI.org

queriesqueries

ApplicationsApplicationsApplicationsApplications

MarketplacesMarketplacesMarketplacesMarketplaces

End UsersEnd UsersEnd UsersEnd Users

DevelopersDevelopersDevelopersDevelopers

What is WSDL?

Web Services Description Language (WSDL)•Provides a contract that defines a Web interface•XML based format•Can define a schema for any XML interface (not necessarily just SOAP)•Defines endpoints

Adder Program

package test;public class adder{

public long addit(int a , int b){

return a+b;}

}

WSDL

<?xml version="1.0" encoding="UTF-8"?><definitions name="adder_Service" targetNamespace="http://localhost:7001/adder-interface" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost:7001/adder" xmlns:xsd="http://www.w3.org/1999/XMLSchema"><message name="InadditRequest"> <part name="meth1_inType1” type="xsd:int"/> <part name="meth1_inType2” type="xsd:int"/></message><message name="OutadditResponse"> <part name="meth1_outType” type="xsd:long"/></message>

WSDL

<portType name="adder_Service"> <operation name="addit"> <input message="InadditRequest"/> <output message="OutadditResponse"/> </operation></portType>

WSDL<binding name="adder_ServiceBinding" type="adder_Service"> <soap:binding style="rpc” transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="addit"> <soap:operation soapAction="urn:adder-service"/> <input> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:adder-service” use="encoded"/> </input> <output><soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:adder-service" use="encoded"/> </output>

WSDL</operation> </binding><service name="adder_Service"> <documentation>IBM WSTK 2.0 generated service definition file </documentation> <port binding="adder_ServiceBinding” name="adder_ServicePort” ><soap:address location="http://localhost:7001/soap/servlet/rpcrouter"/> </port></service></definitions>

EJBEJB

Our Prototype

HTMLForm

Servlet

DB Oracle

SOAP

Customer Order Creation

Weblogic 5.1 sp 9

Apache Soap Server v 2.2integrated with

Weblogic 5.1 sp 9

Application 1 Application 2

Order details

Order No.

Tools and Resources

•http://xml.apache.org/soap/ --> Apache SOAP Server

•http://www.alphaworks.ibm.com/tech/webservicestoolkit --> IBM Alphaworks WebServices Toolkit

Recommended