Ian Thain - PowerPoint PPT Presentation

1 / 66
About This Presentation
Title:

Ian Thain

Description:

xmlns:tnsi='http://ithain-2k:8080/PFTestImpl' xmlns:xsd='http://www.w3.org/1999/XMLSchema' ... binding='tnsi:PFShareListAll/PFShareListServiceBinding' ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 67
Provided by: jeremys70
Category:
Tags: ian | thain | tnsi

less

Transcript and Presenter's Notes

Title: Ian Thain


1
E203Developing Web Serviceswith EAServer v4.1
  • Ian Thain
  • Senior Architect
  • eBD
  • ithain_at_sybase.com

2
Agenda
  • Web services 101
  • Developing and Deploying Web services with WST
  • Web Services Toolkit Demo
  • Web Services Toolkit Interoperability
  • Web Services Toolkit Futures
  • Questions

3
Web services 101
  • What do we have today ?
  • What are Web services ?
  • Web services benefits
  • High-level architecture
  • Protocols involved Web services stack

4
Web services 101
  • What do we have today ?
  • We have components residing in app servers behind
    firewalls, most of which cannot be accessed via
    http but IIOP
  • So integration is hard work !
  • There is no central registry of everyone's
    components
  • Limited client access

5
Web services 101
  • What are Web services ?
  • Made up of standards that describe business
    processes
  • Self describing
  • Searchable in a registry of services
  • Sync or Async
  • Loosely coupled and cross platform
  • Reusable

6
Web services 101
  • Web services benefits
  • RAD
  • Neutral
  • Architecture language
  • Leverage current investment
  • Accessed through many different client types

7
Web services 101
High Level Architecture
Client
  • Provider creates and publishes service
  • A client searches a registry for that service
  • The client is able to connect and call the service

8
Web services 101
  • Protocols involved Web Services Stack
  • WSFL
  • UDDI
  • WSDL
  • SOAP
  • XML
  • TCP/IP, HTTP etc

Emerging Layers
Core Layers
9
Web services 101
  • TCP/IP, HTTP
  • Common Internet Transport Protocols
  • Web services not tied to any one protocol

10
Web services 101
  • XML
  • Extensible Markup Language
  • Widely accepted format to exchange data
    semantics
  • Core building block for every layer in the Web
    services stack

11
Web services 101
  • SOAP
  • Simple Object Access Protocol,
  • Represents a
  • light-weight,
  • wire-level protocol
  • for messaging RPC communications
  • Based on XML

12
Web services 101
  • SOAP Message
  • Envelope comprised of
  • Header
  • Body
  • Body comprised of
  • Requests
  • Responses
  • Status
  • Attachments

Envelope
Header
Body
Requests
Response
Status
Attachments
13
Web services 101
  • WSDL
  • Web Services Definition Language
  • Based on XML
  • Defines
  • Functionality of a Web service
  • Supported protocols
  • Message formats
  • Location of Web service

14
Web services 101
  • WSDL Document
  • Comprised of
  • Data types
  • Message/method
  • Port
  • Binding
  • Service

Document
Data Types
Message
Interface
Port
Binding
Implementation
Service
15
Web services 101
  • UDDI
  • Universal Description, Discovery and Integration
  • SOAP-based Web service
  • Allows
  • Providers to register services
  • Clients to lookup services
  • Uses WSDL to describe services

16
Web services 101
Client
UDDI
Provider
Lookup
WEB
Register
Service
17
Web services 101
  • WSFL
  • Web Services Flow Language
  • Least developed
  • Hopes to define a framework that describes
    business logic to assemble various Web services
    into an end to end process.

18
Developing and Deploying Web services
  • Are Web services more than just hype ?
  • What is Sybase doing ?
  • Web Services Toolkit

19
Developing and Deploying Web services
  • Are Web services more than just hype ?
  • Service-oriented application development is real
    and Web services is more than just hype.
  • Many businesses today are designing their next
    generation strategic computing platforms around
    the idea of easily-accessible Web services
  • Many have begun to implement Web services, in
    preparation to extend their systems to this new
    agile computing paradigm.

