Web Services with Java

This post will be a quick run down on coding Web Services with Java. This content can be found in David’s Malan’s cs259 class and feel free to watch lecture 11 for a better understand than I can provide.

Architecture of Web Services

  • The web services architecture is an evolution of existing technologies
  • ƒThe Internet enables hosts to communicate and information to be published and retrieved
  • ƒDistributed computing platforms allow programmatic components to communicate
  • ƒXML closes the barriers between platforms and technologies

What’s Remote Procedure Calls?

  • ƒ Two pieces of code (client and server) talk over the network, generally using TCP/IP sockets
  • ƒ The client need not be aware that it is not using a local class
  • ƒ Client-side stub implements the service interface and takes care of serializing/marshalling the arguments for transmission over the network. The stub makes the network call and hands the response back to the caller
  • ƒ The remote object (server) need not be aware that it is not called by a local class
  • ƒ Server-side skeleton handles deserializing/unmarshalling the arguments and calling the local class, sending back the result to the remote client

What’s SOAP?

  • SOAP (Simple Object Access Protocol) is used to serialize a remote procedure call (RPC) across the network
  • SOAP is a lightweight mechanism for exchanging structured and typed information between peers in a decentralized, distributed environment using XML
  • SOAP is an XML-based protocol that consists of three partsƒ
  1. An envelope that defines a framework for describing what is in a message and how to process it
  2. ƒA set of encoding rules for expressing instances of application-defined datatypes (i.e., how to serialize data structures)
  3. ƒA convention for representing remote procedure calls and responses
  • ƒ Has its roots in distributed computing technologies: DCOM, CORBA, &ƒ Java RM

SOAP Encoding Rules

  • The SOAP specification describes how to serialize application-specific data-types into and out of an XML representation
  • ƒXML Schema primitive types (int, byte, short, boolean, string, float, double, date, time, and URL) are sent as-is
  • ƒMore complicated objects (e.g., Java classes) must have a matching schema and a mechanism for serializing into/out of schema

What’s a SOAP Router?

  • ƒ Listens on the appropriate protocol
  • ƒ Receives SOAP request
  • ƒ Has a binding between service’s URN and implementing class
  • ƒ Calls appropriate class to handle request
  • ƒ Returns response to sender

What’s a WSDL (Web Services Description Language)?

  • Describes what a web service can do
  • ƒ where it resides
  • ƒ how to invoke it

ƒ WSDL is usually used with SOAP as a transport protocol, although it can work with other protocols as well.

Document Style of WSDL

  • ƒ Web service designers/users often think of the XML representation merely as the “wire format”
  • ƒ They want RPC-style invocation, with binding to programmatic objects on both sides via serialization
  • ƒ But sometimes, we want to just use WSDL/SOAP to send an XML document, without the RPC semantics
  • ƒ To do this, we specify <soap:binding style=”document”>in the WSDL file
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s