#! /bin/ksh -x

# C web services 

# just for cleanup
rm -rf ./soap* *.o tns.xsd TemperatureService.[hc] TempClient

if [ "$1" == "clean" ]
then
        exit
fi

rm -f member-c *.o

JDK_ROOT=${JDK_ROOT-/usr/java}		# location of J2SE SDK
GSOAP=${GSOAP-/usr/lib/gsoap}		# location of gSOAP
CC=${CC-/usr/ccs/bin/cc}		# C compiler to use

export CLASSPATH=.:$GSOAP

echo "\n!!! Accessing xmethods.net service "

echo "\n=== Gets current temperatures for zip codes"

$JDK_ROOT/bin/java wsdlcpp -c http://www.xmethods.net/sd/2001/TemperatureService.wsdl

$GSOAP/soapcpp2 -c TemperatureService.h

$CC -c -I $GSOAP TempClient.c 

$CC -o TempClient TempClient.o -I $GSOAP \
	$GSOAP/stdsoap2.c soapC.c soapClient.c \
	-lsocket -lnsl

./TempClient 

# A C example using the Google API is left as an exercise for the reader.
