CS 157B: Database Management Systems II February 27 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.

Slides:



Advertisements
Similar presentations
WEB SERVICES. FIRST AND FOREMOST - LINKS Tomcat AXIS2 -
Advertisements

Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
General introduction to Web services and an implementation example
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
RPC Robert Grimm New York University Remote Procedure Calls.
Webservices using JAXB and JAX-WS Lalit Bhatt SpiderLogic
1 Service Oriented Architecture SOA. 2 Service Oriented Architecture (SOA) Definition  SOA is an architecture paradigm that is gaining recently a significant.
1 Introduction to XML. XML eXtensible implies that users define tag content Markup implies it is a coded document Language implies it is a metalanguage.
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
Understand Web Services
CS 571. Web services Web service: "a software system designed to support interoperable machine-to-machine interaction over a network“ – W3C In short,
6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 42 Web Services.
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
1 Web Services – Part II CS , Spring 2008/9.
Intro to Programming Java Web Services using the Java TM API for XMLWeb Services (JAX-WS) Bill Champlin UCCS / CS526 Spring ‘09.
CS 160: Software Engineering August 27 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
1 Java Server Programming zLecture 1 focuses on: yIntroduction to web services y Web Services using Axis y The bigger Picture: Introduction to J2EE y Java.
Web Services (tying it all together) and Introduction to Grid Services Concepts These slides are adapted from course material developed by Barry Wilkinson,
1 Lecture 21 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
SSC2: Web Services. Web Services Web Services offer interoperability using the web Web Services provide information on the operations they can perform.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
WSDL Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
CS 157B: Database Management Systems II May 8 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
COP 4991 Component Based Software Development Lecture #4 Java Web Services Onyeka Ezenwoye.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
Web Services An introduction for eWiSACWIS May 2008.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Google’s Web Service January 4, 2004 Shuying Wang.
1 WSDL Tutorial Heather Kreger (borrowed from Peter Brittenham) Web Services Architect IBM Emerging Technologies.
INT-5: Integrate over the Web with OpenEdge® Web Services
CS 157B: Database Management Systems II February 25 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
Web Services (SOAP) part 1 Eriq Muhammad Adams J |
XML and Web Services (II/2546)
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
SOAP-based Web Services Telerik Software Academy Software Quality Assurance.
CS 157B: Database Management Systems II February 18 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
Web Services from 10,000 feet Part I Tom Perkins NTPCUG CertSIG XML Web Services.
Intro to Web Services Dr. John P. Abraham UTPA. What are Web Services? Applications execute across multiple computers on a network.  The machine on which.
Creating Web Services Presented by Ashraf Memon Presented by Ashraf Memon.
1 Service Oriented Architecture SOA. 2 Service Oriented Architecture (SOA) Definition  SOA is an architecture paradigm that is gaining recently a significant.
.NET Mobile Application Development XML Web Services.
CS 157B: Database Management Systems II April 22 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
Beginning 자바 웹 서비스 웹 서비스 호출 Meilan JIANG Cyber infrastructure Research Laboratory Department of Advanced Technology.
Introduction to Web Services Srinath Vasireddy Support Professional Developer Support Microsoft Corporation.
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.
Software Architecture Patterns (3) Service Oriented & Web Oriented Architecture source: microsoft.
Java Distributed Computing
Web Programming Developing Web Applications including Servlets, and Web Services using NetBeans 6.5 with GlassFish.V3.
Chapter 5 Remote Procedure Call
WEB SERVICES.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Writing simple Java Web Services using Eclipse
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.
Java Distributed Computing
Service Oriented Architecture
CMPE 152: Compiler Design January 25 Class Meeting
Overview of Web Services
CMPE 152: Compiler Design August 21 Class Meeting
CMPE 152: Compiler Design January 24 Class Meeting
Distributed System using Web Services
Chapter 42 Web Services.
Service Oriented Architecture
Distributed System using Web Services
Presentation transcript:

CS 157B: Database Management Systems II February 27 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 2 Oral Presentations  Back by popular demand!  Next Monday, March 4. 4 teams from each section that didn’t present last time. First 4 teams to send me , or I will “volunteer” teams.  Short 15-minute presentations about your Project #2. What is your application? What XML data did you use? How did you do marshalling and unmarshalling? What XQuery queries did you do? PowerPoint slides OK.  Presenting teams can turn in your presentation slides in place of a project report. Presenting teams have until Monday to turn in your projects.

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 3 Review: Web Services  A web service is “a software system designed to support interoperable machine-to-machine interaction over a network”. The service is provided by a server machine (the web service provider). Client applications make service requests to the server and get back responses. A popular form of distributed computing.  There are many public web services available. Examples:   You can write a web service client program in Java to connect to a web service and consume its data.

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 4 Review: Web Services  A web service is described by a service contract written in the Web Services Description Language (WSDL). The WSDL document is an XML document. The WSDL document and the request and response messages are transmitted over HTTP. Messages use the Service Oriented Architecture Protocol (SOAP), an XML format.  Web services are programming language agnostic. The web service provider code can be written in any language. The web service requester (client) code can be written in any language. XML is the intermediary  WSDL document  SOAP messages Web services are a major application of the usefulness of XML.

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 5 Web Service Example: Time Server  A simple web service provider written in Java. Provide the current time as a string. Provide the elapsed Unix time in milliseconds as a long. The required JAXB and JAX-WS packages are part of standard Java 6 and beyond. _

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 6 Time Server Provider  Time service interface: package wsdemo.timeservice; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; import javax.jws.WebMethod; = Style.RPC) public interface TimeServer String long getTimeAsElapsed(); } Service Endpoint Interface (SEI). How to construct the WSDL document Service operations Adopted from Java Web Services: Up and Running by Martin Kalin O’Reilly, 2009

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 7 Time Server Provider  Time service implementation: package wsdemo.timeservice; import java.util.Date; import = "wsdemo.timeservice.TimeServer") public class TimeServerImpl implements TimeServer { public String getTimeAsString() { return String.format("The current server time is %s", new Date().toString()); } public long getTimeAsElapsed() { return new Date().getTime(); } Link this Service Implementation Bean (SIB) to the TimeServer SEI. Current time operation Elapsed time operation Adopted from Java Web Services: Up and Running by Martin Kalin O’Reilly, 2009

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 8 Time Server Publisher  Publish the time service: package wsdemo.timeservice; import javax.xml.ws.Endpoint; public class TimeServerPublisher { public static void main(String args[]) { TimeServer ts = new TimeServerImpl(); String url = String.format(" args[0]); System.out.printf("Publishing service %s to %s...\n", ts.getClass().getName(), url); // 1st argument is the publication URL // 2nd argument is an SIB instance Endpoint.publish(url, ts); } Pass in the server port number as a runtime argument. Run forever until terminated. Construct the service. Adopted from Java Web Services: Up and Running by Martin Kalin O’Reilly, 2009 ts is an arbitrary name. A web service is usually hosted by a web server running server software such as Apache Tomcat.

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 9 Time Service WSDL  Download the WSDL document (the service contract) at The portType is similar to a Java interface: It groups the operations provided by the web service. The service endpoint.

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 10 Time Service Client  The client program makes the time service requests: package wsdemo.timeservice; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; class TimeClient { public static void main(String args[]) throws MalformedURLException { URL url = new URL(String.format(" args[0])); QName qname = new QName(" "TimeServerImplService"); Service service = Service.create(url, qname); TimeServer eif = service.getPort(TimeServer.class); System.out.println(eif.getTimeAsString()); System.out.println(eif.getTimeAsElapsed()); } Pass in the server port number as a runtime argument. Create the qualified service name. Factory to get the service port (endpoint interface). Request services. Get the WSDL. Adopted from Java Web Services: Up and Running by Martin Kalin O’Reilly, 2009

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 11 Connecting to an Existing Web Service  More often, we want to connect to an existing web service in order to consume the data it provides. Connect to the web service via its URL. Download its WSDL service contract. Write the client application to consume and process the data.  The client application can be written in any language, such as Java.  You don’t know (nor should you care) what language the web service provider is written in.  If you write the client application in Java, there are tools that will help. _

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 12 The wsimport Utility Program  The Java utility program wsimport helps you to write a Java client program to connect to a web service. wsimport reads the WSDL service contract. wsimport generates Java source code that your client application can use.  It can also compile the generated source code and create a jar file.  Command line: -keep to keep the generated Java source files -s source-directory where to put the generated source files -d class-directory where to put the compiled files -p package for the generated source files wsdl-url to access the WSDL service contract Also: -verbose and –clientjar jarfile wsimport -keep -s java-directory -d class-directory -p package wsdl-url

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 13 NetBeans Support for Web Services  Tutorial:  NetBeans supports writing web service provider code and web service client code. For example, if you’re developing client code to access an existing web service, NetBeans calls wsimport for you. _ Demo

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 14 Example Public Web Services  Try googling: free web services open web services public web services  Currency conversion rate  Spell checker  Stock quotes  Weather reports Demo

Department of Computer Science Spring 2013: February 27 CS 157B: Database Management Systems II © R. Mak 15 Project #3  A web services mashup!  Create a new web service by combining data from two or more existing web services. Your new web service provider will itself be a client to each of the existing web services.  Deploy your web service. Use the sample “publisher” code.  Create a Java client to your mashup web service. It should have some meaningful output.  Watch the class website for the official write-up. _