Technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 24. November 2009.

Slides:



Advertisements
Similar presentations
CS Network Programming CS 3331 Fall CS 3331 Outline Socket programming Remote method invocation (RMI)
Advertisements

XPathAPI XPathAPI HOME : API : j/apidocs/ Lib.
J0 1 Marco Ronchetti - Web architectures – Laurea Specialistica in Informatica – Università di Trento Java XML parsing.
Using RMI–IIOP in the Development of Distributed Applications Dr. P.G.Sarang, President & ABCOM Information Systems Private. Limited.,
Communicating in J2EE.
19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services.
12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 12. November 2009.
Technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 22. Oktober 2009.
1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena.
Written by Liron Blecher
Chapter 2: Basic Standards for Web Services Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005.
Web Services Using SOAP, WSDL, and UDDI
Java Web Services.
Web Service Service Registry Service Requestor Service provider Publishfind Bind
1 Jini Tutorial, Part 3 Jini Programming. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2.
CSE 6331 © Leonidas Fegaras Web Services1 Web Services (adapted from Erdogan Dogdu's presentation) Leonidas Fegaras.
Recitation 4. 2-D arrays. Exceptions. Animal[] v= new Animal[3]; 2 declaration of array v v null Create array of 3 elements a6 Animal[] null Assign.
Eclipse Web Tools Platform Project © 2005 IBM Corporation Developing Web Services with Eclipse – Programming Examples Arthur Ryman IBM Rational
31242/32549 Advanced Internet Programming Advanced Java Programming
Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence.
Presentation 7 part 2: SOAP & WSDL.
Remote method invocation. Introduction First introduced in JDK 1.1. Allows distributed Java programs to work with each others by behaving as if they are.
1 Java Remote Method Invocation java.rmi.* java.rmi.registry.* java.rmi.server.*
General introduction to Web services and an implementation example
Simple Object Access Protocol (SOAP) v1.1 CS-328 Dick Steflik.
SOAP.
SOAP : Simple Object Access Protocol
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
XML in the real world (2) SOAP. What is SOAP? ► SOAP stands for Simple Object Access Protocol ► SOAP is a communication protocol ► SOAP is for communication.
Topics Acronyms in Action SOAP 6 November 2008 CIS 340.
Information Management NTU Web Services. Information Management NTU What Are Web Services? Semantically encapsulate discrete functionality Loosely coupled,
Web Services Nasrullah. Motivation about web service There are number of programms over the internet that need to communicate with other programms over.
SOAP Lee Jong-uk. Introduction What is SOAP? The features of SOAP The structure of SOAP SOAP exchange message model & message Examples of SOAP.
A1.1 Assignment 1 “Deploying a Simple Web Service”
SOAP, WSDL & introduction to UDDI
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy.
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
Slide 1 EE557: Server-Side Development Lecturer: David Molloy Room: XG19 Mondays 10am-1pm Notes:
JAX-RPC The Java API for XML Remote Procedure Calls Notes from The J2EE Tutorial 1.4 From Sun Microsystems.
WSDL Web Services Description Language Neet Wadhwani University of Colorado 3 rd October, 2001.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 9 Web Services.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
1 Java Programming II Java Network II (Distributed Objects in Java)
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
WSDL Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
Web Services (SOAP, WSDL, and UDDI)
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Current Trends in Network- Based Application Developments Bill Chu Department of Software and Information Systems UNC Charlotte.
1 WSDL Tutorial Heather Kreger (borrowed from Peter Brittenham) Web Services Architect IBM Emerging Technologies.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
WEB SERVICES 1 From Chapter 19 of Distributed Systems Concepts and Design,4 th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic.
J2EE Chris Hundersmarck Maria Baron Jeff Webb.  Java 2 Platform, Micro Edition (J2ME)  Java 2 Platform, Standard Edition (J2SE)  Java 2 Platform, Enterprise.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
SOAP, Web Service, WSDL Week 14 Web site:
Beginning 자바 웹 서비스 웹 서비스 호출 Meilan JIANG Cyber infrastructure Research Laboratory Department of Advanced Technology.
The Java API for XML-Based Web Services. A Web Service example in Java SOAP-awareServlet (e.g. Apache Axis2) SOAP-awareServlet Any class processing the.
Web Services-JAX-RPC JAX-RPC enables a Web Service endpoint to be developed using either a Java Servlet or Enterprise JavaBeans (EJB) component model.
Distributed System using Web Services
Distributed System using Web Services
Presentation transcript:

technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 24. November 2009

technische universität dortmund SOAP Example Request <SOAP-ENV:Envelope xmlns:SOAP-ENV="SoapEnvelopeURI" SOAP-ENV:encodingStyle="SoapEncodingURI"> SUNW Winter 2009/10 2

technische universität dortmund Winter 2009/10 3 Sample SOAP Request POST /Supplier HTTP/1.1 Host: Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI" AMF Night Hawk Pearl M2 Bowling Ball :09:56 header body Envelope

technische universität dortmund SOAP Response Format Winter 2009/10 4 HTTP/ OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn <SOAP-ENV:Envelope xmlns:SOAP-ENV=" SOAP- ENV:encodingStyle=" header body Envelope

technische universität dortmund WSDL components Winter 2009/10 5

technische universität dortmund Step 1: Write Java Application Winter 2009/10 6 public class StockQuoteService { DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder(); public float getQuote (String symbol) throws Exception { URL url = new URL (" InputStream is = url.openStream (); Document d = xdb.parse(is); Element e = d.getDocumentElement (); NodeList nl = e.getElementsByTagName ("price"); e = (Element) nl.item (0); String quoteStr = e.getAttribute ("value"); try { return Float.valueOf (quoteStr).floatValue (); } catch (NumberFormatException e1) { // mebbe its an int? try { return Integer.valueOf (quoteStr).intValue () * 1.0F; } catch (NumberFormatException e2) { return -1.0F; }

technische universität dortmund Generate WSDL (sqs.wsdl) Winter 2009/10 7 Stock Quote Service

technische universität dortmund Generate WSDL (sqs-interface.wsdl) 8 message portType

technische universität dortmund Generate WSDL (sqs-interface.wsdl) Winter 2009/10 9 Binding (SOAP)

technische universität dortmund UDDI and WSDL Winter 2009/10 10

technische universität dortmund Building a Web Service public class StockQuoteService { if ( symbol.equals("XXX") ) return( (float) ); URL url = new URL( " + "stockquote/getxmlquote.vep?s="+symbol ); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( url.toExternalForm() ); Element elem = doc.getDocumentElement(); NodeList list = elem.getElementsByTagName( "stock_quote"); if ( list != null && list.getLength() != 0 ) { elem = (Element) list.item(0); list = elem.getElementsByTagName( "price" ); elem = (Element) list.item(0); String quoteStr = elem.getAttribute("value"); try { return Float.valueOf(quoteStr).floatValue(); } catch (NumberFormatException e1) {//Exception handling} }

technische universität dortmund WSDL Definition Stock Quote Service Winter 2009/10 12

technische universität dortmund Service Endpoint Interface package helloservice; import java.rmi.Remote; import java.rmi.RemoteException; public interface HelloIF extends Remote { public String sayHello(String s) throws RemoteException; } Winter 2009/10 13 File: HelloIF.java

technische universität dortmund Service Endpoint Implementation package helloservice; public class HelloImpl implements HelloIF { public String message ="Hello"; public String sayHello(String s) { return message + s; } Winter 2009/10 14 File: HelloImpl.java

technische universität dortmund Static Web Service Client package staticstub; import javax.xml.rpc.Stub; public class HelloClient { private String endpointAddress; public static void main(String[] args) { System.out.println("Endpoint address = " + args[0]); try { Stub stub = createProxy(); stub._setProperty (javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, args[0]); HelloIF hello = (HelloIF)stub; System.out.println(hello.sayHello("Duke!")); } catch (Exception ex) { ex.printStackTrace(); } private static Stub createProxy() { // Note: MyHelloService_Impl is implementation-specific. return (Stub) (new MyHelloService_Impl().getHelloIFPort()); } 15 File: HelloClient.java

technische universität dortmund J2EE Application Client package appclient; import javax.xml.rpc.Stub; import javax.naming.*; public class HelloClient { private String endpointAddress; public static void main(String[] args) { System.out.println("Endpoint address = " + args[0]); try { Context ic = new InitialContext(); MyHelloService myHelloService = (MyHelloService) ic.lookup("java:comp/env/service/MyJAXRPCHello"); appclient.HelloIF helloPort = myHelloService.getHelloIFPort(); ((Stub)helloPort)._setProperty (Stub.ENDPOINT_ADDRESS_PROPERTY,args[0]); System.out.println(helloPort.sayHello("Jake!")); System.exit(0); } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } 16 File: HelloClient.java