WebServicesIVOA_12052003
Download
Report
Transcript WebServicesIVOA_12052003
What is a Web Service ?
FROM http://dev.w3.org/cvsweb/~checkout~/2002/ws/arch/wsa/wd-wsaarch.html#whatisws
[Definition: A Web service is a software system identified by a URI, whose public
interfaces and bindings are defined and described using XML. Its definition can be
discovered by other software systems. These systems may then interact with the
Web service in a manner prescribed by its definition, using XML based messages
conveyed by internet protocols.]
Note:
Our definition of the term "Web services" does not presuppose the use of SOAP as
a packaging format or a processing model. Nor does it presuppose the use of WSDL
as a service description language. There are, and will be in the future, plenty of Web
services that use raw HTTP as a data transfer protocol and some mutually agreedupon XML format as the message content. The Web Services *reference
architecture* does, however, assume that the higher levels of the Web services
protocol stack are built on the foundation of SOAP and WSDL.
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
What is Web Service ?
•CONE
•has SIZE=0
•SIAP
•has FORMAT=Metadata
Not properly described in a manner which may be used automatically
So NO for these
Open Grid Services Architecture
• How does it relate to SOAP? Just an Extension – uses SOAP-Envelope
• What does it add ? Some header attributes fro Authentication/Sessions
In any Case YES for these
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
SOAP Tools for Web Services
If we choose SOAP and WSDL a range of tools exist
•We have tried - Java C# and Perl(Tom McGLyn, Jeongin Lee)
•Generate Proxy classes in your language
•Marshals calls to the service
•Serializes/Deserializes XML from service into/out of native objects.
•Generates WSDL for your service.
Advantages
•Language/Platform independence
•Don’t care much about the format of the XML – got a local object (tools).
•Making service is easy
•Allows Complex operations/info in easy manner
Disadvantages
•Small Learning Curve (New Technology – must learn the ABCs)
•Can be difficult to get exactly the XML/WSDL you want (if you care).
•Need a web server and application server running (if hosting service).
•Performance – not a problem so far
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
Writing a WebService
In Java/AXIS write a class.
import java.util.*;
public class Randy {
public double[] random(int numRands) {
Random rand = new Random();
double[] d = new double[numRands];
for (int i =0; i < numRands; i++ )
d[i] = rand.nextDouble();
return d;
}
}
Deploy it to AXIS i.e. copy it to correct place (Takes 5minutes – can demo)
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
Writing a WebService
In C# just need to write a class. (Takes 5minutes – can demo)
public class Demo : System.Web.Services.WebService
{
public Demo(){}
[WebMethod]
public double[] random(int numRands)
{
Random rand = new Random();
double[] d = new double[numRands];
for (int i =0; i < numRands; i++ )
d[i] = rand.NextDouble();
return d;
}
}
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
Consuming a .NET WebService in
JAVA
Just generate the proxy . (Also Takes 5 minutes – can demo)
In Java AXIS (on one line) :
java org.apache.axis.wsdl.WSDL2Java
"http://surf/DemoService/demo.asmx?wsdl"
Client Code is straight forward:
import org.tempuri.*;
public class DemoClient {
public static void main( String[] argv) throws Exception {
Demo dm = new DemoLocator();
DemoSoap ds = dm.getDemoSoap();
ArrayOfDouble da = ds.random(Integer.parseInt(argv[0]));
double d[]= da.get_double();
for (int i =0; i < d.length; i++)
System.out.println(d[i]);
}
}
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
Consuming Axis WebService in JAVA
Just generate the proxy . (Also Takes 5 minutes – can demo)
In Java AXIS (on one line) :
java org.apache.axis.wsdl.WSDL2Java
"http://localhost:8090/axis/Randy.jws?wsdl"
Client Code is straight forward:
import localhost.axis.Randy_jws.*;
public class RandyClient {
public static void main( String[] argv) throws Exception {
RandyService dm = new RandyServiceLocator();
Randy ds = dm.getRandy();
double d[]= ds.random(Integer.parseInt(argv[0]));
for (int i =0; i < d.length; i++)
System.out.println(d[i]);
}
}
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
Web Services at JHU
http://skyservice.pha.jhu.edu/develop/vo
•Registry Prototype
•Simple Image Access (SIAP)
•CONESearch
•NED
•NameResolver(Simbad+NED)
•Internal to SkyQuery
DIME – Binary Attachments for SOAP.
•DensityMap
•IMGCUTOUT –
•Simple Java Client
http://skyservice.pha.jhu.edu/develop/vo/imgcutoutclient.html
•Fancy ASP Pages
http://skyservice.pha.jhu.edu/devel/imgcutout/chart.asp
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU
What we need for WebServices
1.
2.
Agreement to use SOAP
•
Not a big effort to make a SOAP service instead of a simple WebApp.
Some standard names/types for inputs and outputs
•
Data Model (I think)
•
Or UCDs
3.
More ??
IVOA Cambridge May 12-16, 2003
William O’Mullane - JHU