Transcript SOAP

Web Services, SOAP
and Java
Derek Munneke
AJUG / ACS Java SIG
November 2001
What is a Web Service?
Web services are a new breed of Web application. They are selfcontained, self-describing, modular applications that can be
published, located, and invoked across the Web. Web services
perform functions, which can be anything from simple requests to
complicated business processes...Once a Web service is
deployed, other applications (and other Web services) can
discover and invoke the deployed service.
[ http://www6.software.ibm.com/developerworks/education/wsbasics/ ]
What is SOAP?

Simple Object Access Protocol
SOAP is a lightweight protocol for exchange of information in a
decentralized, distributed environment. It is an XML based protocol
that consists of three parts: an envelope that defines a framework for
describing what is in a message and how to process it, a set of
encoding rules for expressing instances of application-defined
datatypes, and a convention for representing remote procedure
calls and responses. SOAP can potentially be used in combination
with a variety of other protocols; however, the only bindings defined in
this document describe how to use SOAP in combination with HTTP
and HTTP Extension Framework.
[ http://www.w3.org/TR/SOAP/ (1.1)]
What is SOAP 1.2?

Simple Object Access Protocol
SOAP version 1.2 is a lightweight protocol for exchange of information in
a decentralized, distributed environment. It is an XML based
protocol that consists of four parts: an envelope that defines a
framework for describing what is in a message and how to process it,
a transport binding framework for exchanging messages using an
underlying protocol, a set of encoding rules for expressing instances
of application-defined data types and a convention for representing
remote procedure calls and responses. Part 1 (this document)
describes the SOAP envelope and SOAP transport binding
framework; Part 2[1]describes the SOAP encoding rules, the SOAP
RPC convention and a concrete HTTP binding specification.
[ http://www.w3.org/TR/soap12-part1/ (1.2 Working Draft)]
History of SOAP

SOAP 0 (1998)
–

XML-RPC (1998)
–

–

Subset of SOAP
ebXML (1999)
–

Microsoft, DevelopMentor
Electronic Business XML
Messaging for multiparty transactions
SOAP 1.0 & 1.1 (2000)
SOAP 1.2 (2001 working draft)
–
Messaging and RPC
SOAP Node




Sender
Receiver
Intermediaries
Actors (v1.1)
SOAP Message


Envelope
Header
–
–


actor attribute
mustUnderstand attribute
Body
Fault
–
Fault Code





VersionMismatch
MustUnderstand
DataEncodingUnknown
Client
Server
Example SOAP Message
<env:Envelope xmlns:env="http://www.w3.org/2001/09/soapenvelope">
<env:Header>
<n:alertcontrol
xmlns:n=http://example.org/alertcontrol>
<n:priority>1</n:priority>
<n:expires>2001-06-22T14:00:00-05:00</n:expires>
</n:alertcontrol>
</env:Header>
<env:Body>
<m:alert xmlns:m="http://example.org/alert">
<m:msg>Pick up Mary at school at 2pm</m:msg>
</m:alert>
</env:Body>
</env:Envelope>
Java and XML
XML makes data portable
 Java makes code portable

Java API’s for XML

JAXP : Java API for XML Processing
–
–


JAXB : Java API for XML Binding
JAXM : Java API for XML Messaging
–

SAX : Simple API for XML Processing
DOM : Document Object Model
SOAP 1.1
JAXR : Java API for XML Registries
References


To be supplied…
Presentation to be published:
http://www.ajug.org.au/sajug/meetings