On Wed, 27 Aug 2003, Tim Jenness wrote:
> This sounds much better. Is the SOAP interface documented or do I have to
> read the file? What port is SPLAT using for this?
Hi Tim,
no documentation for SOAP and it's a bit inflexible at present (very much
still early days). The endpoint for the service is currently always:
http://<machine>:8081/services/SplatSOAPServices
I plan to allow control of the port number sometime. The two methods I
mentioned are:
public boolean displaySpectrum( String specspec )
public void displayNDX( Element ndxElement )
Not sure how well the "displayNDX" one would work from Perl (assuming you
had an NDX library) as the magic for translating between DOM elements is
handled by Axis (the embedded SOAP server).
If you like looking at WSDL the automatically generated descriptions can
be viewed at the URL:
http://localhost:8081/services/SplatSOAPServices?wsdl
once SPLAT is up and running. There's also a nice page at:
http://localhost:8081/servlet/AxisServlet
which lists the names of all services.
I've attached an example Java program that displays an NDX in SPLAT:
java -cp /star/starjava/lib/splat/splat.jar:. TestSOAPClientNDX $PISA_DIR/frame.sdf
Cheers,
Peter.
// Copyright (C) 2002 Central Laboratory of the Research Councils
import java.util.List;
import java.net.URL;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import javax.xml.rpc.ParameterMode;
import uk.ac.starlink.splat.data.HdxInputNameParser;
import uk.ac.starlink.ndx.*;
import uk.ac.starlink.array.*;
import uk.ac.starlink.util.*;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
/**
* Test client for builtin "NDX down the wire" SOAP services in SPLAT.
*
* @author Peter W. Draper
* @version $Id: TestSOAPClient.java,v 1.1 2002/06/17 15:48:06 pdraper Exp $
*/
public class TestSOAPClientNDX
{
private static String endpoint =
"http://localhost:8081/services/SplatSOAPServices";
public static void main( String [] args )
throws Exception
{
if ( args.length == 0 ) {
System.out.println( "TestSOAPClientNDX NDX_spectrum" );
System.exit( 1 );
}
Ndx ndx = null;
NdxIO ndxIO= new NdxIO();
try {
URL url = new URL( new URL( "file:." ), args[0] );
ndx = ndxIO.makeNdx( url, AccessMode.READ );
}
catch (Exception e) {
e.printStackTrace();
return;
}
if ( ndx == null ) {
throw new RuntimeException( "Document contains no NDXs" );
}
// Now we have the Ndx, get the DOM version. We can send
// this to SPLAT.
Source ndxSource = ndx.toXML( null );
SourceReader sourceReader = new SourceReader();
Node ndxElement = sourceReader.getDOM( ndxSource );
Object[] elements = new Object[1];
elements[0] = ndxElement;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL( endpoint ) );
call.setOperationName( "displayNDX" );
call.addParameter( "element", XMLType.SOAP_ELEMENT, ParameterMode.IN );
call.setReturnType( XMLType.AXIS_VOID );
System.out.println( "Sending NDX: " + args[0] );
call.invoke( elements );
}
}
|