20
Developing and Deploying Web services with WST
  • What is Sybase doing ?
  • Sybase has recognized that the first step in this
    process is to have an inventory of available Web
    services.
  • EAServer 4.1 includes the Web Services Toolkit
  • WST is a utility that allows users to take their
    existing business components and make them
    available as a Web services.
  • The Web Services Toolkit provides support for the
    latest standards SOAP, WSDL and UDDI.

21
Developing and Deploying Web services with WST
  • Web Services Toolkit
  • The Toolkit provides a full SOAP engine,
    supporting SOAP request/response.
  • In addition, the toolkit offers a utility that
    can be run against a component in EAServer, to
    determine its soapability.
  • The utility scans the component, chooses any
    methods that meet the soap criteria (all in/out
    parameters are supported by the SOAP standard)

22
Developing and Deploying Web services with WST
  • WST Generates the WSDL document that describes
    that method.
  • Once the WSDL is generated, it can be posted to a
    UDDI repository, making the Web service publicly
    available.

23
Developing and Deploying Web services with WST
  • In addition, the Toolkit provides a client proxy,
    which can be sent along with the WSDL
    document to a partner organization.

24
Developing and Deploying Web services with WST
EAS
Components
Client
Application
WEB
WEB
Client Proxy
SOAP
Component
WSDL
Listener
X
WS
UDDI HOST
Manager

Gen WSDL, Proxy
WS

Register User
-
Defined Types
GUI
25
Developing and Deploying Web services with WST
SOAP Listener (Servlet) Receives a SOAP
request Verifies a valid SOAP format Parses the
SOAP request Constructs a call to the specific
component/method Uses the output from the
method Construct a response message Sends message
back to client Through HTTP or HTTPS
26
Developing and Deploying Web services with WST
WST GUI
  • Integrated into Jaguar Manager
  • Management of
  • WSDL docs
  • UDDI entries
  • SOAP management facilities

27
Developing and Deploying Web services with WST
  • Client Proxy
  • Provides clients of EAServer owners easy access
    to EAServer components
  • parses WSDL file for Web service information
  • builds SOAP request from WSDL info
  • sends SOAP request to EAServer
  • processes SOAP response
  • hands output and return values to client
    application.

28
Developing and Deploying Web services with WST
  • Client Proxy
  • A java developer can make java calls directly to
    the client proxy
  • The client proxy will then handle reading the
    WSDL and trading SOAP messages with the EAServer
    hosting the Web service itself.
  • This means that a Java developer can utilize Web
    services without needing any knowledge of SOAP
    internals.

29
Developing and Deploying Web services with WST
  • Client Proxy Inter-Operability
  • Reads any well-formed WSDL document.
  • Prepares SOAP Requests for Sybase SOAP Server
    only.
  • Why Parses method signature information from
    SOAPAction rather from WSDL Message and Parts
    elements.

30
Developing and Deploying Web services with WST
Book Supplier
Client Application
EAServer
BuyBooks()
SOAP Node
WEB
Client Proxy
X
WSDL
Book Supplier
  • SOAP Node
  • processes incoming SOAP request messages
  • looks up and invokes EAServer component
  • builds outgoing SOAP response messages.

WebSphere
BuyBooks()
SOAP Node
31
Web services Toolkit Demo
  • Overview
  • Creating WDSL
  • Data Types
  • Creating Client Proxy
  • Client Proxy code

32
Web services Toolkit Demo
EAS
Components
Client Proxy
WSDL
WEB
WEB
SOAP
PFShareList
Listener
Portfolio Cache
  • Server-side Component
  • returns the latest myPortfolio share prices

33
Web services Toolkit Demo
  • Client-side GUI (incorporates Client Proxy)
  • retrieves service information from WSDL file
  • builds SOAP request
  • sends SOAP request via HTTP or HTTPS
  • parse SOAP response message and displays returned
    information to user.

34
Web services Toolkit Demo
Create a WSDL Document Definition name Target
Namespace
35
Web services Toolkit Demo
  • WSDL describes the
  • interface,
  • implementation
  • and deployment details
  • of Web services, in a uniform way.
  • WST separates WSDL service definitions into an
    interface file and an implementation file

