Presentation is loading. Please wait.

Presentation is loading. Please wait.

General introduction to Web services and an implementation example

Similar presentations


Presentation on theme: "General introduction to Web services and an implementation example"— Presentation transcript:

1 General introduction to Web services and an implementation example
EuroFIR Web Services General introduction to Web services and an implementation example Karl Presser

2 Agenda History and background of Web services WS Components SOAP WSDL
UDDI REST and Mashups An example using Apache AXIS

3 History and Background
The original purpose of HTTP was to provide a way to publish and retrieve hypertext pages over the internet Browser Web Server CGI Middleware Application server user program DB

4 History and Background
Business to Business Security Internet Firewall Firewall Only port 80 Only port 80 Web Server Middleware Application server DB CGI User program Web Server Middleware Application server DB CGI User program Remote Procedure Call (RPC), CORBA or DCOM Already implemented Already implemented Not local Client stub Server stub directory

5 History and Background
The idea of Web Services use existing software systems use port 80/25 to get through all firewalls use a standard representation schema, e.g. xml make it platform independent make it programming language neutral construct it modularly for reuse make it secure, reliable, transactional and … Client Stub Wrapping system internet Wrapping system Stub Server

6 WS Components Service registry SOAP (simple object access protocol) as transport protocol WSDL (web service description language) UDDI (universal description and discovery protocol) find publish Service description Service requester Service provider bind Service description Service interface Service

7 SOAP SOAP as RPC mechanism Client call Stub, runtime service location
SOAP system HTTP support (web client) INTERNET Wrap doc in HTTP Post request Serialized XML Doc Server do() Stub, runtime adapters SOAP system HTTP support (web client) Wrap doc in HTTP Post request Serialized XML Doc

8 SOAP SOAP is … Envelope a message construct: A message format for communication using XML a processing model: Rules for SOAP message a extensibility model: How to extend basic massages with specific information a protocol binding framework: Allow different protocols like HTTP or SMTP a convention on how to turn a RPC all into a SOAP message und vise versa Language independent Header Header block Header Block Body Body element

9 WSDL Describes the interface of a Web service using XML schema
<element name =“food” type = tns:foodType”/> <complexType name=“foodType”> <all> <element name=“id” type=“int”/> <element name=“name” type=string”/> </complexType> <operation name="GetFood" pattern=“…"> <input messageLabel="GetMsg" element="tns:request"/> <output messageLabel="SuccessfulMsg" element="tns:food"/> </operation> <binding name="RESTfulInterfaceHttpBinding" interface="tns:RESTfulInterface" type=" …/> >endpoint adress= “…”…/> Describes the interface of a Web service using XML schema The types used in the service model The messages for communication The operations The mapping to transport protocols The location of the service provider

10 UDDI Originally, UDDI was build as an “Universal Business Registry” similar to a search engine like Google. It contains business information like the name of the company business service offered by the company bindingTemplate which are technical information of the service tModel which can be used for additional information e.g. conditions for using the Web service

11 WS Standards and Spec

12 REST and Mashups REST is a collection of network architecture principles. It is used to describe interfaces which transmit domain-specific data over HTTP without further detail about the messaging layer Application state and functionality are provided using resources Every resource is uniquely addressable REST is stateless -> no need to store information For processes where a lot of context information is needed, the REST-url is getting longer and longer Procedures: getUser() addUser() removeUser() updateUser() REST examples: userResource = new Resource(' userResource.delete()

13 REST and Mashups A Mashups is web application that combines data from more than one source into a new web service. An example is the Chicago Police Department which has a Mashup that integrates their department’s database of reported crimes with Google Maps.

14 Apache Axis Apache Axis is an implementation of the SOAP submission to W3C. It is a Java library that helps you to implement all tasks around SOAP and the installation on Apache AXIS is quite simple. The following example shows simplified the steps that are needed: 1. Take a java class (food_apple) and write your methods: public String food() {  String s = “apple”; return s; } public long time() {  return System.currentTimeMillis();

15 Apache Axis 2. Generate the WSDL file using Java2WSDL :
javac food_apple java org.apache.axis.wsdl.Java2WSDL –o food_apple.wsdl … food_apple 3. Generate the stub files using WSDL2Java: java org.apache.axis.wsdl.WSDL2Java … food_apple.wsdl As a result you find food_appleService.java, food_appleSoapBindingSkeleton.java, food_appleBindingImpl.java, food_apple.wsdd and food_apple.java which are used on the server side. food_appleServiceLocator.java, food_appleSoapBindingStub.java and food_apple.java which are used on the client side.

16 Apache Axis 4. Copy your method from step 1 into the file food_appleSoapBindingImpl.java 5. Compile all files javac *.java 6. Deploy the web service using AXIS AdminClient java org.apache.axis.client.AdminClient … deploy.wsdd 7. Write the client using food_appleServiceLocator l= new food_appleServiceLocator(); food_appleSoapBindingStub stub = l.getfood_apple(): System.out.println(stub.food()); System.out.println(stub.time());

17 Thanks for your attention


Download ppt "General introduction to Web services and an implementation example"

Similar presentations


Ads by Google