Sloan Digital Sky Survey
JHU img cutout DIME client
Java Dime client for SDSS Image Cutout Service
DIME is the SOAP protocal for sending attachments (like MIME) with SOAP messages. The service http://skyservice.pha.jhu.edu/devel/ImgCutout/ImgCutout.asmx provides a web method which returns a JPEG image as an attachemnt. THis could infact be any kind of file/Binary object.
Creating a java client
Using axis-1_1RC1 we created the set of client classes for using this service. This is very easy with axis you simply do
java org.apache.axis.wsdl.WSDL2Java http://skyservice.pha.jhu.edu/devel/ImgCutout/ImgCutout.asmx?wsdl
And you are done. (Okay you do need to have your class path set up properly to include the AXIS libs).
Utilising the code
Making use of this client is also very straight forward here is a complete java program which uses the service to get an image and save it to a desired file name. The basic code is shown below. Here is a full listing,
ImgCutoutLocator loc = new ImgCutoutLocator();
ImgCutoutSoap imgProvider = loc.getImgCutoutSoap();
// not so nice but we must cast to a stub to get att the attachements
Object obj = ((org.apache.axis.client.Stub) imgProvider).getAttachments();
// assuming one attachemnt only
if(obj.length != 1 ) throw new Exception("Expected a single attachemnt but got "+obj.length);
//Each Attachment is actually an AttachmentPart - we only have 1
AttachmentPart p = (AttachmentPart) obj;
// from the part we may get the dataHandler
DataHandler dh = p.getActivationDataHandler();
// this actually is backed by a temp file
String fname = dh.getName();
Here are some jars for download - you can get the code or just a jar to use.
You will need a JRE/JDK installed probably 1.3 or higher. This has been run/developed with JDK1.4 on linux.
You will also need activation.jar and mail.jar (required for DIME) in your class path. You probably have these if
you have J2EE installed otherwise they are below for download.
To just run it downaload imgclientincaxis.jar and type :
java -classpath imgclientincaxis.jar edu.jhu.pha.imgcutout.CutOutViewer
Then hit the get button.
Note that to build with ant you will need to modify the build.xml to point to your
ant lib and activation.jar.
Last Modified :Tuesday, April 27, 2004 at 11:19:50 PM
, $Revision 1.2 $