SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

11
SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Transcript of SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Page 1: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

SOAP Web Services

Tim Carver

MRC HGMP-RCHinxton

Cambridge, UK.

Page 2: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Simple Object Access Protocol (SOAP)

• protocol for invoking methods on servers, services, components and objects

• uses XML messaging to exchange info via XML documents

• transport via HTTP (circumventing firewalls)

• provides mechanism for distributing objects over the Web

• make method calls upon classes and objects that exist on a remote server, without needing to know which language the objects are written in

Page 3: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Application Application

e.g. Jemboss Client e.g. Jemboss Serveron Win, MacOSX, Linux on Unix written in Java written in Java/C

SOAPXML messaging

Page 4: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

SOAP Messages

Header - optional- routing & delivery settings- authentication/authorisation information- transaction context

Body - required- data or message to be processed- can contain anything that can be expressed in XML- containing as many child nodes as required

Page 5: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

SOAP Messages

Header

Body

SOAP envelope

Page 6: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

HTTP POST - SOAP Request

HTTP RESPONSE - SOAP Response

HTTP HTTPServer Client

SOAP over HTTP

Page 7: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Creating Web Services in Java with Apache SOAP

Apache SOAP

• designed to run as a servlet within any Java HTTP server.• download either source only or precompiled version of SOAP. Server side installation

• need a separate web server that supports servlets (Tomcat) • add jar files or war files to the CLASSPATH of the server.

Client side installation

• soap.jar, mail.jar and activation.jar must be in the CLASSPATH.• also any java aware XML parser, e.g. xerces.jar

Page 8: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="JembossAuthServer"> <isd:provider type="java" scope="Request" methods="name version abouturl show_acd getWossname show_help show_db run_prog show_saved_results delete_saved_results list_saved_results call_ajax update_result_status"> <isd:java class="org.emboss.jemboss.server.JembossAuthServer" static="false"/> </isd:provider> <isd:faultListener> org.apache.soap.server.DOMFaultListener

</isd:faultListener></isd:service>

Deployed with Service Manager Client:java org.apache.soap.server.ServiceManagerClient \ http://hostname:port/soap/servlet/rpcrouter deploy service.xml

Deployment Descriptor

Page 9: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Deploying services with the SOAP Admin Tool

Page 10: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Axis

• next generation of Apache SOAP

• essentially Apache SOAP 3.0

• only Beta release (release 1.0 summer 2002)

http://xml.apache.org/axis/

Page 11: SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.

Web Service Description Language (WSDL)

• applications expose some type of functionality

• functionality can be invoked in different ways

• WSDL describes what the web service does and how it can be invoked

• toolkits available to generating WSDL automatically (e.g. Java2WSDL is an Apache Axis utility)