Download presentation
Presentation is loading. Please wait.
1
1 WS Technologies II API Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and Orchestration IMT- Institutions Markets Technologies - Alti Studi Lucca
2
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 2 Models and Languages for Coordination and Orchestration UDDI SOAP HELP!
3
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 3 Models and Languages for Coordination and Orchestration Contents WSDL Some Java tools
4
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 4 Models and Languages for Coordination and Orchestration API and Tools Quick overview of some helpful tools that you may want to use Skipping all technical details, we will see some reference sites main features of widespread tools few simple examples For up-to-date tools check periodically the web pages of W3C, Apache, IBM, Sun, Microsoft, …
5
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 5 Models and Languages for Coordination and Orchestration Java and XML Very often Web Services developers have to manipulate XML documents and archives manual editing is extremely complicated can easily lead to errors and inconsistencies even if supported by visual integrated environments For automating most frequent operations, Sun has developed and released a whole set of tools Java Web Services Developer Pack (v1.5) http://java.sun.com/webservices/downloads/webservicespack.html essentially: Java APIs for manipulating XML files
6
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 6 Models and Languages for Coordination and Orchestration Java API for XML Processing (JAXP) – Parser SAX Advantages Can be used to analyze efficiently XML documents of any dimension useful to build ad hoc data structures useful for extracting information fast processing Disadvantages sequential access to the document complex searches are hard to implement can be used just for reading the document
7
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 7 Models and Languages for Coordination and Orchestration Java API for XML Processing (JAXP) – Parser DOM Advantages builds a tree-like representation of the document useful to elaborate the data facilitate document modification random access Disadvantages bad memory usage
8
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 8 Models and Languages for Coordination and Orchestration Java API for XML Binding (JAXB) Provides a bi-directional method for binding XML documents and Java objects Starting from a DTD and a binding schema (suffix.xjs) coding establishing variable types and the mechanism for defining the classes generates a set of classes that can be used to read, write and modify valid XML document (w.r.t. the given DTD)
9
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 9 Models and Languages for Coordination and Orchestration JAXB Terminology Marshalling serialization of the Java object representing the XML document ex. can be used to write the document in the file system Unmarshalling builds a Java object starting from an XML source Validation can be used to check if an XML document conforms a DTD (represented as a JAXB object)
10
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 10 Models and Languages for Coordination and Orchestration Example JAXB I In its simplest form the XJS file has just the definition of the root element
11
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 11 Models and Languages for Coordination and Orchestration Example JAXB II The execution of jaxb-xjc originates two files Books.java contains the java.util.List of the instances of Book Book.java Both classes come equipped with methods for marshalling for unmarshalling for validation plus equals(), toString(), getX(), setX(), …
12
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 12 Models and Languages for Coordination and Orchestration Java API for XML Messaging (JAXM) JAXM provides a suitable abstraction for the SOAP messaging infrastructure only messages in SOAP format are supported no transport mechanism is imposed HTTP, SMTP, MOM (Message Oriented Middleware) provides the interfaces for the composition and analysis of SOAP messages supports synchronous and asynchronous communication DOES NOT attempt to define a more abstract level on top of SOAP for guaranteeing reliability or other properties DOES NOT provide high level functionalities for publication, discovery and use of services they are UDDI and WSDL concern (not SOAP ones)
13
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 13 Models and Languages for Coordination and Orchestration Java API for XML-based RPC (JAX-RPC) It is JAX-RPC, not JAX-SOAP API for RPC based on XML focuses on supporting RPC not just limited to SOAP implementation of RPC DOES NOT support all SOAP functionalities limited support for messaging define a standard Java mapping for SOAP (names and types conversion) does its best for hiding the XML coding
14
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 14 Models and Languages for Coordination and Orchestration Java and WSDL Manual editing of WSDL documents for your Java classes is probably a boring task that you may want to avoid I guess you would like some tools for automatic generation of WSDL documents (or at least semi-automatic) The good news is that you can move from Java to WSDL and back
15
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 15 Models and Languages for Coordination and Orchestration Java2WSDL Axis (http://ws.apache.org/axis/index.html) offers the possibility of generating the WSDL file in an automatic way starting from the Java class filehttp://ws.apache.org/axis/index.html Example /* HelloWorldWSDL.java */ package sams; public class HelloWorldWSDL { public String helloWorld() { return “Hello World!”; } abstract definition HelloWorldWSDL.wsdl implementation HelloWorldWSDL-impl.wsdl
16
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 16 Models and Languages for Coordination and Orchestration WSDL2Java On the other way round, for interacting with a Web Service as users, you must be able to read the corresponding WSDL document and produce the correct code (ex. in Java) again, manual processing would be tedious and time consuming Java2WSDL has a "sister" that can help us example: from HelloWorldWSDL.wsdl we get HelloWorldWSDLSoapBindingStub.java HelloWorldWSDLPortType.java Note that: HelloWorldWSDLPortType represents a remote object HelloWorldWSDLSoapBindingStub contains all implementation details that are necessary for the transfer of SOAP messages toward the server
17
Roberto Bruni @ IMT Lucca 16 March 2005 Institutions Markets Technologies IMT 17 Models and Languages for Coordination and Orchestration More Technologies UDDI4J http://www-124.ibm.com/developerworks/oss/uddi4j/ Java API for interacting with UDDI registries WSDL4J (WS Desciption Language for Java Toolkit) http://www-124.ibm.com/developerworks/projects/wsdl4j/ supports the creation, representation and manipulation of WSDL documents SAAJ (SOAP with Attachment API for Java) http://java.sun.com/xml/saaj/index.jsp component of JWSD Pack define a standard for sending XML documents with attachments from a Java platform to the Internet
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.