Apache Axis2. Stubs & Skeletons With Axis2

Similar documents
Web Services Development In a Java Environment

ActiveVOS Server Architecture. March 2009

A-Team Tech Talk Series. SOA Unit Testing. Olivier LeDiouris, Oracle A-Team

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

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

rpafi/jl open source Apache Axis2 Web Services 2nd Edition using Apache Axis2 Deepal Jayasinghe Create secure, reliable, and easy-to-use web services

Chapter 1: Web Services Testing and soapui

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

Developing In Eclipse, with ADT

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

Sonatype CLM for Maven. Sonatype CLM for Maven

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

Builder User Guide. Version Visual Rules Suite - Builder. Bosch Software Innovations

Builder User Guide. Version 5.4. Visual Rules Suite - Builder. Bosch Software Innovations

Workshop for WebLogic introduces new tools in support of Java EE 5.0 standards. The support for Java EE5 includes the following technologies:

Consuming, Providing & Publishing WS

1 What Are Web Services?

Tutorial 5: Developing Java applications

1 What Are Web Services?

An Introduction to Globus Toolkit 3

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

Build management & Continuous integration. with Maven & Hudson

JAX-WS Developer's Guide

Sonatype CLM Enforcement Points - Continuous Integration (CI) Sonatype CLM Enforcement Points - Continuous Integration (CI)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Oracle WebLogic Server

Web-Service Example. Service Oriented Architecture

Introduction to Eclipse

Reusing Existing * Java EE Applications from Oracle SOA Suite

Developing Web Services with Apache CXF and Axis2

Open Source SCA The Apache Tuscany Project

PEtALS Quick Start. PEtALS Team Roland NAUDIN - February

Apache Karaf in real life ApacheCon NA 2014

Web Services Development for IBM WebSphere Application Server V7.0. Version: Demo. Page <<1/10>>

Building Web Services with XML Service Utility Library (XSUL)

WEB SERVICES. Revised 9/29/2015

Apache CXF Web Services

Onset Computer Corporation

HOBOlink Web Services V2 Developer s Guide

The Compatible One Application and Platform Service 1 (COAPS) API User Guide

Address Phone & Fax Internet

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

JBoss SOAP Web Services User Guide. Version: M5

TIBCO Silver Fabric Continuity User s Guide

CREATING AND DEPLOYING ABL WEB SERVICES

Implementing a Web Service Client using Java

Oracle Service Bus Examples and Tutorials

Building Web Services with Apache Axis2

Meister Going Beyond Maven

Java EE 7: Back-End Server Application Development

INSTALLING AND INVOKING ORACLE DATA INTEGRATOR (ODI) PUBLIC WEB SERVICES

European Access Point for Truck Parking Data

Integrating your Maven Build and Tomcat Deployment

Your customer engagement transformation starts here

FUSE-ESB4 An open-source OSGi based platform for EAI and SOA

OpenTOSCA Release v1.1. Contact: Documentation Version: March 11, 2014 Current version:

TIBCO ActiveMatrix BusinessWorks Error Codes. Software Release 5.7 December 2008

Operational Decision Manager Worklight Integration

Hudson configuration manual

Software project management. and. Maven

Android Setup Phase 2

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

Force.com Migration Tool Guide

Writing Grid Service Using GT3 Core. Dec, Abstract

XMLVend Protocol Message Validation Suite

Administering batch environments

Web Services Platform Guide

JVA-561. Developing SOAP Web Services in Java

JavaScript Applications for the Enterprise: From Empty Folders to Managed Deployments. George Bochenek Randy Jones

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

<Insert Picture Here> Introducing Hudson. Winston Prakash. Click to edit Master subtitle style

Developing Web Services Applications

Copyright 2013 Consona Corporation. All rights reserved

Integration eines SOA Repositories mit Subversion zur Anbindung an den ESB

Portal Factory CMIS Connector Module documentation

Hadoop Setup. 1 Cluster

Agile Web Service and REST Service Testing with soapui

Automating Testing and Configuration Data Migration in OTM/GTM Projects using Open Source Tools By Rakesh Raveendran Oracle Consulting

WIRIS quizzes web services Getting started with PHP and Java

TIBCO ActiveMatrix BPM Web Application Component Development. Software Release 2.0 November 2012

Java Web Services Training

soapui Product Comparison

Test Automation Integration with Test Management QAComplete

Archiver Eclipse/CSS Alarm

Enterprise Service Bus

Developing with Android Studio

Building OWASP ZAP Using Eclipse IDE

Getting Started with Amazon EC2 Management in Eclipse

TIBCO Spotfire Statistics Services Installation and Administration

ITS. Java WebService. ITS Data-Solutions Pvt Ltd BENEFITS OF ATTENDANCE:

Web Services Development using Top-down Design

Maven2 Reference. Invoking Maven General Syntax: Prints help debugging output, very useful to diagnose. Creating a new Project (jar) Example:

TIBCO Spotfire Statistics Services Installation and Administration. Release 5.5 May 2013

SDK Code Examples Version 2.4.2

Oracle Endeca Information Discovery Integrator

Transcription:

Apache Axis2 Stubs & Skeletons With Axis2

Agenda Introducing the Axis2 code generator Client Side-Stubs with Axis2 Default options Different data bindings Tweaks and options Server Side-Skeletons with Axis2 Default options Different data bindings More tweaks Exercises

Command Line Codegen Tool Two Formats wsdl2java java2wsdl Available in.bat and.sh formats in <Axis2_home>/bin directory wsdl2java - generate Java helper classes from WSDL java2wsdl generate a WSDL from a Java Class or Interface

Main tooling functions Stub Interface Or class java2wsdl <wsdl/> document wsdl2java Skeleton

Tooling in real life WSDL Axis2 client stub SOAP (at runtime) Enhance WSDL Axis2 server WSDL + (filled-in) Skeleton 1 WSDL2Java Java2WSDL (automatic) POJO 2 WSDL2Java WSDL

Where is the Code Generator? Command line version Available in the Axis2 standard distribution Accompanied with Batch and Shell scripts Eclipse plug-in IntelliJ IDEA plug-in Maven2 plug-in Ant task Details: http://ws.apache.org/axis2/tools/index.html Note: All the examples use the command line tool

Options for the Code Generator Long list of options! Complete reference at http://ws.apache.org/axis2/tools/1_4/codegentoolreference.html Also look at http://ws.apache.org/axis2/1_4/reference.html Important ones -uri WSDL file (required) -o output folder -d data binding framework -s sync interfaces o

Agenda Introducing the Axis2 code generator Client Side-Stubs with Axis2 Default options Different data bindings Tweaks Server Side-Skeletons with Axis2 Default options Different data bindings More tweaks

Stubs - Case 1 - Default Options Try the -uri option only wsdl2java -uri currencyconvert.wsdl Applied default options Output directory is the current directory Data binding is ADB Language is Java Both sync and async methods Client side code generation only

Stubs - Case 1 Cont... Generated Artifacts src directory Stub source file Contains both the sync and async methods Callback source file The call back class to be used when invoking the async methods build.xml Ant build file All data binding classes are generated as inner classes inside the stub

Stubs Case 1 - sync Method Returns the relevant response directly //instantiate the stub CurrencyConverterServiceStub stub = new CurrencyConverterServiceStub(); CurrencyConverterServiceStub.ConversionRequest request = new CurrencyConverterServiceStub.ConversionRequest(); //fill up the request object request.setamount(100f); request.setfromcurrency("usd"); request.settocurrency("slr"); //send and get the response CurrencyConverterServiceStub.ConversionResponse response = stub.convert(request);

Data binding How to go from Java objects to XML and back again Axis2 was designed to be flexible with respect to the Data Binding approach wsdl2java supports XMLBeans an Apache project ADB Axis Data Binding (built-in) JIBX http://jibx.sourceforge.net JAXBRI Java API for XML Binding Reference Implementation None A stub/skeleton with AXIOM-typed interface

