From 3e301e0d9761622593b1f4239b581d2ea2ffb038 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 27 Jun 2007 11:02:42 +0200 Subject: [PATCH] Add support for using SimpleAxisServer for generating WSDL files It also makes the dependency tracking more elaborate. --- .gitignore | 1 + Makefile | 98 ++++++++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 65 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 378eac2..7a066a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build +server-config.wsdd diff --git a/Makefile b/Makefile index 62a0537..1a569cc 100644 --- a/Makefile +++ b/Makefile @@ -33,39 +33,62 @@ ADMINHOST = amigos30.diku.dk ADMINUSER = admin ADMINPASS = secret +## Configuration for running the SimpleAxisServer +# +# This server is used for locally generating the WSDL files from the +# server package. + +AXISHOST = localhost +AXISPORT = 8080 + +AXISLOCATION = http://$(AXISHOST):$(AXISPORT)/axis/services + ################################################################################ # Build section ################################################################################ JAVAC = javac JAVA = java +JAR = jar SCP = scp LIBDIR = lib BUILDDIR = build SERVERSRCDIR = src +JARDIR = $(BUILDDIR)/lib CLIENTSRCDIR = $(BUILDDIR)/src SERVERBINDIR = $(BUILDDIR)/server CLIENTBINDIR = $(BUILDDIR)/client WSDLDIR = $(BUILDDIR)/wsdl +AXIS_PATH = $(BUILDDIR)/axis -CLASSPATH = $(shell find $(PWD)/$(LIBDIR) -name "*.jar" | tr '\n' ':')$(PWD)/$(SERVERBINDIR) +CLASSPATH = $(shell find $(PWD)/$(LIBDIR) -name "*.jar" | tr '\n' ':')$(PWD)/$(SERVERJAR) COMPILE = $(JAVAC) JAVA2WSDL = $(JAVA) org.apache.axis.wsdl.Java2WSDL WSDL2JAVA = $(JAVA) org.apache.axis.wsdl.WSDL2Java ADMINCLIENT = $(JAVA) org.apache.axis.client.AdminClient +AXISSERVER = $(JAVA) org.apache.axis.transport.http.SimpleAxisServer + +SERVERSRC = $(shell find $(SERVERSRCDIR) -name "*.java") +SERVERJAR = $(JARDIR)/remote-ws-server.jar -SERVERSRCFILES = $(shell find $(SERVERSRCDIR) -name "*.java") WSDDFILES = $(shell find wsdd -name "*.wsdd") -WSDLFILES = $(addprefix build/,$(subst wsdd,wsdl,$(WSDDFILES))) +SERVICES = $(patsubst wsdd/%.wsdd,%,$(WSDDFILES)) + +WSDLFILES = $(patsubst %,$(WSDLDIR)/%.wsdl,$(SERVICES)) +CLIENTSRC = $(patsubst %,$(CLIENTSRCDIR)/%-stamp,$(SERVICES)) +CLIENTJAR = $(JARDIR)/remote-ws-client.jar + +AXISLOG = $(AXIS_PATH)/log export CLASSPATH +export AXIS_PATH all: client clean: - $(RM) -r $(BUILDDIR) + $(RM) -r $(BUILDDIR) server-config.wsdd ## Rules for building the server and client class files # @@ -73,37 +96,35 @@ clean: # server Java classes. The client Java classes is then generated from # the WSDL files. -server: - @mkdir -p $(SERVERBINDIR) - $(COMPILE) -d $(SERVERBINDIR) $(SERVERSRCFILES) - -wsdl: server - @mkdir -p $(WSDLDIR) - for i in $(WSDDFILES); do \ - port=`sed -n 's/.*className.*value="[^.]*\.\(.*\)".*/\1/p' < $$i`; \ - service=`sed -n 's/.*className.*value="\([^.]*\)\..*".*/\1/p' < $$i`; \ - $(JAVA2WSDL) \ - -l $(SERVICELOCATION)/$$service \ - -o $(WSDLDIR)/$$service.wsdl \ - -n "urn:$$port" \ - -p"$$service.$$port" \ - "urn:diku.distlab.remote.$$service.$$port" \ - "$$service.$$port"; \ - done - -client-src: wsdl - @mkdir -p $(CLIENTSRCDIR) - for i in $(WSDLFILES); do \ - service=`echo $$i | sed 's/.*\/\([^\/]*\).wsdl/\1/'`; \ - $(WSDL2JAVA) \ - -o $(CLIENTSRCDIR) \ - -pdiku.distlab.remote.$$service \ - $(WSDLDIR)/$$service.wsdl; \ - done - -client: client-src - @mkdir -p $(CLIENTBINDIR) +wsdl: $(WSDLFILES) simpleaxisserver-stop +client-src: $(CLIENTSRC) simpleaxisserver-stop +client: $(CLIENTJAR) simpleaxisserver-stop +server: $(SERVERJAR) + +$(SERVERJAR): $(SERVERSRC) + @mkdir -p $(SERVERBINDIR) $(JARDIR) + $(COMPILE) -d $(SERVERBINDIR) $(SERVERSRC) + $(JAR) cf $@ -C $(SERVERBINDIR) . + @$(RM) -r $(SERVERBINDIR) + +$(CLIENTJAR): $(CLIENTSRC) + @mkdir -p $(CLIENTBINDIR) $(JARDIR) $(COMPILE) -d $(CLIENTBINDIR) $(shell find $(CLIENTSRCDIR) -name "*.java") + $(JAR) cf $@ -C $(CLIENTBINDIR) . + @$(RM) -r $(CLIENTBINDIR) + +$(CLIENTSRCDIR)/%-stamp: $(WSDLDIR)/%.wsdl + $(WSDL2JAVA) -o $(CLIENTSRCDIR) -pdiku.distlab.remote.$(*F) $< + touch $@ + +$(WSDLDIR)/%.wsdl: wsdd/%.wsdd $(SERVERJAR) + @mkdir -p $(WSDLDIR) $(AXIS_PATH) + test -e $(AXISLOG) || $(AXISSERVER) -p $(AXISPORT) >> $(AXISLOG) & + $(ADMINCLIENT) -h $(AXISHOST) -p $(AXISPORT) $< + wget -q -O - $(AXISLOCATION)/$(*F)?wsdl | \ + sed 's#http://.*:$(AXISPORT)/axis/services/#$(SERVICELOCATION)/#' \ + > $@ + ## Deployment rules # @@ -115,3 +136,12 @@ deploy-test: deploy: server $(SCP) -r $(SERVERBINDIR) $(DEPLOYLOCATION) $(ADMINCLIENT) -h $(ADMINHOST) -u $(ADMINUSER) -w $(ADMINPASS) $(WSDDFILES) + + +## WSDL / SimpleAxisServer rules +# +# Rules to startup a simple axis server and get WSDL files. + +simpleaxisserver-stop: + test ! -e $(AXISLOG) || $(ADMINCLIENT) -h $(AXISHOST) -p $(AXISPORT) quit + @$(RM) -r $(AXIS_PATH) -- 2.11.4.GIT