April 05 Prof. Ismael H. F. Santos - 1 Modulo II WebServices Prof. Ismael H F Santos.

Slides:



Advertisements
Similar presentations
Overview of Web Services
Advertisements

WEB SERVICES. FIRST AND FOREMOST - LINKS Tomcat AXIS2 -
An Introduction to Web Services Sriram Krishnan, Ph.D.
Web Services Martin Senger Abstract Web Services is a technology applicable for computationally distributed problems, including access.
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
Java Web Services Developer Pack v1.3 Zhongnan Shen 12/04/2003.
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.
G O B E Y O N D C O N V E N T I O N WORF: Developing DB2 UDB based Web Services on a Websphere Application Server Kris Van Thillo, ABIS Training & Consulting.
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.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 42 Web Services.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
Apache Axis: A Set of Java Tools for SOAP Web Services.
ΗΛΕΚΤΡΟΝΙΚΟ ΕΜΠΟΡΙΟ Web Services Overview Mary Grammatikou 9/06/2009.
And so on CGI programming Web Services Java Programs for the Web.
Java Web Services: A Conceptual Overview 1. Introduction Use Application Program Interfaces (APIs) platform – building embedded applications, desktop.
1 WS Technologies II API Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and Orchestration IMT- Institutions.
Intro to Apache Axis Siva Jagadeesan
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 CS 483 Enterprise and Web Application Programming Week 7 Web Services.
1 Lecture 21 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
WEB SERVICES Web Development Technology. 2 Contents How it’s work? –Definition –Simple Web Service Invocation –Web Service Description –SOAP –UDDI.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Web Services Mohamed Fahmy Dr. Sherif Aly Hussein.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
COP 4991 Component Based Software Development Lecture #4 Java Web Services Onyeka Ezenwoye.
Web Services 1 Oren Shamir Gal Moshitch. Web Services 2 Contents The World and the Problem Historical solutions Brief history of Web Services WS: The.
Message Driven Beans & Web Services INFORMATICS ENGINEERING – UNIVERSITY OF BRAWIJAYA Eriq Muhammad Adams J
Web Services Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development using JSP and Web Services JSP and Web Services 18 th March 2005.
WebService. Outline Overview of Web Services SOAP (messaging) WSDL (service description) UDDI (registry)
Web Services (SOAP) part 1 Eriq Muhammad Adams J |
XML and Web Services (II/2546)
SOA support in J2EE Platform overview Primitive SOA support Support for service-orientation principles Contemporary SOA support.
CS603 Communication Mechanisms: SOAP 25 January 2002.
What is a Web Service? Distributed Computing Model Distributed Computing Model  Loosely Coupled, Course Grained  Standard HTTP Transport  Sync/Async.
C# 1 Web services CSC 298. C# 2 Web services  A technology to make libraries available across the internet.  In Visual Studio,  can create a web service.
Java Web Services CSCI 4300 Diagrams from the Sun Java Web Services Tutorial,
WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic.
SOAP 2. SOAP Example POST /StockQuote HTTP/1.1 Host: Content-Type: text/xml; charset="utf-8"Content-Length: nnnn SOAPAction:"Some-URI"
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.
Soaplab SOAP-based Analysis Web Services Martin Senger
.NET Mobile Application Development XML Web Services.
Lecture VI: SOAP-based Web Service CS 4593 Cloud-Oriented Big Data and Software Engineering.
1 Web services for DIP LDIWG meeting C.H.Sicard 7 Jan 2003.
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.
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.
Soaplab - overview SOAP-based Analysis Web Services Martin Senger
Java Web Services Orca Knowledge Center – Web Service key concepts.
Soaplab - overview SOAP-based Analysis Web Services
An Introduction to Web Services
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.
Martin Senger Web Services Martin Senger
Web services, WSDL, SOAP and UDDI
Implementation of Web Services in Perl by Litis Abraham & Gomathy Sankara CS522 Fall 2001 Semester Project 11/28/2018 Web Services in Perl.
Introduction to Web Services
WebServices Using JAX-RPC
Introduction to Web Services
Distributed System using Web Services
Chapter 42 Web Services.
Distributed System using Web Services
Presentation transcript:

April 05 Prof. Ismael H. F. Santos - 1 Modulo II WebServices Prof. Ismael H F Santos

April 05 Prof. Ismael H. F. Santos - 2 Bibliografia

