• No results found

Java Web Services Developer Pack. Copyright 2003 David A. Wilson. All rights reserved.

N/A
N/A
Protected

Academic year: 2021

Share "Java Web Services Developer Pack. Copyright 2003 David A. Wilson. All rights reserved."

Copied!
24
0
0

Loading.... (view fulltext now)

Full text

(1)

Java Web Services

Java Web Services

Developer Pack

Developer Pack

Copyright 2003 David A. Wilson. All rights reserved.

(2)

Objectives

Objectives

l Configure to use JWSDP

l Find the right sample program

– Many in JWSDP

– More in the Web Services Tutorial

l Find the appropriate documentation

(3)

Web Services Developer Pack

Web Services Developer Pack

l Java XML Pack:

– Java API for XML Messaging (JAXM)

– Soap with Attachments API for Java (SAAJ) – Java API for XML Processing (JAXP)

– Java API for XML Registries (JAXR)

– Java API for XML-based RPC (JAX-RPC)

l JSP Standard Tag Library (JSTL)

l Tomcat (Java servlet and JSP container) – Administration Tool

– Web Application Manager l Ant build tool

(4)

Java Web Services Tutorial

Java Web Services Tutorial

l Introduction

– Understanding XML – Getting Started With

Tomcat – Web Applications – JAXP – SAX – DOM – XSLT l Java APIs – JAX-RPC – JAXM l Web Technologies – Servlets – JSP l JavaBeans components l Custom Tags

l Standard Tag Library

– Security

l Case Study

– Coffee Break App

l Appendices

– Tomcat

– JAXM Provider Admin – xrpcc

(5)

Samples: JWSDP

Samples: JWSDP

l Most samples are

built and deployed using Ant.

(6)

Samples: Web Services Tutorial

Samples: Web Services Tutorial

l cb - Coffee Break

l gs - ConverterBean source

l GSApp - currency converter

l jaxm l jaxp l jaxr l jaxrpc l web – servlets, JSPs

(7)

Java WSDP Configuration

Java WSDP Configuration

l Download and unzip

– JDK 1.4.x – JWSDP

– Java Web Services Tutorial

l Add to front of PATH

– add bin directory of JWSDP – add bin directory of J2SE 1.4

l Create build.properties file in home

directory

username=your_user_name password=your_password

(8)

Tutorial Files

(9)

Start Tomcat

Start Tomcat

l cd <jwsdp_home>/bin l ./startup.sh or l startup.bat l Wait a minute

(10)

Compile Initial Samples

Compile Initial Samples

l cd <JWSDP_HOME>/docs/tutorial/examples/gs l ant build

l (make sure to start Tomcat) l ant install

(11)

http://

http://

localhost

localhost

:8080/index.html

:8080/index.html

l Try these

samples from this URL

(12)

Tomcat Server Administration

(13)

Ant

Ant

l from Apache Jakarta group

l Build tool for Java

– analogous to “make” make makefile Ant build.xml build.properties

(14)

Ant

Ant

l Actions triggered by XML tags

l Task - basic unit of work

– mkdir, javac, …

l Target - group of tasks

– ant deploy – ant run

– ant deploy run

l Project - group of targets

l Many built-in tasks

(15)

Ant Built-in Tasks

Ant Built-in Tasks

l Ant l AntCall l AntStructure l Apply/ l ExecOn l Available l Chmod l Condition l Copy l Copydir l Copyfile l Cvs l CVSPass l Delete l Deltree l Dependset l Ear l Echo l Exec l Fail l Filter l Fix l CRLF l GenKey l Get l GUnzip l GZip l Jar l Java l Javadoc l Javadoc2 l Mail l Mkdir l Move l Parallel l Patch l PathConvert l Property l Record l Rename l Replace l Rmic l Sequential l SignJar l Sleep l Sql l Style l Tar l Taskdef l Touch l TStamp l Typedef l Unjar l Untar l Unwar l Unzip l Uptodate l War

(16)

Example build.xml

Example build.xml

<!DOCTYPE project [

<!ENTITY commonTargets SYSTEM "../common/targets.xml"> ]>

<project name="JAX-RPC Tutorial" default="build" basedir=".">

<property file="${user.home}/build.properties"/> <property file="../common/build.properties"/> <property file="build.properties"/>