36
Web services Toolkit DemoInterface file
lt?xml version"1.0" encoding"UTF-8"
?gt ltwsdldefinitions name"PFTest"
targetNamespace"http//ithain-2k8080/PFTest"
xmlnswsdl"http//schemas.xmlsoap.org/wsdl/"
xmlnssoapenc"http//schemas.xmlsoap.org/soap/en
coding/" xmlnsxsd"http//www.w3.org/1999/XML
Schema" xmlnssoap"http//schemas.xmlsoap.org
/wsdl/soap/" xmlnstnsa"http//ithain-2k8080
/PFTest"gt ltwsdltypesgt ltschema
targetNamespace"http//ithain-2k8080/PFTest"
xmlns"http//www.w3.org/1999/XMLSchema
"gt ltcomplexType name"ArrayOfString"gt
ltcomplexContentgt
ltrestriction base"soapencArray"gt
ltattribute ref"soapencarrayType"
wsdlarrayType"xsdstring"/gt
lt/restrictiongt lt/complexContentgt
lt/complexTypegt lt/schemagt
lt/wsdltypesgt ltwsdlmessage
name"getPFShareListOutput"gt ltwsdlpart
name"return" type"tnsaArrayOfString"/gt
lt/wsdlmessagegt ltwsdlmessage
name"getPFShareListInput"gt lt/wsdlmessagegt
ltwsdlportType name"PFShareListAll/PFShareListS
ervicePortType"gt ltwsdloperation
name"getPFShareList"gt ltwsdlinput
name"Input" message"getPFShareListInput"/gt
ltwsdloutput name"Output"
message"getPFShareListOutput"/gt
lt/wsdloperationgt lt/wsdlportTypegt lt/wsdldefi
nitionsgt
Interface file contains an abstract definition
of the Web Services interfaces . This includes
Types, Message, Ports, Port Types and Port Type
Operations.
37
Web services Toolkit DemoImplementation file
lt?xml version"1.0" encoding"UTF-8"
?gt ltwsdldefinitions name"PFTest"
targetNamespace"http//ithain-2k8080/PFTestImpl"
xmlnswsdl"http//schemas.xmlsoap.org/wsdl/"
xmlnssoapenc"http//schemas.xmlsoap.org/soa
p/encoding/" xmlnstnsi"http//ithain-2k8080
/PFTestImpl" xmlnsxsd"http//www.w3.org/1999
/XMLSchema" xmlnssoap"http//schemas.xmlsoap
.org/wsdl/soap/" xmlnstnsa"http//ithain-2k
8080/PFTest"gt ltwsdldocumentationgtlt/wsdldocum
entationgt ltwsdlimport namespace"http//ithai
n-2k8080/PFTest" location"http//ithain
-2k8080/PFTest.wsdl"/gt ltwsdlbinding
name"PFShareListAll/PFShareListServiceBinding"
type"tnsaPFShareListAll/PFShareListServicePortTy
pe"gt ltsoapbinding transport"http//schem
as.xmlsoap/org/soap/http" style"rpc"/gt
ltwsdloperation name"getPFShareList"gt
ltwsdlinput name"getPFShareListInput"gt
ltsoapbody encodingStyle"http//schemas.xm
lsoap.org/soap/encoding/" use"encoded"/gt
lt/wsdlinputgt ltwsdloutput
name"getPFShareListOutput"gt
ltsoapbody encodingStyle"http//schemas.xmlsoap.o
rg/soap/encoding/" use"encoded"/gt
lt/wsdloutputgt ltsoapoperation
soapAction"PFShareListAll/PFShareList.getPFShareL
ist return,java.lang.String,return"
style"rpc"/gt lt/wsdloperationgt
lt/wsdlbindinggt ltwsdlservice
name"PFShareListAll/PFShareListService"gt
ltwsdldocumentationgtlt/wsdldocumentationgt
ltwsdlport name"PFShareListAll/PFShareListService
Port" binding"tnsiPFShareListAll/PFShareListServ
iceBinding"gt ltsoapaddress
location"http//ithain-2k8080/WEBSERVICES/SOAP"/
gt lt/wsdlportgt lt/wsdlservicegt lt/wsdl
definitionsgt
soapbinding provides association between the
abstract entity and a protocol.
wsdlport provides the access point to the
service (the SOAP Servlet)
Contains the definitions of a Web Service
instance by a specific provider. This includes
Service, Port, Binding and Binding Elements
38
Web services Toolkit Demo
Create a new Web service in the WSDL Document
  • Browse packages and components
  • These are components that use supported data
    types.