April 05 Prof. Ismael H. F. Santos - 3 Ementa WebServices em Java

April 05 Prof. Ismael H. F. Santos - 4 WebServices Java SOA

April 05 Prof. Ismael H. F. Santos - 5 WebServices com Java A plataforma J2EE oferece as seguintes APIs: Document-oriented Java API for XML Processing (JAXP) processes XML documents using various parsers Java Architecture for XML Binding (JAXB) processes XML documents using schema-derived JavaBeans component classes Procedure-oriented Java API for XML-based RPC (JAX-RPC) sends SOAP method calls to remote parties over the Internet and receives the results Java API for XML Messaging (JAXM) sends SOAP messages over the Internet in a standard way Java API for XML Registries (JAXR) provides a standard way toaccess business registries and share information

April 05 Prof. Ismael H. F. Santos - 6 WebServices com Java A tecnologia Java oferece tambem as seguintes ferramentas: Java Web Services Developer Pack (Java WSDP) SOAP with Attachments API for Java (SAAJ) Com estas APIs você não precisa saber como criar o SOAP. Você só precisa saber utilizar as classes da API para criar e acessar os Web Services.

April 05 Prof. Ismael H. F. Santos - 7 URI HTMLHTTP UDDI WSDLSOAP State of the Art

April 05 Prof. Ismael H. F. Santos - 8 Web Service : How They Work? Components required Software which needs to be exposed as a Web service A SOAP Server (Apache Axis, SOAP::Lite, etc.) HTTP Server (if HTTP is used as the transport level protocol) SOAP Client (Apache Axis, SOAP::Lite etc.) (http transport) Requestor SOAP Messages Web Service Provider Endpoint SOAP Client

April 05 Prof. Ismael H. F. Santos - 9 Remote Web Service Repository (Web Sites) Write Client Code Service Requestor Invoke Web Service Manual Web Service Lookup SOAP Request SOAP Response WSDL - Web Service Description SOAP - Web Service Message Protocol WSDL File Remote Web service Publish Web Service HTTP GET Simple Web Service Invocation

April 05 Prof. Ismael H. F. Santos - 10 From S. Chandrasekaran’s Talk Web Service Description Why describe Web services? A service requestor needs to analyze a service for his requirements A Web service needs to provide the following information the operations it supports the transport and messaging protocols on which it supports those operations the network endpoint of the Web service Languages such as WSDL, DAML-S, RDF can be used for describing Web services WSDL – describes the syntactic information of a service DAML-S and RDF – describe the syntactic as well as the semantic information

April 05 Prof. Ismael H. F. Santos - 11 Web Service Description (WSDL) Abstract Description Concrete Description

April 05 Prof. Ismael H. F. Santos - 12 WebService Example SOA

