1 / 17

WS Technologies I I API

Models and Languages for Coordination and Orchestration IMT- Institutions Markets Technologies - Alti Studi Lucca. WS Technologies I I API. Roberto Bruni Dipartimento di Informatica Università di Pisa. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP. SOAP.

alvin-wyatt
Download Presentation

WS Technologies I I API

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. Models and Languages for Coordination and Orchestration IMT- Institutions Markets Technologies - Alti Studi Lucca WS Technologies II API Roberto Bruni Dipartimento di Informatica Università di Pisa

  2. SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP SOAP UDDI UDDI UDDI UDDI UDDI UDDI UDDI UDDI UDDI UDDI UDDI HELP! Models and Languages for Coordination and Orchestration

  3. Contents • WSDL • Some Java tools Models and Languages for Coordination and Orchestration

  4. 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, … Models and Languages for Coordination and Orchestration

  5. 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 Models and Languages for Coordination and Orchestration

  6. 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 Models and Languages for Coordination and Orchestration

  7. 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 Models and Languages for Coordination and Orchestration

  8. Java API for XML Binding(JAXB) • Provides a bi-directional method for binding XML documents and Java objects • Starting from a • DTD • and a bindingschema (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) Models and Languages for Coordination and Orchestration

  9. 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) Models and Languages for Coordination and Orchestration

  10. In its simplest form the XJS file has just the definition of the root element <!-- books.xjs --> <?xml version="1.0" encoding="ISO-8859-1" ?> <xml-java-binding-schema version="1.0ea"> <element name="books" type="class" root="true" /> </xml-java-binding-schema> Example JAXB I <!-- books.dtd --> <!ELEMENT books (book*) > <!ELEMENT book (title, author, price) > <!ATTLIST book category CDATA #REQUIRED > <!ELEMENT title (#PCDATA) > <!ELEMENT author (#PCDATA) > <!ELEMENT price (#PCDATA) > Models and Languages for Coordination and Orchestration

  11. 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(), … Models and Languages for Coordination and Orchestration

  12. 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) Models and Languages for Coordination and Orchestration

  13. 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 Models and Languages for Coordination and Orchestration

  14. 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 Models and Languages for Coordination and Orchestration

  15. /* HelloWorldWSDL.java */ package sams; public class HelloWorldWSDL { public String helloWorld() { return “Hello World!”; } } • abstract definition • HelloWorldWSDL.wsdl • implementation • HelloWorldWSDL-impl.wsdl 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 file • Example Models and Languages for Coordination and Orchestration

  16. 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 Models and Languages for Coordination and Orchestration

  17. 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 Models and Languages for Coordination and Orchestration

More Related