Data binding compared XMLBeans has 100% schema coverage But generates many many classes! ADB does not support 100% schema coverage and hence has limitations. But the number of classes are significantly reduced improving performance. JiBX is a third party binding framework JAXB is the Java Standard

Stubs - Case2 - Switch Data Binding Use the -d option Other options are defaults Similar to case 1 wsdl2java -uri currencyconvert.wsdl -d xmlbeans

Stubs Case2 Cont... Generated Artifacts src directory Stub source file Contains both the sync and async methods Callback source file The call back class to be used when invoking the async methods XMLBeans specific data binding classes resources directory XMLBeans specific xsb files build.xml Ant build file

Stubs - Case 2 sync Method Method signatures are slightly different Uses XMLBeans classes now! CurrencyConverterServiceStub stub = new CurrencyConverterServiceStub(); ConversionRequestDocument requestdoc = ConversionRequestDocument.Factory.newInstance(); ConversionRequest request = requestdoc.addnewconversionrequest(); //fill up the request object request.setamount(100f); request.setfromcurrecncy("usd"); request.settocurrency("slr"); //call the method ConversionResponseDocument response = stub.convert(requestdoc);

Stubs Case 3 - Tweaks Switch on/off sync and async -a generates only async methods -s generates only sync methods Generate a test case -t generates a Junit test case Needs filling in before usage Read the todo's before running! Unpack ADB classes -u expands the generated data binding classes See next page

Unpacking Unpacked stubs have separate classes for the top-level types Works well for a real SOA application where the data types will be used across several different services Always used for server side Otherwise all the classes are inner types of the stub Gives a single class to use a service and works well for building a client to a single service

Stubs Case 3 Cont... Package name control Derives package names from the target namespace by default -p overrides the main package -ns2p helps to provide different packages to different namespac

Unwrapping Remember the discussion of wrapping in WSDL? -uw performs an unwrapping if your WSDL uses a wrapped style Instead of submit(porequest po) submit(string,string,int, double, )

Agenda Introducing the Axis2 code generator Client Side-Stubs with Axis2 Default options Different data bindings Tweaks and options Server Side-Skeletons with Axis2 Default options Different data bindings More tweaks

Skeletons Case 1 - Defaults Try the -uri option with -ss and -sd -ss stands for server side -sd stands for service descriptor Default options used are similar to stub case 1 wsdl2java -uri currencyconvert.wsdl -ss -sd

Skeletons Case 1 Cont... Generated Artifacts src directory Skeleton source file Message receiver source file ADB specific data binding classes resources directory WSDL file services.xml file build.xml Ant build fil

Skeletons Case 1 Cont... Just fill in the skeleton Example code: public class MyServiceSkeleton { public MyReturnObject myoperation(myreqobj param0) { // fill in code here return null; } }

Skeletons Case 1 Cont... Making the service archive Use the build script! Deploy the service archive Copy the archive to the services folder of the repository. Upload it using the web admin tool.

Skeletons - Case 2 - Switch Data Binding Use the -d xmlbeans switch Default options used are similar to case1 wsdl2java -uri currencyconvert.wsdl -ss sd -d xmlbeans

Skeletons Case 2 Cont... Generated Artifacts src directory Skeleton source file Message receiver source file XMLBeans specific data binding classes resources directory WSDL file services.xml file XMLBeans specific.xsb files build.xml Ant build file

Skeletons Case 3 - Tweaks -ssi generates an interface useful when multiple implementations are present -g generates both client and server code

Summary Axis2 offers a rich set of code generation options Stubs and skeletons Multiple data bindings Auto creation of WSDL, services.xml and Ant build file Also plug-in versions of the command line tools are available for several IDEs

Exercises In the beginner section of this training, we have used wsdl2java command both to generate server side and client side code. How about java2wsdl? Find the options that can be used with this command. Given the Java interface TemperatureConverter.java (see the resources section), Use java2wsdl to generate the WSDL file and then wsdl2java to generate client and server side code Complete both client and server, deploy the service and test