April 05 Prof. Ismael H. F. Santos - 13 A Web Service example in Java SOAP-awareServlet (e.g. Apache Axis) SOAP-awareServlet Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” Any class processing the incoming requests (“business logic” HTTP Server Servlet engine (e.g. Apache Tomcat) Sending requests, getting results

April 05 Prof. Ismael H. F. Santos - 14 Usual principles of Java toolkits Writing server is easier than writing clients (but only regarding the toolkit, not the business logic) Servers may be written independently on the used toolkit Always test interoperability with a non-Java client (because of data serialization and de-serialization) Steps: write your service implementation make all your classes available to the toolkit deploy your service (usually done just once) restart the whole servlet engine test it with a client request

April 05 Prof. Ismael H. F. Santos - 15 Java SOAP Toolkits Apache SOAP (was IBM’s SOAP4J) Apache Axis (a follow-on to the Apache SOAP) …and many others

April 05 Prof. Ismael H. F. Santos - 16 package hello; public interface HelloWorld { String getHelloMessage(); void setHelloMessage (String newHello); } hello/HelloWorld.java package hello; public class HelloWorldService implements HelloWorld { String message = "Hello, world!"; public String getHelloMessage() { return message; } public void setHelloMessage (String newMessage) { message = newMessage; } hello/HelloWorldService.java

April 05 Prof. Ismael H. F. Santos - 17 import org.apache.axis.client.*; public class HelloWorldClient { public static void main (String [] args) { try { // prepare the call (the same for all called methods) Call call = (Call) new Service().createCall(); call.setTargetEndpointAddress (new java.net.URL( " // call "get message" if (args.length == 0) { call.setOperationName ("getHelloMessage"); String result = (String)call.invoke( new Object[]{} ); System.out.println (result); System.exit (0); } HelloWorldClient.java

April 05 Prof. Ismael H. F. Santos - 18 // call "set message" and afterwards "get message" call.setMaintainSession (true); // TRY also without // this line... call.setOperationName ("setHelloMessage"); call.invoke ( new Object [] { args[0] } ); call.setOperationName ("getHelloMessage"); System.out.println (call.invoke ( new Object [] {} )); } catch (Exception e) { System.err.println ("ERROR:\n" + e.toString()); } HelloWorldClient.java

April 05 Prof. Ismael H. F. Santos - 19 Generated for HelloWorld HelloWorldServiceLocator implements HelloWorldService getHello() 1. Make an instance of this 3. Call methods on this proxy object HelloSoapBindingStub implements HelloWorld 2. Use it to make an instance of this

April 05 Prof. Ismael H. F. Santos - 20 public class HelloWorldClientFromStubs { public static void main (String [] args) { try { // prepare the calls (the same for all called methods) hello.generated.HelloWorldService service = new hello.generated.HelloWorldServiceLocator(); hello.generated.HelloWorld myHelloProxy = service.getHello(); // call "get message" if (args.length == 0) { String result = myHelloProxy.getHelloMessage() System.out.println (result); System.exit (0); } // call "set message" and afterwards "get message” myHelloProxy.setHelloMessage (args[0]); System.out.println (myHelloProxy.getHelloMessage()); } catch (Exception e) { System.err.println ("ERROR:\n" + e.toString()); } HelloWorldClientFromStubs.java

April 05 Prof. Ismael H. F. Santos - 21 Java XML Data Mapping How Java objects are converted to/from XML data (in order to be able to be put into SOAP messages) Important especially for the non-basic data types It’s easier if your non-basic data types are Java Beans (having set / get methods for members)

April 05 Prof. Ismael H. F. Santos - 22 Examples (Java Client) URL endpointURL = new URL(endpoint); Call call = new Call(); call.setSOAPTransport(m_httpconn); call.setTargetObjectURI("MessageService"); call.setMethodName("setMessage"); call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

April 05 Prof. Ismael H. F. Santos - 23 Examples (Java Client) Vector params = new Vector(); params.addElement( new Parameter("name", java.lang.String.class, name, null)); params.addElement( new Parameter("colour", java.lang.String.class, colour, null)); call.setParams(params); Response response = call.invoke(endpointURL, "");

April 05 Prof. Ismael H. F. Santos - 24 A Web Service example in Perl This is a module implementing the “business logic” package HelloPerl; use strict; use vars qw( $Message ); $Message = 'Hello, here is Perl.'; sub getHelloMessage { $Message; } sub setHelloMessage { $Message = shift; } 1; This is a cgi-bin script #!/usr/bin/perl -w -- Perl – use SOAP::Transport::HTTP; SOAP::Transport:: -> dispatch_to('HelloPerl') -> handle; #!/usr/bin/perl –w use SOAP::Lite on_fault => sub {…}; print SOAP::Lite -> uri ('HelloPerl') -> proxy (' -> getHelloMessage -> result; This is a client

April 05 Prof. Ismael H. F. Santos - 25 SOAP::Lite a collection of (many) modules but they are loaded automatically when needed supports SOAP 1.1 specification all methods can be used for both setting and retrieving values: if you provide no parameters, you will get current value, and if parameters are provided, a new value will be assigned to the object and the method in question will return the current object (if not stated otherwise) which is is suitable for stacking these calls like: $lite = SOAP::Lite -> uri(’openBQS') -> proxy('

April 05 Prof. Ismael H. F. Santos - 26 Using “wsdl” - directly #!/usr/bin/perl -w use SOAP::Lite on_fault => sub {…}; print SOAP::Lite -> service ('file:/home/senger/ws-ws/perl/Hello.wsdl') -> setHelloMessage (123); getting “.wsdl” file by using its URL then, you do not need to worry about autotyping #!/usr/bin/perl -w use SOAP::Lite on_fault => sub {…}; my $service = SOAP::Lite -> service ('file:./Hello.wsdl'); $service->setHelloMessage ($ARGV[0] or "Hello!!!"); print $service->getHelloMessage, "\n";