39
WST Supported Data types
  • From WST you can select any installed component
    in EAServer that uses supported data types as
  • return values and
  • parameters.
  • Overloaded methods are supported
  • There are two component types for Java components
  • Java with IDL
  • Java with JDBC data types

40
WST Supported Data types
41
WST Supported Data types
  • EAServer supported data types are
  • BCD.BinaryHolder
  • BCD.Decimal
  • BCD.DecimalHolder
  • BCD.Money
  • BCD.MoneyHolder
  • MJD.Date
  • MJD.Time
  • MJD.Timestamp

42
WST Supported Data types
  • WST supports arrays of known data types encoded
    as SOAP arrays by data type, including support of
    arrays of any type.
  • It also supports java.util.Vector
  • elements must be a known data type
  • JavaBeans are not automatically supported

43
User Defined Data types
  • The simplest case to explain is that of an object
    that follows the JavaBean design pattern.
  • In this case we can use the BeanSerializer
    provided as part of WST.
  • com.sybase.webservices.soap.encoding.BeanSerializ
    er
  • This is rather than having to write your own
    serializer for the type, but the notion is
    exactly the same.

44
User Defined Data types
package com.sybase.sample   public class
SimpleBean implements java.io.Serializable
public SimpleBean( ) public
void setValue( String value )
this.value value public String
getValue( ) return this.value
private String value null
zero argument constructor
Get and set for each field
Get and set for each field
45
User Defined Data types
Then in the WST GUI we define the type and make
an association with the serializer/deserializer
that we want to operate on the object
  • In the Manage SOAP User-
  • Defined Types window under the
  • SOAP Management/Utilities
  • folder.

