---++ Using the NVO Registry WebService from Java and C# Below I briefly describe how to make a simple client for the registry prototype. ---+++ The Service URL First we need the service URL which is http://sdssdbs1.stsci.edu/nvo/registry/registry.asmx ---+++ The Java Client Next we need some Client code - here is a simple client in Java <pre> 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()); } } </pre> AXIS always creates Localtor classes - where the service url may be changed.<br> Simple Resource is the object returned by the registry. ---++++ Making the client work Obviously of we compile this none of the stub classes exist so we need to create them. If you have AXIS installed and a class path set up as detailed on WebgridTutorial then this is a simple matter of typing: <pre> java org.apache.axis.wsdl.WSDL2Java "http://sdssdbs1.stsci.edu/nvo/registry/registry.asmx?WSDL" </pre> *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 : <pre> javac RegClient.java </pre> and we may run it as follows <pre> 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 .... </pre> -- WilliamOMullane - 02 Oct 2003 <br><br><br> <!-- * Set ALLOWTOPICRENAME = %MAINWEB%.TWikiAdminGroup -->
This topic: IVOA
>
WebHome
>
IvoaEvents
>
InterOpOct2003
>
InterOpOct2003WebGrid
>
WebgridTutorial
>
RegistryClientTutorial
Topic revision: r3 - 2003-10-02 - TWikiGuest
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback