AS/SOAP Server

Download Report

Transcript AS/SOAP Server

Presentation:
SOAP/WS in a distributed object framework,
Application Servers & AXIS SOAP
Outline
• SOAP and Web Services in relation to Distributed
Objects
• The AXIS Project – Open Source Java SOAP Server
•
•
•
•
Introduction to the Apache Tomcat Application Server
Introduction to the AXIS Project
How to code a very simple example
How to install
SOAP & Web Services in relation to Distributed Objects
SOAP and Distributed Objects
• SOAP in it self has nothing to do with objects
• The trick is the supporting API’s converting objects to WSDL and
SOAP for serialization across the network
• Using the Proxy Pattern for decoupling
• We shall be looking at Microsofts .NET Web service technology
(using Microsoft Visual Studio .NET) at a later point, while we
now will focus on the open source community, targeting
specifically Java with the AXIS toolkit
Frameworks for Web Services &
The AXIS Project – Open Source Java SOAP Server
How to make a Web service with SOAP
•
You need an application or API capable of supporting:
• Communication over the Internet (HTTP)
• Security (SSL)
• XML Parsing capabilities
• Tools for WSDL handling / stub generation
• and more
•
Two examples of this:
• Apache Tomcat Application Server with AXIS
• Microsoft Internet Information Server with .NET
•
We will use them both – though starting with the Apache Tomcat
Application Server and the AXIS project – this will be introduced
here
• Other Web service frameworks:
• AXIS for C++, Metro (Java)
• Sun’s Java Web Services Developer Pack
(http://java.sun.com/webservices/index.jsp)
Apache Tomcat Application Server
• Apache Project
• Open source initiative
• Widely supported by Sun & IBM (but not Microsoft)
• Including a huge amount of free coding effort from both
• Apache Web Server
• The most used web server in the world (and its free!)
• The most secure, with SSL cap., and NT, Linux & UNIX
support
• Huge amount of ”plug-in” modules
• Apache Tomcat Application Server
• Capable of running JAVA applications
• JSP/Servlets (J2EE reference implementation)
• And projects embedded into this –
• The AXIS Project
• The former Apache SOAP Server
• Runs embedded in Tomcat / other J2EE
Apache Tomcat AS
• Works on:
• Windows, UNIX, LINUX, Mac
• Can be compiled to any platform (with some work)
• Can be found at:
• http://jakarta.apache.org/tomcat/index.html
• Server listening for events:
• HTTP on port 8080 (optional)
• Executes Servlets/JSP and JAVA applications
• AXIS is an embedded project within the Tomcat environment
Common code base!
SOAP Client
Java, C++, C#,
Delphi, VB
Application
SOAP over HTTP
Web Server
Apache /
MS IIS
AS/SOAP
Server
(Tomcat
with
AXIS)
JSP/
Servlet
Object
Web
Service
Object
AXIS Project
• Provides us with a suitable framework
• Runs embedded in Apache Tomcat – just download
• http://xml.apache.org/axis/
• But can run on ANY J2EE compliant Application Server
• BEA Weblogic, IBM WebSphere, Sun Java System
Application Server
• Supports full WSDL
• Supports SOAP communication via:
• HTTP, SMTP, FTP and open for extension
• Build in security, log, error and fault handling
• Tools for WSDL Stub & Skeleton creation:
• WSDL2Java &
• Java2WSDL
• Flexible deployment system
Developing applications with AXIS
How to get started
• As opposed to Java RMI and CORBA, we do not
necessarily have to start with the interface
• All we need is a Java class or interface, and the toolkit
will generate the WSDL interface for us
• We call this the JWS (Java Web Service) Instant
Deployment scenario
• This approach has some limitations however, as we
shall look into at a later point, but for now lets try this
out
JWS Deploying the Calculator
Lets assume we have an existing class we want deployed as
a Web service:
All deployment that needs to be done is to rename the java
source file, and copy it to the axis webapps root
And that’s it!
And so – we have a
Web service listening
Potential clients my
read the WSDL which is
auto-generated by axis
Building the dynamic client
First we must define
the end-point
Do we have all the
Arguments from the user?
Did the user choose
To subtract or add?
Building the dynamic client II
Convert to integer
Create a service
and a call
Set the end-point &
the operation name
Add the arguments &
set the return type
invoke the web service
Output the return value
Running the client
Running this:
Should result in this:
That was easy!
• Yes – but not beautiful
• Won’t this become very complex with non trivial Web
services?
• Problem when parameters are non-atomic types
• Handling of references?
• Where has the Access Transparency gone?
• What about Location Transparency?
Lessons to be learned
• We have actually made our own “client proxy stub”
• Can you make your own “client proxy stub” – so that
the client application becomes “access transparent”?
• In fact, we shall look closer at the toolkits abilities next
time and the more advanced features
• Also, the JWS Instant Deployment is only for simple
class structures, it will not be as easy otherwise
The AXIS Project – How to Install
How to Install
• We do not need the Apache Web Server
• As Tomcat has its own HTTP capabilities
• Start with Apache Tomcat Application Server
• http://jakarta.apache.org/tomcat/index.html
• Test installation is OK
• Then Install the AXIS Project
• http://xml.apache.org/axis/
• I have prepared a brief installation help document to
be found at the course web site
Tools to Use
• Please use Notepad and Command prompt for now!
• Later we will be using NetBeans
Other Java WS Toolkits
• Metro:
• Appears to be more mature then AXIS
• https://metro.dev.java.net/
• Interop test with WCF:
http://weblogs.java.net/blog/haroldcarr/archive/2008/03/
metro_web_servi_2.html