Java Reference
In-Depth Information
Assuming that the web service is running, and that the current directory contains
TempVerterClient.java along with the client subdirectory, execute javac
TempVerterClient.java tocompilethissourcecode.Thenexecute java Tem-
pVerterClient torunthisapplication.Ifallgoeswell,youshouldobservethefol-
lowing output:
98.6
100.0
Accessing the Image Cutout Web Service
Although you can create and access your own SOAP-based web services, you might
wanttoaccessSOAP-basedwebservicescreatedbyothers.Forexample,theSloanDi-
gital Sky Survey ( http://www.sdss.org ) makes available astronomical images
from its image archive via its Image Cutout web service.
Image Cutout's operations are described by its WSDL document at ht-
tp://casjobs.sdss.org/ImgCutoutDR5/ImgCutout.asmx?wsdl . For
example, this WSDL document identifies an operation named GetJpeg for returning
a JPEG image of an area of the night sky located in terms of right accension (see
http://en.wikipedia.org/wiki/Right_ascension ) anddeclination(see
http://en.wikipedia.org/wiki/Declination ) degree values.
BeforeyoucanwriteaJavaapplicationthatletsyouaccessthiswebservicetoobtain
(and then display) arbitrary images, you need to create artifacts (in the form of Java
classes) that let this application interact with the web service. You can generate these
artifacts by executing the following wsimport command line:
wsimport
-keep
http://casjobs.sdss.org/ImgCutoutDR5/
ImgCutout.asmx?wsdl
wsimport creates an org directory within the current directory. org contains an
sdss subdirectory,whichcontainsa skyserver subdirectory,whichstoresthegener-
atedclassfiles.Furthermore, skyserver storestheirsourcefiles(thankstothe -keep
option).
The generated ImgCutout.java source file reveals a noargument ImgCutout
constructoralongwithan ImgCutoutSoap getImgCutoutSoap() method.Fur-
thermore, ImgCutoutSoap declares a public byte[] getJpeg(double
ra, double dec, double scale, int width, int height, String
opt) method that corresponds to the GetJpeg operation. Your application interacts
with Image Cutout via this constructor and these methods.
Search WWH ::




Custom Search