Title: INT404: Integrating Adaptive Server Enterprise with Web Services
1INT404 Integrating Adaptive Server Enterprise
with Web Services
Rajesh ChawlaSenior Software Engineerrajesh.chaw
la_at_sybase.comAugust 6, 2003
2Agenda
- Why web services?
- Understanding Protocols (SOAP, WSDL, UDDI)
- ASE Web Services Road map
- ASE Web Services Producer
- Demonstration
- ASE Web Services Consumer
- Demonstration
3Why 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.
4Why 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?containerIdpr2003_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/de
veloperworks/library/w-ovr - Sun Web services provide Decreasing time to
market, decreasing TCO, customer flexibility to
integrate softwarehttp//www.sun.com/learnabout/w
ebservices
5Why 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.
6How Web Services are Invoked
From Web Services Architecture Scenarios
(http//www.w3.org/TR/ws-arch-scenarios)
7Related Web Services Standards
From Web Services Architecture Scenarios
(http//www.w3.org/TR/ws-arch-scenarios)
8Agenda
- Why web services?
- Understanding Protocols (SOAP, WSDL, UDDI)
- ASE Web Services Road map
- ASE Web Services Producer
- Demonstration
- ASE Web Services Consumer
- Demonstration
9SOAP
Simple Object Access Protocol
- Standard defined by W3C (http//www.w3.org/TR/SOA
P/) - 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
10SOAP
SOAP packet
11SOAP
SOAP Packet
- lt?xml version"1.0" encoding"UTF-8"?gt
- ltsoapenvEnvelope xmlnssoapenv"http//schemas.xm
lsoap.org/soap/envelope/" xmlnsxsd"http//www.w3
.org/2001/XMLSchema" xmlnsxsi"http//www.w3.org/
2001/XMLSchema-instance"gt - ltsoapenvBodygt
- ltns1execute soapenvencodingStyle"http//schem
as.xmlsoap.org/soap/encoding/" xmlnsns1"urngenw
sdl.ws.ase.sybase.com"gt - ltaseServerName xsitype"xsdstring"gtsuperiorlt/
aseServerNamegt - ltasePortNumber xsitype"xsdint"gt9765lt/asePort
Numbergt - ltuserName xsitype"xsdstring"gtbharatlt/userNam
egt - ltpassword xsitype"xsdstring"gtsybaselt/passwor
dgt - ltsqlxOptions xsitype"xsdstring"gttablenamews
lt/sqlxOptionsgt - ltsql xsitype"xsdstring"gtselect from
discountslt/sqlgt - lt/ns1executegt
- lt/soapenvBodygt
12SOAP
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.
13SOAP
Effect on Performance
HTTP Request
HTTP Body
SOAP Envelope
SOAP Body
SOAP Body Block
Integer
Sender
Receiver
0x5
14WSDL
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.
15WSDL stack
From Web Services Architecture (http//www.w3.org/
TR/2002/WD-ws-arch-20021114/)
16UDDI
Universal Description Discovery and Integration
- Standard defined by Oasis (http//www.oasis-open.o
rg/committees/tc_home.php?wg_abbrevuddi-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.
17Putting it together
From Web Services Architecture (http//www.w3.org/
TR/2002/WD-ws-arch-20021114/)
18Agenda
- Why web services?
- Understanding Protocols (SOAP, WSDL, UDDI)
- ASE Web Services Road map
- ASE Web Services Producer
- Demonstration
- ASE Web Services Consumer
- Demonstration
19ASE 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
20Delivered 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
21Agenda
- Why web services?
- Understanding Protocols (SOAP, WSDL, UDDI)
- ASE Web Services Road map
- ASE Web Services Producer
- Demonstration
- ASE Web Services Consumer
- Demonstration
22ASE Distributed Data Access
23ASE Web Services Producer
Accessing ASE with web services
ASE
Any SOAP client
Input SOAP
Input JDBC
Output SOAP
Output JDBC
24ASE Web Services Producer (Internals)
25Demonstration ASE Web Services Producer
- Execute select from discounts through Web
Services
26Demonstration Results
Resulting data
- ltws xmlnsxsi"http//www.w3.org/2001/XMLSchema-in
stance"gt - ltrowgt
- ltdiscounttypegtInitial Customerlt/discounttype
gt - ltdiscountgt10.5lt/discountgt
- lt/rowgt
- ltrowgt
- ltdiscounttypegtVolume Discountlt/discounttypegt
- ltlowqtygt100lt/lowqtygt
- lthighqtygt1000lt/highqtygt
- ltdiscountgt6.7lt/discountgt
- lt/rowgt
- ltrowgt
- ltdiscounttypegtHuge Volume
Discountlt/discounttypegt - ltlowqtygt1001lt/lowqtygt
- ltdiscountgt10.0lt/discountgt
- lt/rowgt
27Demonstration Results
Resulting DTD
- lt!ELEMENT ws (row)gt
- lt!ELEMENT row (discounttype, stor_id?, lowqty?,
highqty?, discount)gt - lt!ELEMENT discounttype (PCDATA)gt
- lt!ELEMENT stor_id (PCDATA)gt
- lt!ELEMENT lowqty (PCDATA)gt
- lt!ELEMENT highqty (PCDATA)gt
- lt!ELEMENT discount (PCDATA)gt
28Demonstration Results
Resulting Schema
- ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
chema" - xmlnssqlxml"http//www.iso-standards.org/mra/
9075/sqlx"gt - ltxsdimport namespace"http//www.w3.org/2001/X
MLSchema" - schemaLocation"http//www.iso-standards.org
/mra/9075/sqlx.xsd" /gt - ltxsdcomplexType name"RowType.ws"gt
- ltxsdsequencegt
- ltxsdelement name"discounttype"
type"VARCHAR_40" /gt - ltxsdelement name"stor_id"
type"CHAR_4" minOccurs"0" maxOccurs"1"/gt - ltxsdelement name"lowqty"
type"SMALLINT" minOccurs"0" maxOccurs"1"/gt - ltxsdelement name"highqty"
type"SMALLINT" minOccurs"0" maxOccurs"1"/gt - ltxsdelement name"discount"
type"DOUBLE" /gt - lt/xsdsequencegt
- lt/xsdcomplexTypegt
- ltxsdcomplexType name"TableType.ws"gt
- ltxsdsequencegt
- ltxsdelement name"row"
type"RowType.ws"
29Demonstration Results
Resulting Schema (Continued)
- ltxsdsimpleType name"VARCHAR_40"gt
- ltxsdrestriction base"xsdstring"gt
- ltxsdlength value"40"/gt
- lt/xsdrestrictiongt
- lt/xsdsimpleTypegt
- ltxsdsimpleType name"SMALLINT"gt
- ltxsdrestriction base"xsdinteger"gt
- ltxsdmaxInclusive value"32767"/gt
- ltxsdminInclusive value"-32768"/gt
- lt/xsdrestrictiongt
- lt/xsdsimpleTypegt
- ltxsdsimpleType name"DOUBLE"gt
- ltxsdrestriction base"xsddouble"/gt
- lt/xsdsimpleTypegt
- ltxsdelement name"ws" type"TableType.ws"/gt
30Agenda
- Why web services?
- Understanding Protocols (SOAP, WSDL, UDDI)
- ASE Web Services Road map
- ASE Web Services Producer
- Demonstration
- ASE Web Services Consumer
- Demonstration
31ASE Distributed Data Access
32ASE Web Services Consumer (Details)
33ASE Web Services Consumer (Internals)
34ASE 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
_ZIPCODE80303 - Executed as needed.
35Demonstration ASE Web Services Consumer
- Execute a web method located on xmethods.com site
for retrieving temperature given a zip code.
36Demonstration Results
Create proxy table using isql
- 1gt webservice...gen_sproc_from_wsdl
"http//www.xmethods.net/sd/2001/TemperatureServic
e.wsdl", "nnebbish", 1665 - 2gt 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.GETTE
MP' -
- (1 row affected)
- (0 rows affected)
37Demonstration Results
Execute web method using isql
- 1gt select RRETURN from GETTEMP where
_ZIPCODE'80303' - 2gt go
- RRETURN
- --------------------
- 82.000000
- (1 row affected)
38SDN 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
39Check 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
40Resources
- 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?w
g_abbrevuddi-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.
-
41Resources
- 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/
- Suns XML and web services developer center.
- Microsoft
- http//msdn.microsoft.com/webservices/
- Microsofts web services developer center.
- IBM
- http//www-106.ibm.com/developerworks/webservices/
- IBM Web Services developer center.
-