Joke Server example. with Java and Axis. Web services with Axis SOAP, WSDL, UDDI. Joke Metaservice Joke Server Joke Client.



Similar documents
API Guide. SilkCentral Test Manager

SilkCentral Test Manager 2009 SP1. API Help

T320 E-business technologies: foundations and practice

Distributed Embedded Systems

1. Open Source J2EE Enterprise Service Bus Investigation

Web Services Servizio Telematico Doganale

Cúram Web Services Guide

Web-Service Example. Service Oriented Architecture

Consuming, Providing & Publishing WS

Bindings for the Service Provisioning Markup Language (SPML) Version 1.0

Web-Programmierung (WPR)

WSDL Example (Interface) WSDL Example (Implementation) Universal Description, Discovery and Integration. UDDI Usage

MDM Server Web Services Reference Guide (Internal)

Introduction aux Services Web # $ $ "! # $ % & ' ()* + (, ), * ' % & ' -. / (00 * (00 ', 1' 000*

Web Services. Distributed Object Systems 11. Web Services, SOAP and NET. Web Applications. Web Services. Web services vs Distributed Objects

"! # $ % & ' ()* + (, ), * '. / (00 * " (00 ', 1' 000*

SOAP. SOAP SOAP d Apache/IBM Invocation générique : SOAP. Message XML SOAP. SOAP d Apache/IBM Invocation générique : SOAP

FUSE ESB. Getting Started with FUSE ESB. Version 4.1 April 2009

Implementing SQI via SOAP Web-Services

Brekeke PBX Web Service

an open source web service toolkit for Java Mark Volkmann Object Computing, Inc.

A Cross Platform Web Service Implementation Using SOAP

Grid Computing. Web Services. Explanation (2) Explanation. Grid Computing Fall 2006 Paul A. Farrell 9/12/2006

Apache CXF Web Service Development

Brekeke PBX Version 3 Web Service Developer s Guide Brekeke Software, Inc.

Web Services Development In a Java Environment

Tutorial 7 Unit Test and Web service deployment

Developing Web Services Applications

EFSOC Framework Overview and Infrastructure Services

Author: Gennaro Frazzingaro Universidad Rey Juan Carlos campus de Mostòles (Madrid) GIA Grupo de Inteligencia Artificial

Web Service Development Using CXF. - Praveen Kumar Jayaram

IMPLEMENTATION GUIDE. API Service. More Power to You. May For more information, please contact

Developing Web Services with Eclipse and Open Source. Claire Rogers Developer Resources and Partner Enablement, HP February, 2004

Introduction. Tom Dinkelaker, Ericsson Guido Salvaneschi, Mira Mezini, TUD

Technical Guideline TR ecard-api-framework Overview. Version draft

RPC over XML. Web services with Java. How to install it? Reference implementation. Setting the environment variables. Preparing the system

Preface... iv I. Introduction What is Spring Web Services? Introduction Runtime environment

T320 E-business technologies: foundations and practice

Service Oriented Architecture using JAVA

Building Web Services with Apache Axis2

Oracle Service Bus. User Guide 10g Release 3 Maintenance Pack 1 (10.3.1) June 2009

HOBOlink Web Services V2 Developer s Guide

Best Practices for Designing and Building the Services of an SOA

DMP ESB Stanlab Interface vejledning i anvendelse.

Onset Computer Corporation

WIRIS quizzes web services Getting started with PHP and Java

Creating Web Services in NetBeans

Web Services API Developer Guide

Building Web Services with XML Service Utility Library (XSUL)

Data Integration and Data Retrieval

SDK Web Services Developers Guide. SDL WorldServer 10.2

Web Services Metadata Exchange (WS- MetadataExchange)

XIII. Service Oriented Computing. Laurea Triennale in Informatica Corso di Ingegneria del Software I A.A. 2006/2007 Andrea Polini

Argos Web Service Interface Specification

Developing Web Services with Eclipse

Web services with WebSphere Studio: Build and test

Realizing Enterprise Integration Patterns in WebSphere

Tutorial IV: Unit Test

JAX-WS Developer's Guide

Java Access to Oracle CRM On Demand. By: Joerg Wallmueller Melbourne, Australia

Ibm. Web Services Conceptual Architecture (WSCA 1.0) May By Heather Kreger IBM Software Group

Module 13 Implementing Java EE Web Services with JAX-WS

How To Develop A Web Service In A Microsoft J2Ee (Java) 2.5 (Oracle) 2-Year Old (Orcient) 2Dj (Oracles) 2E (Orca) 2Gj (J

What is in a Distributed Object System? Distributed Object Systems 5 XML-RPC / SOAP. Examples. Problems. HTTP protocol. Evolution

Middleware and the Internet. Example: Shopping Service. What could be possible? Service Oriented Architecture

How To Run A Soap Message In Java (Soap) On A Microsoft Powerbook (Soapy) On Your Computer Or Microsoft.Net (Soaps) On An Ipad Or Ipad (So

Developing Java Web Services to Expose the WorkTrak RMI Server to the Web and XML-Based Clients

Creating Web Services Applications with IntelliJ IDEA

WS-JDBC. (Web Service - Java DataBase Connectivity) Remote database access made simple: 1.

Introduction to Web services for RPG developers

Web Services ( )

Implementing a Web Service Client using Java

The presentation explains how to create and access the web services using the user interface. WebServices.ppt. Page 1 of 14

What are Web Services? A BT Conferencing white paper

Middleware and the Internet

Overview of Web Services API

Cisco BTS Softswitch SOAP Adapter Interface Specification Programmer s Guide, Release 7.0

Consuming and Producing Web Services with Web Tools. Christopher M. Judd. President/Consultant Judd Solutions, LLC

A Web Service Gateway for SMS- based Services. Giuseppe Attardi, Daniele Picciaia, Antonio Zoglio Dipartimento di Informatica Università di Pisa

COMPUTACIÓN ORIENTADA A SERVICIOS (PRÁCTICA) Dr. Mauricio Arroqui EXA-UNICEN

Transcription:

Joke Server example SOAP and WSDL with Java and Axis Interactive web services, Course, Fall 2003 Henning Niss Joke Metaservice Joke Server Joke Client 3 meta service 2 IT University of Copenhagen client 4 5 1 server 6 Everything is XML over HTTP (REST). Henning Niss SOAP and WSDLwith Java and Axis p.2 Web services with Axis SOAP, WSDL, UDDI Today: How to invoke and deploy web services with Apache Axis. Axis is a SOAP engine with extensive support for WSDL. a framework for constructing SOAP processors (clients, servers, gateways, etc); support for WSDL; tools to generate Java classes from WSDL (and WSDL from Java); client lookup UDDI registry WSDL SOAP req SOAP resp register service SOAP&WSDL joke service server that plugs into Tomcat. Web: http://xml.apache.org/axis/. enning Niss SOAP and WSDLwith Java and Axis p.1 Henning Niss SOAP and WSDLwith Java and Axis p.3

A Simple Joke Server (1) A Simple Joke Client (1) interface JokeServer { void submit(string joke, String category); String[] lookup(string category); Example only: a client that uploads one joke to a joke server and immediate requests the jokes in the specified category. Need to know the WSDL-description of the server. String[] categories(); enning Niss SOAP and WSDLwith Java and Axis p.4 Henning Niss SOAP and WSDLwith Java and Axis p.6 A Simple Joke Server (2) public class JokeServerImpl implements JokeServer { Map jokes = new TreeMap(); // maps categories to lists of jokes public void submit(string joke, String category) { LinkedList catjokes = (LinkedList)jokes.get(category); if(catjokes==null) catjokes = new LinkedList(); catjokes.addlast(joke); jokes.put(category, catjokes); public String[] lookup(string category) { List catjokes = (List)jokes.get(category); String[] res = new String[catjokes.size()]; return catjokes.toarray(res); public String[] categories() { String[] res = new String[jokes.size()]; return jokes.keyset().toarray(res); Joke Server WSDL (1) <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions targetnamespace="urn:henningsjokeserver".../> <wsdl:types> <schema xmlns="http://www.w3.org/2001/xmlschema" targetnamespace="urn:henningsjokeserver"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/ <complextype name="arrayof_xsd_string"> <complexcontent> <restriction base="soapenc:array"> <attribute ref="soapenc:arraytype" wsdl:arraytype="xsd:string[]"/> </restriction> </complexcontent> </complextype> </schema> </wsdl:types> enning Niss SOAP and WSDLwith Java and Axis p.5 Henning Niss SOAP and WSDLwith Java and Axis p.7

Joke Server WSDL (2) <wsdl:message name="lookuprequest"> <wsdl:part name="category" type="xsd:string"/> <wsdl:message name="lookupresponse"> <wsdl:part name="lookupreturn" type="impl:arrayof_xsd_string"/> <wsdl:message name="submitrequest"> <wsdl:part name="joke" type="xsd:string"/> <wsdl:part name="category" type="xsd:string"/> <wsdl:message name="submitresponse" /> <wsdl:message name="categoriesrequest" /> <wsdl:message name="categoriesresponse"> <wsdl:part name="categoriesreturn" type="impl:arrayof_xsd_string"/> Joke Server WSDL (4) <wsdl:binding name="jokeserversoapbinding" type="impl:jokeserver"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="lookup"> <wsdlsoap:operation soapaction=""/> <wsdl:input name="lookuprequest"> <wsdlsoap:body use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/enc namespace="urn:henningsjokeserver"/> </wsdl:input> <wsdl:output name="lookupresponse"> <wsdlsoap:body use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/enc namespace="urn:henningsjokeserver"/> </wsdl:output> </wsdl:operation>... </wsdl:binding> enning Niss SOAP and WSDLwith Java and Axis p.8 Henning Niss SOAP and WSDLwith Java and Axis p.10 Joke Server WSDL (3) <wsdl:porttype name="jokeserver"> <wsdl:operation name="lookup" parameterorder="category"> <wsdl:input name="lookuprequest" message="impl:lookuprequest"/> <wsdl:output name="lookupresponse" message="impl:lookupresponse"/> </wsdl:operation>... </wsdl:porttype> Joke Server WSDL (5) <wsdl:service name="jokeserverservice"> <wsdl:port name="jokeserver" binding="impl:jokeserversoapbinding"> <wsdlsoap:address location="http://localhost:8180/axis/services/jokeserver"/ </wsdl:port> </wsdl:service> enning Niss SOAP and WSDLwith Java and Axis p.9 Henning Niss SOAP and WSDLwith Java and Axis p.11

A Simple Joke Client (2) A Simple Joke Server (3) How to get from the WSDL description to code? Tool support! The WSDL2Java tool generates stubs for invoking the service. java org.apache.axis.wsdl.wsdl2java jokeserver.wsdl Generated classes: JokeServer.java (interface) JokeServerService.java (service interface) JokeServerServiceLocator.java (locate service) JokeServerSoapBindingStub.java (stub for talking to service) Tool support to generate a WSDL description based on the server interface. The Java2WSDL tool generates the WSDL description automatically. java org.apache.axis.wsdl.java2wsdl -o jokeserver.wsdl -l "http://localhost:8180/axis/services/jokeserver" -i jokeserver.jokeserverimpl -n "urn:henningsjokeserv -p"jokeserver" "urn:henningsjokeserver" jokeserver.jokeserver enning Niss SOAP and WSDLwith Java and Axis p.12 Henning Niss SOAP and WSDLwith Java and Axis p.14 A Simple Joke Client (3) A Simple Joke Server (4) import HenningsJokeServer.*; public class JokeClient { static final String CATEGORY = "languages"; static final String JOKE = "If it wasn t for C, we d be using BASI, PASAL and OBOL."; public static void main(string[] args) { try { JokeServerService service = new JokeServerServiceLocator(); JokeServer jokes = service.getjokeserver(); jokes.submit(joke,category); String[] res = jokes.lookup(category); for(int i=0; i<res.length; i++) System.out.println(res[i]); catch (Exception e) { e.printstacktrace(); enning Niss SOAP and WSDLwith Java and Axis p.13 Generating (SOAP) skeletons using the WSDL2Java tool. java org.apache.axis.wsdl.wsdl2java -o. -s -S true -Nurn:HenningsJokeServer -d Application jokeserver Generated classes: JokeServer.java (interface) JokeServerService.java (service interface) JokeServerServiceLocator.java (service locator) JokeServerSoapBindingImpl.java (template) JokeServerSoapBindingSkeleton.java (SOAP skeleton) JokeServerSoapBindingStub.java (SOAP stub) Henning Niss SOAP and WSDLwith Java and Axis p.15

A Simple Joke Server (5) Deploying a web service is a matter of telling the Axis implementation about it. Invoking WSDL2Java in server-side mode also generates a deployment descriptor deploy.wsdd. java org.apache.axis.client.adminclient -p8180 deploy.wsdd We can see the services deployed: java org.apache.axis.client.adminclient -p8180 list enning Niss SOAP and WSDLwith Java and Axis p.16