Creating a web-service using perfSONAR base
From GEANT2-JRA1 Wiki
To create a schema and a java web-service (starting from perfSONAR base) making use of that schema, you need the following
- Create the schema and the XML instances. Follow the procedure below:
- http://anonsvn.internet2.edu/svn/nmwg/trunk/nmwg/schema/README.txt
- The java implementation of the schema can be found at: http://anonsvn.internet2.edu/svn/nmwg/trunk/nmwg/java/
- Now you got a schema!
- http://anonsvn.internet2.edu/svn/nmwg/trunk/nmwg/schema/README.txt
- The XML message are received by the requestHandler that will convert each elements of the XML message into NMWG objects. The RequestHandler class is a generic class, where you don't have to change anything.
- Request handler: http://anonsvn.internet2.edu/svn/perfsonar/trunk/perfsonar/src/org/perfsonar/service/web/RequestHandler.java
- To allow the requestHandler to convert your XML elements into NMWG you need to ensure that all the elements you used are defined. Please check the list of existing elements: http://anonsvn.internet2.edu/svn/nmwg/trunk/nmwg/java/objects.config (make sure it's up to date; take a look at the java packages; this file can be updated automatically using the script http://anonsvn.internet2.edu/svn/perfsonar/trunk/perfsonar/src/obs.pl).
- If element isn't defined yet, you need to create it following the examples provided (around a day of work if you have never done this).
- Request handler: http://anonsvn.internet2.edu/svn/perfsonar/trunk/perfsonar/src/org/perfsonar/service/web/RequestHandler.java
- The requestHandler, after having converted the elements into NMWG objects, call a messageHandler. There is one messageHandler per type of message. You need thus to create a new messageHandler for the messages you are exchanging. Following the example of the RRD MA, it will take you few minutes to do so.
- Message handler for SetuDataRequest message: http://anonsvn.internet2.edu/svn/perfsonar/trunk/perfsonar/src/org/perfsonar/commons/messages/SetupDataRequest.java
- The message handler classes must be located in http://anonsvn.internet2.edu/svn/perfsonar/trunk/perfsonar/src/org/perfsonar/commons/messages/
- The messageHandler will call your serviceEngine. The serviceEngine is the part that contains all the intelligence of the service (fetch the data, perform actions on an archive or on a measurement tool).
- When testing your service, you need to create a conf/service.property document to take into effect the message types you have been creating.
- To do so, the class names of message handlers (representing message types) must be put in the config file conf/service.properties. Examples of service.properties can be found at http://anonsvn.internet2.edu/svn/perfsonar/trunk/perfsonar/conf/
- The file should include the list of messages that your service will use Example for RRD MA: service.ma.message_types=MetadataKeyRequest,SetupDataRequest,MeasurementArchiveStoreRequest,EchoRequest,LookupInfoRequest
- Note that once releasedm the service.conf is created automatically by the configuration scripts.
