1 / 41

J2EE Technologies: Web Services II

J2EE Technologies: Web Services II. Benny Rochwerger Research Staff Member. Agenda. Web Services: What is it about XML Primer Simple Object Access Protocol – SOAP Describing Web Services – WSDL Discovering Web Services – UDDI Web Services in the Marketplace What is next

conniemcgee
Download Presentation

J2EE Technologies: Web Services II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. J2EE Technologies: Web Services II Benny Rochwerger Research Staff Member

  2. Agenda • Web Services: What is it about • XML Primer • Simple Object Access Protocol – SOAP • Describing Web Services – WSDL • Discovering Web Services – UDDI • Web Services in the Marketplace • What is next • The Open Grid Services Architecture

  3. The Service Oriented Architecture (SOA) ServiceRegistry Publish Find ServiceProvider ServiceRequestor Bind

  4. The Web Services Stack ServicePublication/Discovery UDDI ServiceDescription WSDL XML Messaging SOAP Transport Network HTTP, SMTP, MQSeries, etc.

  5. Web Services Description Language (WSDL) • Why service descriptions are needed ? • SOAP is the format of the envelope • It does not specify what message goes into the envelope • A formal mechanism to describe • What goes into the body • What messaging protocol to use • What address to send the message to

  6. Web Services Description Language (WSDL) • Application level service description (abstract interface) • What a service does • Operations, parameters, return values • Protocol-specific details needed to access the service end points (concrete binding information) • How a service is accessed • Data formats and protocols necessary • Where a service is located • Network address of service provider

  7. WSDL Elements • WHAT • portType • An abstract interface definition • Consist of operation elements • Abstract method signature • message • Set of parameters referred to by method signatures • It is decomposed into part elements • type • The collection of all the data types used in the Web Service

  8. WSDL Elements (cont.) • HOW • binding • Details of how elements in abstract interface are to be converted into a concrete representation • Data formats • Network protocols • WHERE • port • How a binding is deployed at a particular network endpoint • service • A named collection of ports

  9. The portType Element <portType name="StockAvailableNotificationPortType"> <operation name="registration"> . . . </operation> <operation name="notification"> . . . </operation> <operation name="expirationNotification"> . . . </operation> <operation name="cancellation"> . . . </operation> </portType>

  10. The operation Element • Request-response style of operation • input, output and zero or more faults • Most common style • Maps nicely to HTTP <!--Registration Operation --> <operation name="registration"> <input message="StockAvailableRegistrationRequest"/> <output message="StockAvailableRegistrationResponse"/> <fault message="StockAvailableRegistrationError" name="StockAvailableNotificationErrorMessage"/> <fault message="StockAvailableExpirationError" name="StockAvailableExpirationError"/> </operation>

  11. The operation Element (cont.) • One-way style of operation • input message only • Useful to change state of service provider • HTTP response is an acknolegment of the message with no application level semantics <!--Cancellation Operation --> <operation name="cancellation"> <input message=" StockAvailableCancellation"/> </operation>

  12. The operation Element (cont.) • Notification style of operation • output message only • Asynchronous one-way push from service provider • Useful for notifying state information back to requestor <!--Expiration Notification Operation --> <operation name="expirationNotification"> <output message="StockAvailableExpirationNotification"/> </operation>

  13. The operation Element (cont.) • Solicit-response style of operation • output, input and zero or more faults • Initiated by service provider as in the notification style • Response is expected from service requestor <!— Solicit Requestor ID Operation --> <operation name=“getRequestorID"> <output message=“getRequestorIDSolicit"/> <input message=“getRequestorIDSolicitResponse"/> <fault name=“RequestorIDNotAvailableError” message=“RequestorIDNotAvailableErrorMessage”> </operation>

  14. The message and part Elements • A message • A named collection of parts • Can be used as input, output or fault within an operation • A part • A <name, type> tuple Types are a complexType or an element or complex types defined in the types element Use simple types directly <Message Name="Stockavailableregistrationerror"> <Part Name="Errorstring" Type="Xsd:String"/> </Message> <Message Name="Stockavailableregistrationresponse"> <Part Name="Correlationid" Type="Reg:Correlationid"/> </Message> <Message Name="Stockavailableregistrationrequest"> <Part Name="Registration" Element="Reg:Registrationrequest"/> <Part Name="Expiration" Type="Xsd:Timeinstant"/> </Message>

  15. From Java to WSDL … public class StockQuoteService { public float getQuote (String symbol) throws Exception { return com.ibm.wstk.util.Quote.getQuote( symbol ); } } <wsdl:message name="SymbolRequest"> <wsdl:part name="symbol" type="xsd:string"/> </wsdl:message> <wsdl:message name="QuoteResponse"> <wsdl:part name="quote" type="xsd:float"/> </wsdl:message> <wsdl:portType name="StockQuoteService"> <wsdl:operation name="getQuote"> <wsdl:input message="tns:SymbolRequest"/> <wsdl:output message="tns:QuoteResponse"/> </wsdl:operation> </wsdl:portType>

  16. The binding Element • How to format messages • How WSDL relates to SOAP headers, bodies, encoding, etc. • The binding element tells service requestor how to format messages in a protocol-specific manner • Each portType can have more than one binding associated

  17. RPC or document Unique name Put the “expiration” part of the message into the SOAP headerEncode data, i.e., serialize/deserialize Put the “registration” part of the message into the SOAP bodyDo not encode data, i.e., pass XML to/from application Use SOAP messaging The type attribute is used to identify portType SOAP/HTTP Set the soapAction HTTP header.Can be used as a routing hint The binding Element <binding name="StockAvailableNotificationSOAPBinding" type="StockAvailableNotificationPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="registration"> <soap:operation soapAction= http://www.skatesTown.com/StockAvailableNotification/registration/> <input> <soap:header message="StockAvailableRegistrationRequest" part="expiration" use="encoded“ namespace="http://www.skatestown.com/ns/registrationRequest“ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <soap:body parts="registration" use="literal" style="document"/> </input>

  18. The binding Element (cont.) <output> <soap:body use="encoded" namespace="http://www.skatestown.com/ns/registrationRequest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> <fault name="StockAvailableNotificationErrorMessage"> <soap:fault name="StockAvailableNotificationErrorMessage" namespace="http://www.skatestown.com/ns/registrationRequest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </fault> </operation> </binding>

  19. The service and port Elements • service • Container of port elements • port • Identify network address of endpoint <service name="StockAvailableNotificationService"> <port name="StockAvailableNotificationPort“ binding="StockAvailableNotificationSOAPBinding"> <soap:address location="http://www.xyz.com/axis/services/StockNotification"/> </port> </service>

  20. Using WSDL • Service client development • Input to proxy generator which produces client code • Service invocation • Input to dynamic invocation proxy which generates, at run time, correct service requests

  21. Service Provider X Web Service SOAP Engine SMTP Service Invocation Service Requestor Service Provider Y Application Web Service SOAP Engine SOAP Engine Network Protocol HTTP Network Protocol HTTP

  22. Service Invocation Service Provider X Service Requestor Service Provider Y Web Service Application Web Service SOAP Engine SOAP Engine SOAP Engine SMTP SMTP Network Protocol HTTP

  23. WSDL Summary • Elements to define abstract interface of a service • What a service does • Elements to specify concrete binding information • How a service is accessed • Where a service is located

  24. UDDI – Universal Description, Discovery and Integration • XML-based mechanism to build centralized registry of services • Facilitate service discovery both at design time and dynamically at runtime • UDDI is a: • Business Registry • Public online business/services registry • Available since 2001 • Consists of replicas hosted at UDDI Operators • Currently there are two: IBM and Microsoft • Operators should be indistinguishable • Set of APIs and data structures • Enable programmatically registration and inquiry of services

  25. The UDDI Data Structures • The businessEntity data structure • White pages • Name, address and contact information • Yellow pages • Classification information about the types and location of the services the entity offers • Green pages • Technical data, e.g., how to invoke the offered services • The tModel data structure • An abstract technology model that is used to represent the reusable definition of a service (the interface) • The bindingTemplate data structure • Holds the technical information for the service to actually be invoked

  26. The UDDI APIs • A set of Create, Read, Update and Delete (CRUD) operations

  27. UDDI Pointers • The UDDI initiative • http://www.uddi.org • IBM • http://www.ibm.com/services/uddi • Microsoft • http://uddi.microsoft.com

  28. The Web Services Landscape (partial) • The J2EE world • BEA – WebLogic Server • http://www.bea.com/products/weblogic/server • Iona – XMLBus • http://www.xmlbus.com/ • Macromedia – JRun • http://www.macromedia.com/software/jrun • Sun – Sun ONE Application Server • http://wwws.sun.com/software/products/appsrvr/home_appsrvr.html • IBM – WebSphere • http://www.ibm.com/websphere

  29. The Web Services Landscape (partial) • .NET • Microsoft’s platform for distributed computing • Common Language Runtime (CLR) • Similar to Java’s virtual machine • bytecode generated from C#, C++, Visual Basic, COBOL • Core classes • Similar to Java class library • ASP.NET • A programming framework built on CLR that can be used on a server to build Web applications • Equivalent to J2EE container ?

  30. The Web Services Landscape (partial) • Other languages and environments • SOAP::Lite • Perl interface to the SOAP. Both client and server • http://www.soaplite.com/ • SOAPPy • Python interface to the SOAP. Both client and server • http://sourceforge.net/projects/pywebsvcs • eSOAP • A C++ library that provides a SOAP engine for embeddeding systems • Available on • RTEMS, eCos, QNX • Microsoft Windows - NT/2000/98/ME • Linux • http://www.embedding.net/eSOAP

  31. The Apache eXtensible Interaction System (AXIS) • A very flexible SOAP engine from Apache • Open and pluggable architecture • Design to cope with various deployment configuration • From very simplistic to highly sophisticated configurations • The Java Web Services facility (JWS) • Drop-in development • Simplest and quickest way to deploy a Java-base Web Service • Rename source file from xxx.java to xxx.jws • Drop xxx.jws into JWS directory

  32. Axis Components • Axis Engine • Main entry point into message processing model • Coordinate message flow • Handlers • Message processing logic • Chains • Ordered collections of handlers (invoked sequentially) • Pre/post processing of messages is achieved by defining chains • Dispatcher (the pivot handler) • The bridge between Axis and the business logic (i.e., the Web Service) • The RPCDispatcher • SOAP body to/from Java objects • Location and Invocation of code

  33. Axis Components (cont.) • Transport Listeners • Deal protocol specific encapsulation • Responsible for Axis Engine instantiation • The AxisServlet • A transport listener for HTTP • Deployment/Configuration • Add/remove Web Services to Axis • Creation of service specific chains • Configuration of transport and global chains • Serializers/Deserializers • Convertion of native data types to/from XML

  34. Transport Request Chain Global Request Chain Request Handlers Transport Requestor TL Axis Engine Transport Requestor TL Transport Response Chain Global Response Chain Response Handlers Axis on the Server Web Service specific chain Dispatcher Web Service

  35. Axis on the Client Web Service specific request handlers Global Request Chain Transport Request Chain Axis Engine Transport Sender Transport Application Global Response Chain Transport Response Chain Web Service specific response handlers

  36. getQuote(“BMW”) BMW K 1200 RS Mileage: 8266 Year: 1999 Price: £6950 BMW R 1100 S   Mileage:10347Year: 1998 Price: £5750 BMW R 1100 S  Mileage : 7284Year: 1999 Price: £6250 BMW R 1100 S  Mileage: 9000Year: 2000 Price: £6350 Used Motorcycle dealer Stock Quotes Provider BMW (ISE:BMW)      Time: 7:11  Last Price:   1961.00     Change:    +18.00   Open:    1942.00  High:    1977.00 @ 5:41 ET Low:    1927.00 @ 3:16 ET Currency:  GBX  What is missing in the Web Services Model ?

  37. What is missing in the Web Services Model ? • Service description captures interface syntax • The service accepts an operation request with a particular signature • Service description does not capture semantics • The Open Grid Services Architecture • Operation should respond as expected • “As expected” is usually defined offline in specifications • Use names as basis for reasoning about semantics • Standardize common services and operations

  38. What is Next – The Open Grid Services Architecture • Standard interfaces and behaviors that address key distributed system issues: • Service description & information access • Notification • Policy management • Lifetime management • Service naming • Authentication • Reliable invocation • Transient stateful service instances

  39. The OGSA Framework

  40. Tools and Information • Suggested reading • Building Web Services with Java by Graham et.al., 2002, Sams Publishing • AXIS, Next Generation Java SOAP by Irani ant Basha, 2002, Wrox Press • Web Services Standards • http://www.w3.org/2002/ws/ • Apache’s AXIS • http://xml.apache.org/axis/ • IBM developerWorks : Web Services • http://www.ibm.com/developerworks/webservices • IBM developerWorks : WebSphere • http://www7b.software.ibm.com/wsdd/ • Other Web Services good sites • www.webservices.org • www.gotdotnet.com • The OGSA Working Group • http://www.gridforum.org/ogsa-wg/

  41. J2EE Technologies: Web Services II Benny Rochwerger Research Staff Member

More Related