660 likes | 876 Views
Ian Thain Senior Architect eBD ithain@sybase.com. E203 Developing Web Services with EAServer v4.1. Agenda. Web services 101 Developing and Deploying Web services with WST Web Services Toolkit Demo Web Services Toolkit Interoperability Web Services Toolkit Futures Questions.
E N D
Ian Thain Senior Architect eBD ithain@sybase.com E203Developing Web Serviceswith EAServer v4.1
Agenda • Web services 101 • Developing and Deploying Web services with WST • Web Services Toolkit Demo • Web Services Toolkit Interoperability • Web Services Toolkit Futures • Questions
Web services 101 • What do we have today ? • What are Web services ? • Web services benefits • High-level architecture • Protocols involved – Web services stack
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
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
Web services 101 • Web services benefits • RAD • Neutral • Architecture & language • Leverage current investment • Accessed through many different client types
Registry Provider Service Web services 101 High Level Architecture • Provider creates and publishes service • A client searches a registry for that service • The client is able to connect and call the service Client
Web services 101 • Protocols involved – Web Services Stack WSFL UDDI WSDL SOAP XML TCP/IP, HTTP etc Emerging Layers Core Layers
Web services 101 • TCP/IP, HTTP • Common Internet Transport Protocols • Web services not tied to any one protocol
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
Web services 101 • SOAP • Simple Object Access Protocol, • Represents a • light-weight, • wire-level protocol • for messaging & RPC communications • Based on XML
Web services 101 • SOAP Message • Envelope comprised of • Header • Body • Body comprised of • Requests • Responses • Status • Attachments Envelope Header Body Requests Response Status Attachments
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
Web services 101 Document • WSDL Document • Comprised of • Data types • Message/method • Port • Binding • Service Data Types Message Interface Port Binding Implementation Service
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
Web services 101 Client UDDI Provider Lookup WEB Register Service
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.
Developing and Deploying Web services • Are Web services more than just hype ? • What is Sybase doing ? • Web Services Toolkit
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.
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.
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)
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.
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.
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
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
Developing and Deploying Web services with WST WST GUI • Integrated into Jaguar Manager • Management of WSDL docs UDDI entries SOAP management facilities
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.
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.
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.
Developing and Deploying Web services with WST Book Supplier • SOAP Node: • processes incoming SOAP request messages; • looks up and invokes EAServer component; • builds outgoing SOAP response messages. Client Application EAServer BuyBooks() SOAP Node WEB Client Proxy X WSDL Book Supplier WebSphere BuyBooks() SOAP Node
Web services Toolkit Demo • Overview • Creating WDSL • Data Types • Creating Client Proxy • Client Proxy code
Web services Toolkit Demo EAS • Server-side Component: • returns the latest myPortfolio share prices Components Client Proxy WSDL WEB WEB SOAP PFShareList Listener Portfolio Cache
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.
Web services Toolkit Demo • Create a WSDL Document • Definition name • Target Namespace
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
Web services Toolkit DemoInterface file <?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions name="PFTest" targetNamespace="http://ithain-2k:8080/PFTest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tnsa="http://ithain-2k:8080/PFTest"> <wsdl:types> <schema targetNamespace="http://ithain-2k:8080/PFTest" xmlns="http://www.w3.org/1999/XMLSchema"> <complexType name="ArrayOfString"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/> </restriction> </complexContent> </complexType> </schema> </wsdl:types> <wsdl:message name="getPFShareListOutput"> <wsdl:part name="return" type="tnsa:ArrayOfString"/> </wsdl:message> <wsdl:message name="getPFShareListInput"> </wsdl:message> <wsdl:portType name="PFShareListAll/PFShareListServicePortType"> <wsdl:operation name="getPFShareList"> <wsdl:input name="Input" message="getPFShareListInput"/> <wsdl:output name="Output" message="getPFShareListOutput"/> </wsdl:operation> </wsdl:portType> </wsdl:definitions> Interface file contains an abstract definition of the Web Service’s interfaces . This includes Types, Message, Ports, PortTypes and PortTypeOperations.
Web services Toolkit DemoImplementation file <?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions name="PFTest" targetNamespace="http://ithain-2k:8080/PFTestImpl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tnsi="http://ithain-2k:8080/PFTestImpl" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tnsa="http://ithain-2k:8080/PFTest"> <wsdl:documentation></wsdl:documentation> <wsdl:import namespace="http://ithain-2k:8080/PFTest" location="http://ithain-2k:8080/PFTest.wsdl"/> <wsdl:binding name="PFShareListAll/PFShareListServiceBinding" type="tnsa:PFShareListAll/PFShareListServicePortType"> <soap:binding transport="http://schemas.xmlsoap/org/soap/http" style="rpc"/> <wsdl:operation name="getPFShareList"> <wsdl:input name="getPFShareListInput"> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/> </wsdl:input> <wsdl:output name="getPFShareListOutput"> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/> </wsdl:output> <soap:operation soapAction="PFShareListAll/PFShareList.getPFShareList return,java.lang.String[],return" style="rpc"/> </wsdl:operation> </wsdl:binding> <wsdl:service name="PFShareListAll/PFShareListService"> <wsdl:documentation></wsdl:documentation> <wsdl:port name="PFShareListAll/PFShareListServicePort" binding="tnsi:PFShareListAll/PFShareListServiceBinding"> <soap:address location="http://ithain-2k:8080/WEBSERVICES/SOAP"/> </wsdl:port> </wsdl:service> </wsdl:definitions> soap:binding provides association between the abstract entity and a protocol. wsdl:port 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
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.
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
Java primitive datatypes java.lang object datatypes org.omg CORBA holder datatypes boolean java.lang.Boolean org.omg.CORBA.BooleanHolder byte java.lang.Byte org.omg.CORBA.ByteHolder double java.lang.Double org.omg.CORBA.DoubleHolder float java.lang.Float org.omg.CORBA.FloatHolder int java.lang.Int org.omg.CORBA.IntHolder long java.lang.Long org.omg.CORBA.LongHolder short java.lang.Short org.omg.CORBA.ShortHolder string java.lang.String org.omg.CORBA.StringHolder WST Supported Data types
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
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
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.BeanSerializer • This is rather than having to write your own serializer for the type, but the notion is exactly the same.
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
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).
Web services Toolkit Demo • Open the Web services properties • Web services Address • Service Operation
Web services Toolkit Demo Expand the SOAP Management section and take the option to Create a SOAP ClientProxy JAR
Web services Toolkit Demo Specify a Proxy JAR filename, and select the Implementation file to be used
Web services Toolkit Demo Create a Java Application