Difference: RegistryClientTutorial (1 vs. 8)

Revision 82012-06-26 - root

 
META TOPICPARENT name="WebgridTutorial"

Registry Tutorial at ADASS XIII

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
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.

Making the java client work

Obviously if 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:
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.java
and 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
....

The C# Client using Visual Studio

First we creat a new project - a C# Console Application - called RegClient. This will create a new Class1 lets rename that to RegClient and put the following code in the class :
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.

Making the c# client work

Studil will generate the classes we need to access the service. If we right clik on references in the pproject browser and choose "Add Web Refference". A window pops up and we may enter the service URL. Hit "Add Refference" and a new namesapce appears for edu.stsci.sdssdsb1. Now we may simply compile and run the client.
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
....

IVOA Client

There is a more suffisticated client with download manager available at IVOA Client at JHU.

-- WilliamOMullane - 12 Oct 2003


Revision 72003-10-12 - MarcoLeoni

 
META TOPICPARENT name="WebgridTutorial"
Added:
>
>

Registry Tutorial at ADASS XIII

 

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
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.

Making the java client work

Obviously if 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:
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.java
and 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
....

The C# Client using Visual Studio

First we creat a new project - a C# Console Application - called RegClient. This will create a new Class1 lets rename that to RegClient and put the following code in the class :
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.

Making the c# client work

Studil will generate the classes we need to access the service. If we right clik on references in the pproject browser and choose "Add Web Refference". A window pops up and we may enter the service URL. Hit "Add Refference" and a new namesapce appears for edu.stsci.sdssdsb1. Now we may simply compile and run the client.
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
....

IVOA Client

There is a more suffisticated client with download manager available at IVOA Client at JHU.

-- WilliamOMullane - 12 Oct 2003


<--  
-->

Revision 62003-10-12 - WilliamOMullane

 
META TOPICPARENT name="WebgridTutorial"

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
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.

Making the java client work

Obviously if 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:
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.java
and 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
....

The C# Client using Visual Studio

First we creat a new project - a C# Console Application - called RegClient. This will create a new Class1 lets rename that to RegClient and put the following code in the class :
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.

Making the c# client work

Studil will generate the classes we need to access the service. If we right clik on references in the pproject browser and choose "Add Web Refference". A window pops up and we may enter the service URL. Hit "Add Refference" and a new namesapce appears for edu.stsci.sdssdsb1. Now we may simply compile and run the client.
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
....
Changed:
<
<
-- WilliamOMullane - 02 Oct 2003
>
>

IVOA Client

Added:
>
>
There is a more suffisticated client with download manager available at IVOA Client at JHU.

-- WilliamOMullane - 12 Oct 2003

 


<--  
-->

Revision 52003-10-10 - MarcoLeoni

 
META TOPICPARENT name="WebgridTutorial"

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
Changed:
<
<

>
>
 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());

} }

Changed:
<
<
>
>
  AXIS always creates Localtor classes - where the service url may be changed.
Simple Resource is the object returned by the registry.

Making the java client work

Obviously if 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:
Changed:
<
<

>
>
 java org.apache.axis.wsdl.WSDL2Java "http://sdssdbs1.stsci.edu/nvo/registry/registry.asmx?WSDL"
Changed:
<
<
>
>
 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.

Changed:
<
<
Now the client code should comile so Assuming the above code is in a file called RegClient.java we type :
>
>
Now the client code should comile so Assuming the above code is in a file called RegClient.java we type :
 
Changed:
<
<

>
>
 javac RegClient.java
Changed:
<
<
>
>
 and we may run it as follows
Changed:
<
<

>
>
 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 ....
Changed:
<
<
>
>
 

The C# Client using Visual Studio

First we creat a new project - a C# Console Application - called RegClient. This will create a new Class1 lets rename that to RegClient and put the following code in the class :
Changed:
<
<

>
>
 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 ) { WriteLine(res.Title+ "|"+ res.Publisher + "|" + res.MaxSR); } } }

Changed:
<
<
>
>
 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.

Making the c# client work

Studil will generate the classes we need to access the service. If we right clik on references in the pproject browser and choose "Add Web Refference". A window pops up and we may enter the service URL. Hit "Add Refference" and a new namesapce appears for edu.stsci.sdssdsb1. Now we may simply compile and run the client.
Changed:
<
<

>
>
 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 ....
Changed:
<
<
>
>
  -- WilliamOMullane - 02 Oct 2003
Changed:
<
<



>
>
Added:
>
>


 
<--  
-->

Revision 42003-10-02 - TWikiGuest

 
META TOPICPARENT name="WebgridTutorial"

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
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.

Changed:
<
<

Making the client work

Obviously of we compile this none of the stub classes exist so we need to create them.
>
>

Making the java client work

Obviously if 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:
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.java
and 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
....
Added:
>
>

The C# Client using Visual Studio

First we creat a new project - a C# Console Application - called RegClient. This will create a new Class1 lets rename that to RegClient and put the following code in the class :
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.

Making the c# client work

Studil will generate the classes we need to access the service. If we right clik on references in the pproject browser and choose "Add Web Refference". A window pops up and we may enter the service URL. Hit "Add Refference" and a new namesapce appears for edu.stsci.sdssdsb1. Now we may simply compile and run the client.
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


<--  
-->

Revision 32003-10-02 - TWikiGuest

 
META TOPICPARENT name="WebgridTutorial"

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
Changed:
<
<

The Client

>
>

The Java Client

 Next we need some Client code - here is a simple client in Java
Deleted:
<
<


AXIS always creates Localtor classes - where the servie url may be changed.

Simple Resource is the object returned by the registry.

 
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());

	}
}
Deleted:
<
<
 
Added:
>
>
AXIS always creates Localtor classes - where the service url may be changed.
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:
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.java
and 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
....
 -- WilliamOMullane - 02 Oct 2003


<--  
-->

Revision 22003-10-02 - WilliamOMullane

 
META TOPICPARENT name="WebgridTutorial"
Changed:
<
<

Using the NVO Registry WebService from Java and C#

Below I briefly describe how to make a simple clinet for the registry prototype.

The Service URL

>
>

Using the NVO Registry WebService from Java and C#

Below I briefly describe how to make a simple client for the registry prototype.

Added:
>
>

The Service URL

 First we need the service URL which is http://sdssdbs1.stsci.edu/nvo/registry/registry.asmx
Changed:
<
<

The Client

>
>

The Client

 Next we need some Client code - here is a simple client in Java
Added:
>
>


AXIS always creates Localtor classes - where the servie url may be changed.

Simple Resource is the object returned by the registry.

 

Changed:
<
<
>
>
import org.us_vo.www.*;
 
Added:
>
>
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());

} }

  -- WilliamOMullane - 02 Oct 2003


<--  
-->

Revision 12003-10-02 - TWikiGuest

 
META TOPICPARENT name="WebgridTutorial"

Using the NVO Registry WebService from Java and C#

Below I briefly describe how to make a simple clinet for the registry prototype.

The Service URL

First we need the service URL which is http://sdssdbs1.stsci.edu/nvo/registry/registry.asmx

The Client

Next we need some Client code - here is a simple client in Java

-- WilliamOMullane - 02 Oct 2003


<--  
-->
 
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback