Below I briefly describe how to make a simple client for the registry prototype.
import org.us_vo.www.*; class RegClient { public static void main (String[] args) throws Exception { RegistryLocator loc = new RegistryLocator(); RegistrySoap reg = loc.getRegistrySoap(); ArrayOfSimpleResource reses = null; if ( args.length ==0 ) { reses = reg.dumpRegistry(); } else { reses = reg.queryRegistry(args[0]); } for (int i = 0 ; i < reses.getSimpleResource().length; i++) { print(reses.getSimpleResource(i)); } } public static void print(SimpleResource res ) { System.out.println(res.getTitle()+ "|"+ res.getPublisher() + "|" + res.getMaxSR()); } }
AXIS always creates Localtor classes - where the service url may be changed.
Simple Resource is the object returned by the registry.
java org.apache.axis.wsdl.WSDL2Java "http://sdssdbs1.stsci.edu/nvo/registry/registry.asmx?WSDL"Note: The \" are really important.
?WSDL is a convention for getting the WSDL frm a service. You will have seen this plenty earlier in the tutorial.
Now the client code should comile so Assuming the above code is in a file called RegClient.java we type :
javac RegClient.javaand we may run it as follows
java RegClient "Subject like '%cosmology%'" NOAO Science Archive|National Optical Astronomy Observatories|2.0 Hubble Space Telescope|Space Telescope Science Institute/MAST|180.0 Advanced Camera for Surveys|Space Telescope Science Institute/MAST|180.0 Faint Object Camera|Space Telescope Science Institute/MAST|180.0 ....
using System; using RegClient.edu.stsci.sdssdbs1; namespace RegClient { class RegClient { [STAThread] static void Main(string[] args) { Registry reg = new Registry(); SimpleResource[] reses = null; if ( args.Length ==0 ) { reses = reg.DumpRegistry(); } else { reses = reg.QueryRegistry(args[0]); } for (int i = 0 ; i < reses.Length; i++) { print(reses[i]); } } public static void print(SimpleResource res ) { Console.WriteLine(res.Title+ "|"+ res.Publisher + "|" + res.MaxSR); } } }This is similar to the Java code. There are no Locators here but the Service URL may be set on the Registry Class. The Array type handling is also somewhat better.
RegClient\bin\Debug>RegClient.exe "Subject like '%Cosmology%'" NOAO Science Archive|National Optical Astronomy Observatories|2 Hubble Space Telescope|Space Telescope Science Institute/MAST|180 Advanced Camera for Surveys|Space Telescope Science Institute/MAST|180 Faint Object Camera|Space Telescope Science Institute/MAST|180 ....
-- WilliamOMullane - 02 Oct 2003
IVOA.net
Wiki Home
WebChanges
WebTopicList
WebStatistics
Twiki Meta & Help
IVOA
Know
Main
Sandbox
TWiki
Working Groups
Interest Groups
Committees