1 / 22

Java API for XML Remote Procedure call JAX-RPC

Java API for XML Remote Procedure call JAX-RPC. Dr. Rebhi S. Baraka rbaraka@iugaza.edu Advanced Topics in Information Technology (SICT 4310) Department of Computer Science Faculty of Information Technology The Islamic University of Gaza. Outline. JAX-RPC Overview JAX-RPC Service Model

Download Presentation

Java API for XML Remote Procedure call JAX-RPC

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. Java API for XML Remote Procedure callJAX-RPC Dr. Rebhi S. Baraka rbaraka@iugaza.edu Advanced Topics in Information Technology (SICT 4310) Department of Computer Science Faculty of Information Technology The Islamic University of Gaza

  2. Outline • JAX-RPC Overview • JAX-RPC Service Model • Data Types and Serialization • JAX-RPC and J2EE

  3. JAX-RPC Overview • Java API for XML-based RPC (JAX-RPC) is intended to be a Java API to expose remote procedure calls that use XML to applications. • synchronous API • It essentially enables clients to work with remote procedures that reside on different machines just as if the procedures were executed locally. • a client calls a procedure, with the name of the procedure and the arguments; the server does something useful and sends the results back to the client. • JAX-RPC facilitates the invocation of remote procedures, using XML as the data format and SOAP as the data protocol.

  4. JAX-RPC Service Model

  5. JAX-RPC Service Model • The layers correspond to the Open System Interconnection (OSI) networking model, which has these characteristics: • The physical layer conveys the bit stream through the network. • The data link layer encodes and decodes data packets into bits. • The network layer provides switching, routing, packet sequencing, addressing, and forwarding between virtual circuits, to transmit data from node to node. • The transport layer provides transparent transfer of data between hosts and is responsible for end-to-end error recovery and flow control. Clearly, the HTTP binding for SOAP lacks some of this, whereas other bindings, such as POP-SMTP, IMAP, and JMS do not.

  6. JAX-RPC Service Model • The session layer establishes, coordinates, and terminates connections, exchanges, and dialogs between the applications. • The presentation layer, also known as the syntax layer, provides independence from differences in data representation by translating from application to network format, and vice versa. The presentation layer works to transform data into the form the application layer can accept. • The application layer is the actual application and end-user processes, where business functionality is addressed. • the API hides this complexity of protocols from the application developer.

  7. Data Types and Serialization four things are required between communication parties in different address spaces: • An agreement on the data format • An agreement on the mechanism for transforming and reconstructing object state into this format • An agreement on the protocol for communication between objects • An agreement on the transport protocol

  8. Data Types and Serialization • JAX-RPC defines • The data type mapping of Java-XML and XML-Java for making the remote service invocation possible • Java-WSDL and WSDL-Java for making the service description possible • Client and server are not necessarily JAX-RPC

  9. JAX-RPC client-server interaction

  10. Data Types and Serialization • From an RPC perspective, if the client and service are written in Java, the runtime needs to know the following information: • The endpoint of the service—that is, where to invoke the service • The method name and signature—that is, what to invoke • How to marshal Java data types and objects into an XML format that can be transmitted over the wire to invoke the method • How to unmarshal the incoming XML into Java data types and objects to process the results of that operation, if any

  11. Java-to-XML Marshalling • In JAX-RPC, marshalling is different from the standard Java serialization mechanism, where all nontransient fields in the class are automatically serialized. • JAX-RPC defines a standard set of Java types as method arguments and return types, meaning that a JAX-RPC See table 10.2 in out text book

  12. XML-to-Java Unmarshalling • To invoke a procedure on an object with incoming XML data, an implementation must map XML data types into Java data types. • See table 10.3a in out text book

  13. SOAP Bindings and Encoding • Encoding refers to how data is serialized and sent over the wire. • A messages can be: • encoded message if it based on a predefined encoding scheme. • literal message if it uses an XML schema directly. • Representations styles • RPC style • Document style • Combinations • RPC/encoded • RPC/literal • Document/encoded • Document/literal See SOAP and WSDL lectures Q) When to Use RPC/Encoded and Document/Literal? A) See Section 10.2 in out textbook

  14. JAX-RPC Development • Service definition • Service implementation • Service deployment • Service description • Service consumption

  15. 1. Service Definition • The term service definition is used to refer to the abstraction that defines the publicly surfaced view of the service. • The service definition is represented as a Java interface that exposes the service's operations. • The service definition is also called a remote interface, • because it must extend the java.rmi.Remote interface, and • because all methods in it must throw a java.rmi.RemoteException.

  16. 2. Service Implementation • The service implementation, also known as a servant, is the concrete representation of the abstract service definition. • It is a class that provides the implementation or the service definition.

  17. 3. Service Deployment • a service is deployed in a JAX-RPC runtime. • A serviceendpoint is the perimeter where the SOAP message is received and the response dispatched.

  18. 4. Service Description • The JAX-RPC comes with the xrpcc (XML-based RPC Compiler) tool, which reads a tool-specific XML configuration file and generates the client- or server-side bindings shown in the figure. Java-WSDL Mappings?

  19. 5. Service Consumption • Invocation modes fall into three broad categories: • Synchronous request-response. The client invokes a remote procedure and blocks until a response or an exception is received from the service. • One-way RPC. The client invokes a remote procedure but does not block or wait to receive a return and is free to do other work. In fact the client does not receive any return parameters. • Nonblocking RPC invocation. The client invokes a remote procedure and continues processing without waiting for a return. The client may process the return later by polling some service or by using some other notification mechanism.

  20. Java API for XML-Based Web Services (JAX-WS) • The JAX-WS 2.0 specification extends the existing JAX-RPC 1.0 specification with new features. • An important part of the Java EE 5 platform. • simplifies the task of developing web services using Java technology. • It addresses some of the issues in JAX-RPC 1.1 by providing support for multiple protocols such as SOAP 1.1, SOAP 1.2, XML, and by providing a facility for supporting additional protocols along with HTTP. • JAX-WS uses JAXB 2.0 for data binding and supports customizations to control generated service endpoint interfaces. • With its support for annotations, JAX-WS simplifies web service development and reduces the size of runtime JAR files.

  21. JAX-WS RI Major Modules and Libraries

  22. References • Our text book. • Java Web Services Tutorial 2.0 End of the Slides

More Related