&commonTargets; <!-- The ant targets are in ../common/targets.xml -->

<target name="build" depends="build-service"

description="Executes the targets needed to build the service.">

(17)

targets.xml

targets.xml

(partial)

(partial)

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" /> <taskdef name="list" classname="org.apache.catalina.ant.ListTask" /> <taskdef name="start" classname="org.apache.catalina.ant.StartTask" /> <taskdef name="stop" classname="org.apache.catalina.ant.StopTask" /> <target name="deploy" description="Deploys a Web application">

<deploy url="${url}" username="${username}" password="${password}" path="/${context-path}" war="file:${war-path}"

/> </target>

<target name="compile-server" depends="prepare"

description="Compiles the server-side source code">

<echo message="Compiling the server-side source code...."/> <javac srcdir="." destdir="${build}/shared" includes="*.java" excludes="*Client.java" /> </target>

(18)

Grouping Targets

Grouping Targets

<target name="rebuild"

description="Compile and reload web application"> <antcall target="build" />

<antcall target="remove" /> <antcall target="install" /> </target>

(19)

Sample Program Components

Sample Program Components

l HelloIF.java - service definition interface l HelloImpl.java - service definition

implementation

l HelloClient.java - remote client

l config.xml - configuration file read by

wscompile tool

l jaxrpc-ri.xml - configuration file read by

wsdeploy tool

l web.xml - deployment descriptor for Web

component (a servlet) that dispatches to the service

(20)

Cloning a Sample Program

Cloning a Sample Program

l To make a new program, first copy the

existing directory, e.g., the “Hello” sample.

l build.properties

– change example, context-path, client-class

l config.xml

– change location, packageName

l jaxrpc-ri.xml

– change displayName, interface, implementation, urlPatttern

(21)

Building and Running

Building and Running

l cd sample_directory

l ant clean (delete old stuff)

l ant compile-server (compile server code) l ant setup-web-inf (package war file)

l ant package (package war file)

l ant process-war (generate WSDL file) l ant deploy (deploy service to Tomcat)

l verify at http://localhost:8080/goodbye-jaxrpc/goodbye

l ant generate-stubs (used by client) l ant compile-client (compile client) l ant jar-client (create client jar file)

(22)

Iterative Development

Iterative Development

l cd sample_directory

l ant build (service)

l ant redeploy (service) l ant build-static (client) l ant run (client)

(23)

Resources

Resources

l WSDP

– http://java.sun.com/webservices/webservices pack.html

l Java Web Services Tutorial

– http://java.sun.com/webservices/docs/1.0/tuto rial/index.html l White Papers – http://java.sun.com/webservices/white/ l Ant – <JWSDP_HOME>/docs/ant/manual/index.ht ml

(24)

White Papers

White Papers

l Web Services Made Easier: The Java

APIs & Architectures for XML

– This paper describes how the various Java TM APIs and Architectures for XML can be used to create Web services.

References

Related documents

from the kid- neys and livers of 13 rats, presented positivity in nine animals (69.2%): only one animal (7.7%) exhibited a pos- itive from both the kidney and liver cultures,

In this paper, we extended their studies by addressing a wider range of swarm-based optimization techniques for descriptor combination aiming at image classification: Artificial

Based upon the foregoing analysis, whether or not the persons whose names are forged on the closing documents are “customers” of the “warehouse line” bank will depend upon whether

AcademicAcademic-Clinic.com The achiever’s guide to academic life and beyond… Website: http://academic-clinic.com Facebook: http://www.facebook.com/academic.clinic

Samsung’s powerful Scan to E-mail solution lets you e-mail documents to anyone in the world directly from your network connected multi function printers. Samsung’s Scan

Gandhiji had once announced a prize for making improvement in charkha ( “24th July 1929, Akhila Bharatiya Charkhaa Sangh Workers' Samiti has decided to organise

All Velos data, All Epic data, All eIRB data, All Reporting, (NCI reporting) EDC: REDCap RFD Daily Export Studies, Subjects, Charges ETL Click eIRB Studies, Named

If any of SELLER’S Products fail to comply with the foregoing warranty, SELLER shall repair or replace free of charge to ORIGINAL USER, EX WORKS SELLER’S FACTORIES or other