410 likes | 531 Views
INT404: Integrating Adaptive Server Enterprise with Web Services. Rajesh Chawla Senior Software Engineer rajesh.chawla@sybase.com August 6, 2003. Agenda. Why web services? Understanding Protocols (SOAP, WSDL, UDDI) ASE Web Services – Road map ASE Web Services Producer Demonstration
E N D
INT404: Integrating Adaptive Server Enterprise with Web Services Rajesh ChawlaSenior Software Engineerrajesh.chawla@sybase.comAugust 6, 2003
Agenda • Why web services? • Understanding Protocols (SOAP, WSDL, UDDI) • ASE Web Services – Road map • ASE Web Services Producer • Demonstration • ASE Web Services Consumer • Demonstration
Why Web Services? Web Services improve software integration • Why our current software integration solutions are not sufficient • Infrastructure needs to be created each time. • Solutions are language and platform dependent. • Each integration solution requires time for development, training and maintenance. • Why web services are better • Reduce costs for developing infrastructure. • Platform- and language-independent. • Interoperability is based on standards reducing development, training and maintenace costs.
Why Web Services? (cont) The Web Services Hype • IDC predicts that Web services will become the dominant distributed computing architecture in the next 10 years. Web services will drive software, services and hardware sales of $21 billion in the U.S. by 2007 and will reach $27 billion in 2010.http://www.idcresearch.com/getdoc.jhtml?containerId=pr2003_02_03_130651 • IBM: We believe that applications will be based on compositions of services discovered and marshaled dynamically at runtime (just-in-time integration of services http://www-106.ibm.com/developerworks/library/w-ovr • Sun: Web services provide: Decreasing time to market, decreasing TCO, customer flexibility to integrate softwarehttp://www.sun.com/learnabout/webservices
Why Web Services? (cont) • Web Services are self-contained, modular applications that can be described, published, located, and invoked over a network, generally the Web. • Web Services are based on XML, the universal language of Internet data exchange, and can be called across platforms and operating systems, regardless of programming language. • Web Services are associated with WSDL, UDDI, and SOAP protocol specifications. • Web Services are loosely coupled.
How Web Services are Invoked From Web Services Architecture Scenarios (http://www.w3.org/TR/ws-arch-scenarios)
Related Web Services Standards From Web Services Architecture Scenarios (http://www.w3.org/TR/ws-arch-scenarios)
Agenda • Why web services? • Understanding Protocols (SOAP, WSDL, UDDI) • ASE Web Services – Road map • ASE Web Services Producer • Demonstration • ASE Web Services Consumer • Demonstration
SOAP Simple Object Access Protocol • Standard defined by W3C (http://www.w3.org/TR/SOAP/) • XML-based protocol that consists of three parts: • An envelope that defines a framework for describing what is in a message and how to process it • A set of encoding rules for expressing instances of application-defined data types • Convention for representing remote procedure calls (RPCs) and responses • Transport independent, although most common transport is HTTP
SOAP SOAP packet
SOAP SOAP Packet <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:execute soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:genwsdl.ws.ase.sybase.com"> <aseServerName xsi:type="xsd:string">superior</aseServerName> <asePortNumber xsi:type="xsd:int">9765</asePortNumber> <userName xsi:type="xsd:string">bharat</userName> <password xsi:type="xsd:string">sybase</password> <sqlxOptions xsi:type="xsd:string">tablename=ws</sqlxOptions> <sql xsi:type="xsd:string">select * from discounts</sql> </ns1:execute> </soapenv:Body>
SOAP Encodings and Serialization • Encodings are representations of bits on the wire. SOAP has two types of encodings: • RPC– Defines one XML element for the name of the remote method being invoked and one XML element for each parameter of that procedure • Document – defined by agreement of caller and called • Serialization/Deserialization is the process of taking bits off the wire and converting them to structures. SOAP has two ways to do this: • Encoding – Represents data by Section 5 of the SOAP specification • Literal – Represents data by an XML schema.
SOAP Effect on Performance HTTP Request HTTP Body SOAP Envelope SOAP Body SOAP Body Block Integer Sender Receiver 0x5
WSDL Web Services Description Language • Standard defined by W3C (http://www.w3.org/TR/wsdl) • Describes services as a set of endpoints and how to invoke them. • Based on XML • Supports HTTP, Mime, and SOAP bindings. • Usually generated and consumed transparently by web services toolkits.
WSDL stack From Web Services Architecture (http://www.w3.org/TR/2002/WD-ws-arch-20021114/)
UDDI Universal Description Discovery and Integration • Standard defined by Oasis (http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=uddi-spec) • Provides a mechanism for publishing and locating web services (WSDL) • All access to a UDDI registry is by web services • UDDI registries support: • White pages – provide a search capability based on a unique identifier (such as DUNS, Thomas Registry or other). • Yellow pages – provide a search capability based on categories. Categories may include industry, product/service offering, and location. • Green pages – provide a search capability based on service type or capabilities.
Putting it together From Web Services Architecture (http://www.w3.org/TR/2002/WD-ws-arch-20021114/)
Agenda • Why web services? • Understanding Protocols (SOAP, WSDL, UDDI) • ASE Web Services – Road map • ASE Web Services Producer • Demonstration • ASE Web Services Consumer • Demonstration
ASE Web Services – Road map • ASE 12.5.1 • Model a web service as a proxy table • Execute T-SQL using web services • Candidate features for follow on releases • Enhanced performance • Enhanced data type support • Enhanced security • UDDI support • Streaming data • Single sign-on • Transaction support • Cursor Support
Delivered in ASE 12.5.1 Functionality • Access T-SQL as web methods • Generate dynamic WSDL • Model Web Service as a proxy table • Persistent database connections via sessions • SSL Support • LDAP Support • Can consume rpc/encoded and document/literal web services
Agenda • Why web services? • Understanding Protocols (SOAP, WSDL, UDDI) • ASE Web Services – Road map • ASE Web Services Producer • Demonstration • ASE Web Services Consumer • Demonstration
ASE Web Services Producer Accessing ASE with web services ASE Any SOAP client Input: SOAP Input: JDBC Output: SOAP Output: JDBC
Demonstration – ASE Web Services Producer • Execute select * from discounts through Web Services
Demonstration Results Resulting data <ws xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <row> <discounttype>Initial Customer</discounttype> <discount>10.5</discount> </row> <row> <discounttype>Volume Discount</discounttype> <lowqty>100</lowqty> <highqty>1000</highqty> <discount>6.7</discount> </row> <row> <discounttype>Huge Volume Discount</discounttype> <lowqty>1001</lowqty> <discount>10.0</discount> </row> <row> <discounttype>Customer Discount</discounttype> <stor_id>8042</stor_id> <discount>5.0</discount> </row> </ws>
Demonstration Results Resulting DTD <!ELEMENT ws (row*)> <!ELEMENT row (discounttype, stor_id?, lowqty?, highqty?, discount)> <!ELEMENT discounttype (#PCDATA)> <!ELEMENT stor_id (#PCDATA)> <!ELEMENT lowqty (#PCDATA)> <!ELEMENT highqty (#PCDATA)> <!ELEMENT discount (#PCDATA)>
Demonstration Results Resulting Schema <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sqlxml="http://www.iso-standards.org/mra/9075/sqlx"> <xsd:import namespace="http://www.w3.org/2001/XMLSchema" schemaLocation="http://www.iso-standards.org/mra/9075/sqlx.xsd" /> <xsd:complexType name="RowType.ws"> <xsd:sequence> <xsd:element name="discounttype" type="VARCHAR_40" /> <xsd:element name="stor_id" type="CHAR_4" minOccurs="0" maxOccurs="1"/> <xsd:element name="lowqty" type="SMALLINT" minOccurs="0" maxOccurs="1"/> <xsd:element name="highqty" type="SMALLINT" minOccurs="0" maxOccurs="1"/> <xsd:element name="discount" type="DOUBLE" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TableType.ws"> <xsd:sequence> <xsd:element name="row" type="RowType.ws" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType>
Demonstration Results Resulting Schema (Continued) <xsd:simpleType name="VARCHAR_40"> <xsd:restriction base="xsd:string"> <xsd:length value="40"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="SMALLINT"> <xsd:restriction base="xsd:integer"> <xsd:maxInclusive value="32767"/> <xsd:minInclusive value="-32768"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="DOUBLE"> <xsd:restriction base="xsd:double"/> </xsd:simpleType> <xsd:element name="ws" type="TableType.ws"/> </xsd:schema>
Agenda • Why web services? • Understanding Protocols (SOAP, WSDL, UDDI) • ASE Web Services – Road map • ASE Web Services Producer • Demonstration • ASE Web Services Consumer • Demonstration
ASE Web Services Consumer Steps to execute • Notify ASE of existence of ASE Web Services. • sp_addserver webservices, sds, webservices • Executed once per database • Import WSDL definition. • webservice...gen_sproc_from_wsdl "WSDL File URL", "ASE host name", ASE port number • Executed once for each web service to invoke. • Execute Web Service • select RRETURN from GETTEMP where _ZIPCODE=‘80303’ • Executed as needed.
Demonstration – ASE Web Services Consumer • Execute a web method located on xmethods.com site for retrieving temperature given a zip code.
Demonstration Results Create proxy table using isql • 1> webservice...gen_sproc_from_wsdl "http://www.xmethods.net/sd/2001/TemperatureService.wsdl", "nnebbish", 1665 • 2> go • (return status = 0) • Return parameters: • drop table GETTEMP • create existing table GETTEMP (RRETURN float, _ZIPCODE varchar(2048) null ) external procedure at 'webservice.XMLCONNECT.TEMPERATURESERVICE.GETTEMP' • (1 row affected) • (0 rows affected)
Demonstration Results Execute web method using isql • 1> select RRETURN from GETTEMP where _ZIPCODE='80303' • 2> go • RRETURN • -------------------- • 82.000000 • (1 row affected)
SDN Presents CodeXchange A New Benefit for Sybase Developers • Forum for exchanging samples, tools, scripts, etc. • New features enable community collaboration • Download samples created by Sybase or external users • Leverage contributions of others to extend Sybase products • Contribute code or start your own collaborative / open source project with input from other product experts • Any SDN member can participate • Log in using your MySybase account via SDN • www.codexchange.sybase.com • Or via SDN at www.sybase.com/developer • SDN & CodeXchange at TechWave • Visit SDN in the Technology Boardwalk • Learn about CodeXchange in the Sybase Booth Theater
Check Out These Related TechWave Sessions! • ASE111 - Integration, XML, and Web Services--Why are They Important to a DBA? • ASE114 - Querying and Transforming XML with XQuery, XPath, and SQLX • INT420 - Federated Database Solutions with Sybase Middleware • Boardwalk demos
Resources • W3C • http://www.w3c.org • Standards committee focusing on SOAP, WSDL and a variety of other protocols including HTTP and XML. • Oasis: • http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=uddi-spec • Standards committee focusing on UDDI and a variety of other protocols. • Web Services Interoperability (WS-I) • http://www.ws-i.org/ • Industry organization focused on encouraging SOAP interoperability. • XML Protocol Comparisons • http://www.w3.org/2000/03/29-XML-protocol-matrix • This site compares and contrasts a variety of XML protocols. • Executives Guide to Web Services from the Patricia Seybold Group • http://www.psgroup.com/vm/ws/report.asp • A business look at web services.
Resources • Apache Axis • http://ws.apache.org/axis/index.html • Open source SOAP/WSDL toolkit using Java. • Cover Pages • http://xml.coverpages.org/news2003Q3.html • News coverage for SGML and XML. • Sun • http://java.sun.com/xml/ • Sun’s XML and web services developer center. • Microsoft • http://msdn.microsoft.com/webservices/ • Microsoft’s web services developer center. • IBM • http://www-106.ibm.com/developerworks/webservices/ • IBM Web Services developer center.