|
![]() |
This feature allows the monitoring of active objects from any client written in any foreign language.
We choose the web services technology that enable interoperability
with foreign languages, such as C#. By using Web Services, any active object can be accessed by any
languages or hardware thanks to HTTP, and SOAP, the XML-based protocol.
The steps for exporting and using an active object as a web service are the following :
First of all, you need to install the Jakarta Tomcat web server here
and install it. You can find some documentation about it here .
You don't really have to do a lot of installation. Just
uncompress the archive.
To start and stop the server,launch the start and the shutdown scripts in the bin directory.
We also use a SOAP engine which is the Apache SOAP engine, available
here . This SOAP engine will be responsible of
locating and calling the service.
Uncompress the apache SOAP archive, then copy the
$APACHE-SOAP/webapps/soap into the $TOMCAT/webapps directory.
The SOAP Engine is now installed ! You can verify, after starting the server that you access to the welcome page of Apache SOAP at : http://localhost:8080/soap/index.html.
Now we have to install ProActive into this SOAP engine. For that, please follow these steps :
You are now able to export active objects as Web Services !
To expose an active object as a web service, simply use only one method :
public static void exposeAsWebService (Object o, String url, String urn, String [] methods )
where :
As an example here a simple class that creates an active object and expose it as a web service :
public class Compute { public Compute () { } public int add (int a , int b) { return a + b; } public int sub (int a , int b) { return a - b; } public static void main(String[] args) { try{ Compute t = (Test)ProActive.newActive("Compute",new Object []{}); ProActive.exposeAsWebService(t, "http://localhost:8080","compute",new String []{"add","sub"}); } catch (ActiveObjectCreationException e) { e.printStackTrace(); } catch (NodeException e) { e.printStackTrace(); } } }
To undeploy the service, use the following method :
public static void unExposeAsWebService (String urn, String url)
where :
For a given service, say "compute" ,you can get the WSDL document at hrrp://localhost:8080/servlet/wsdl?id=compute.
This WSDL is generally used by tools or languages to generate a proxy
to the service.