Once this type is saved then if a component uses
this data type it will show up in the WST GUI as
an available component (after a server
refresh/restart).
46
Web services Toolkit Demo
Open the Web services properties Web services
Address Service Operation
47
Web services Toolkit Demo
Expand the SOAP Management section and take the
option to Create a SOAP ClientProxy JAR
48
Web services Toolkit Demo
Specify a Proxy JAR filename, and select the
Implementation file to be used
49
Web services Toolkit Demo
50
Web services Toolkit Demo
Create a Java Application
51
Web services Toolkit Demo
Instantiate the SoapProxy class, WSDL filename
is optional
import com.sybase.webservices.soap.proxy.SoapProxy
import java.util.
SoapProxy proxy new SoapProxy( )  
method name string comes from the SOAP action
for the service
String methodName"PFShareListAll/PFShareList.get
PFShareList"  
You add the code to create the parameter
objects added to the parameter vector
Vector params new Vector()
String rtn (String) proxy.invokeService(meth
odName, params )  
Invoke the Web service casting the return value
to the correct datatype
//Iterate through the String Array and place the
values in the JTable for(int i 0 i lt
rtn.length i) StringTokenizer line new
StringTokenizer(rtni, ",") jtable_1.setVal
ueAt( line.nextToken(), i, 0 ) jtable_1.setValu
eAt( line.nextToken(), i, 1 ) jtable_1.setValueA
t( line.nextToken(), i, 2 )
52
SOAP Sample Application
EAS
Components
Client Proxy
WSDL
WEB
WEB
SOAP
PFShareList
Listener
Portfolio Cache
53
Web services Toolkit Demo
port ndx 0 PortName PFShareListAll/PFShareListSe
rvicePort Found 1 addresses. OpName is
getPFShareList Method Name is getPFShareList soap
OP action PFShareListAll/PFShareList.getPFShareLi
st return,java.lang.String,return soapAction,
parmType java.lang.String parmType
java.lang.String classType Ljava.lang.String
Location added http//ithain-2k8080/WEBSERVICES/S
OAP number addresses 1 attempting soap
addresses address ndx 0 soapAction, parmType
java.lang.String parmType java.lang.String cl
assType Ljava.lang.String gtlt SoapTransport(
) gtlt HttpTransport constructor gtsetDestination lt
setDestination gt ClientRequest.send sending
non-uddi soap request gtSoapTransport.send() Host
Name ithain-2k Port Name 8080  
54
Web services Toolkit Demo
POST /WEBSERVICES/SOAP HTTP/1.1 Connection
close Host ithain-2k Content-type text/xml
charset"utf-8" Content-length484 SOAPActionPFSh
areListAll/PFShareList.getPFShareList
return,java.lang.String,return ltSOAP-ENVEnvelop
e xmlnsSOAP-ENV"http//schemas.xmlsoap.org/soap/
envelope/" xmlnsSOAP-ENC"http//schemas.xmlsoap
.org/soap/encoding/" xmlnsxsi"http//www.w3.org
/1999/XMLSchema-instance" xmlnsxsd"http//www.w3
.org/1999/XMLSchema" SOAP-ENVencodingStyle"htt
p//schemas.xmlsoap.org/soap/encoding/"
gt ltSOAP-ENVHeadergt lt/SOAP-ENVHeadergt ltSOAP-ENVB
odygt ltmgetPFShareList xmlnsm"PFShareListAll/PFS
hareList" gt lt/mgetPFShareListgt lt/SOAP-ENVBodygt lt
/SOAP-ENVEnvelopegt  
55
Web services Toolkit Demo
Soap Response HTTP/1.1 200 OK Server Jaguar
Server Version 4.1Connection Close Content-Type
text/xmlContent-Length 1365 ltSOAP-ENVEnvelope
xmlnsSOAP-ENV"http//schemas.xmlsoap.org/soap/en
velope/" xmlnsSOAP-ENC"http//schemas.xmlsoap.o
rg/soap/encoding/" xmlnsxsi"http//www.w3.org/19
99/XMLSchema-instance" xmlnsxsd"http//www.w3.o
rg/1999/XMLSchema" SOAP-ENVencodingStyle"http/
/schemas.xmlsoap.org/soap/encoding/"
gt ltSOAP-ENVBodygt ltmgetPFShareListResponse
xmlnsm"PFShareListAll/PFShareList" gt ltreturn
xsitype"SOAP-ENCArray" SOAP-ENCarrayType"xsd
string13"gt ltitem xsitype"xsdstring"gtAETH,Aeth
er Systems,6.0000lt/itemgt ltitem xsitype"xsdstrin
g"gtAMZN,Amazon COM,7.0192lt/itemgt ltitem
xsitype"xsdstring"gtBB.L,Bradford
Bingley,320.0000lt/itemgt ltitem xsitype"xsdstring
"gtDAL,Delta Airlines,22.1100lt/itemgt ltitem
xsitype"xsdstring"gtDIS,Walt Disney
Co,17.4600lt/itemgt ltitem xsitype"xsdstring"gtF,Fo
rd Motor Company,16.5400lt/itemgt ltitem
xsitype"xsdstring"gtFDX,Fedex
Corp,35.1000lt/itemgt ltitem xsitype"xsdstring"gtIN
TC,Intel Corp,22.3500lt/itemgt ltitem
xsitype"xsdstring"gtLLOY.L,Lloyds TSB
Group,635.0000lt/itemgt ltitem xsitype"xsdstring"gt
MGM,Metro Goldwyn ,14.4100lt/itemgt ltitem
xsitype"xsdstring"gtRTR.L,Reuters
Group,548.0000lt/itemgt ltitem xsitype"xsdstring"gt
SUNW,Sun Microsystems,8.7100lt/itemgt ltitem
xsitype"xsdstring"gtSY,Sybase
Inc,16.0000lt/itemgt lt/returngt lt/mgetPFShareListRes
ponsegt lt/SOAP-ENVBodygt lt/SOAP-ENVEnvelopegt  
56
Web services Toolkit Demo
gtclient response constructor Processing SD
response Method Response Name getPFShareListRespo
nse expectedType http//schemas.xmlsoap.org/soap/e
ncoding/Array deser --gt com.sybase.webservices.so
ap.encoding.ArrayDeserializer
57
Web services Toolkit Interoperability
It is possible to call Web services on EAS from
other App Servers Examples A JSP in BEA
WLS using WST Client Proxy A JSP in BEA WLS using
Apache SOAP
58
Web services Toolkit Called by JSP using WST
Client Proxy
EAS
BEA WLS
Components
JSP
WEB
WEB
WST Client Proxy
SOAP
PFShareList
Listener
Portfolio Cache
59
Web services Toolkit Called by JSP using WST
Client Proxy
ltHTMLgt ltHEADgtltTITLEgt myPortfolio lt/TITLEgtlt/HEADgt lt
BODYgt lt-- Page Directives --gt lt_at_ page
language"java" buffer"8kb" import"com.sybase.we
bservices.soap.proxy.SoapProxy, java.util."
autoFlush"true" isThreadSafe"true"
isErrorPage"false" gt ltH1gt myPortfolio lt/H1gt lt
try SoapProxy proxy new SoapProxy(
) String methodName"PFShareListAll/PFShareLis
t.getPFShareList" Vector params new
Vector() String rtn (String)
proxy.invokeService(methodName, params
) for(int i 0 i lt rtn.length
i) out.println( rtni ltBRgt
) catch ( Exception e )
e.printStackTrace() gt lt/BODYgtlt/HTMLgt
60
Web services Toolkit Called by JSP using Apache
SOAP
EAS
BEA WLS
Components
JSP
WEB
WEB
Apache SOAP
SOAP
PFShareList
Listener
Portfolio Cache
61
Web services Toolkit Called by JSP using Apache
SOAP
ltHTMLgt ltHEADgtltTITLEgt myPortfolio Share
Prices lt/TITLEgtlt/HEADgt ltBODYgt   lt-- Page
Directives --gt lt_at_ page language"java"
buffer"8kb" import"java.io., java.net.,
java.util., org.apache.soap.,
org.apache.soap.encoding., org.apache.soap.util.x
ml., org.apache.soap.encoding.soapenc.,
org.apache.soap.rpc." autoFlush"true"
isThreadSafe"true" isErrorPage"false"
gt   ltH1gt myPortfolio Web Services Example Apache
SOAP calling WST EJB Web Service lt/H1gt   lt ArrayS
erializer arraySer new ArraySerializer() SOAPMa
ppingRegistry smr new SOAPMappingRegistry() smr
.setDefaultEncodingStyle(Constants.NS_URI_SOAP_ENC
) smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
QName ("", "Array"), null, arraySer,
arraySer)   // Build the call. Call call new
Call () call.setTargetObjectURI
("PFShareListAll/PFShareList") call.setMethodName
("getPFShareList") call.setEncodingStyleURI(Cons
tants.NS_URI_SOAP_ENC) call.setSOAPMappingRegistr
y(smr)  
62
Web services Toolkit Called by JSP using Apache
SOAP
  // make the call note that the action URI is
