AS/SOAP Server

Download Report

Transcript AS/SOAP Server

Presentation:
SOAP 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
Slide 2 af 20
Ingeniørhøjskolen i Århus
SOAP & Web Services in relation to
Distributed Objects
SOAP and Distributed Objects
• SOAP in it self has nothing to do with objects
• There probably is SOAP API’s for C and COBOL
– actually this also holds true for CORBA – king of OO-middleware
• 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
Slide 4 af 20
Ingeniørhøjskolen i Århus
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++
• Sun’s Java Web Services Developer Pack
(http://java.sun.com/webservices/index.jsp)
Slide 6 af 20
Ingeniørhøjskolen i Århus
Apache Tomcat Application Server
• Apache Project is an open source initiative – widely
supported by Sun & IBM (but not Microsoft)
– Including a huge amount of free coding effort from both
• It consist of a long range of projects including:
– 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
One of these being the Apache Tomcat AS
– 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
Slide 7 af 20
Ingeniørhøjskolen i Århus
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
Slide 8 af 20
AS/SOAP
Server
(Tomcat
with
AXIS)
JSP/
Servlet
Object
Web
Service
Object
Ingeniørhøjskolen i Århus
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 (some are still “under
construction”)
• Tools for WSDL Stub & Skeleton creation:
– WSDL2Java &
– Java2WSDL
• Flexible deployment system
Slide 9 af 20
Ingeniørhøjskolen i Århus
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
Slide 11 af 20
Ingeniørhøjskolen i Århus
JWS Deploying the Calculator class
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
Slide 12 af 20
Ingeniørhøjskolen i Århus
And that’s it!
Potential clients my
read the WSDL which is
auto-generated by axis
And so – we have a
Web service listening
Slide 13 af 20
Ingeniørhøjskolen i Århus
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?
Slide 14 af 20
Ingeniørhøjskolen i Århus
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
Slide 15 af 20
Ingeniørhøjskolen i Århus
Running the client
Running this:
Should result in this:
Slide 16 af 20
Ingeniørhøjskolen i Århus
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?
Slide 17 af 20
Ingeniørhøjskolen i Århus
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
Slide 18 af 20
Ingeniørhøjskolen i Århus
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
Slide 20 af 20
Ingeniørhøjskolen i Århus