empty because the // XML-SOAP rpc router does not
need this. This may change in the //
future.   URL url new URL ("http//217.35.86.215
8090/WEBSERVICES/SOAP") String actionURI
"PFShareListAll/PFShareList.getPFShareList
return,java.lang.String,Array" Response resp
call.invoke (/ router URL / url, / actionURI
/ actionURI )   // Check the response. if
(resp.generatedFault ()) Fault fault
resp.getFault () System.out.println ("Ouch,
the call failed ") System.out.println ("
Fault Code " fault.getFaultCode ())
System.out.println (" Fault String "
fault.getFaultString ()) else
System.out.println ("OK... got the data bach
now lest parse it !!!") Parameter result
resp.getReturnValue () String presult
(String) result.getValue() int size
presult.length   StringTokenizer data
null   for( int i 0 i lt size i )
data new StringTokenizer(presulti,
",") out.println((String)data.nextToken()",
"(String)data.nextToken()", "
(String)data.nextToken()"ltBRgt ") gt lt/BODYgt
lt/HTMLgt
63
Summary
  • Web Services, Version 1 provides
  • a SOAP Server
  • extensive data type serialization and
    de-serialization
  • WSDL document generation
  • proxy to minimize end-client programming when
    accessing EAServer Web services
  • GUI and Jagtool interfaces for performing WSDL,
    UDDI, and SOAP tasks

64
Web services Toolkit Futures
Calling Web services from PB client Wrapping PB
components as Web services Web Services, Version
2 Modify Proxy to be an EAServer component that
can build and send SOAP requests from EAServer to
any SOAP server
65
Whitepapers
  • Located on http//www.sybase.com
  • Using the Web services toolkit with EAServer
    v4.1
  • Installing Apache SOAP with EAServer

66
Questions ?
Write a Comment
User Comments (0)
About PowerShow.com