Adminstration of Web Services
Back to Administration of Text Modules...
This section is intended for programmers who want to access from remote systems on todo4teams.
Todo4teams provides accessibility to remote systems using Web Services. These are available as SOAP (Simple Object Access Protocol) services. The SOAP standard is supported by most current operating systems and many programming languages.
Functions
Todo4teams provides the following functions via the Web Services:
hello
newJob
java.lang.String title,
java.lang.String description,
int minutes,
int ownerId)
throws java.rmi.RemoteException
newPriorityJob
java.lang.String title,
java.lang.String description,
int minutes,
int ownerId,
int priority)
throws java.rmi.RemoteException
updateJob
int addressedGroupId,
java.lang.String title,
java.lang.String description,
int minutes)
throws java.rmi.RemoteException, java.lang.Exception
getJobStatus
throws java.rmi.RemoteException, java.lang.Exception
deleteJob
throws java.rmi.RemoteException, java.lang.Exception
newJobWithMetaData
java.lang.String title,
java.lang.String description,
int minutes,
int ownerId,
int metaDataId,
java.util.Map<java.lang.String,
java.lang.Object> values)
throws java.rmi.RemoteException
newEmailFormJob
java.lang.String title,
java.lang.String description,
int minutes,
int ownerId,
int metaDataId,
java.util.Map<java.lang.String,java.lang.Object> values,
int priority,
java.lang.String replyFromEmail,
java.lang.String replyToEmail)
throws java.rmi.RemoteException
WSDL-Descriptor
The interface is fully described by the WSDL descriptor that can be retrieved via the URL
http:~/~/<Todoserver>:8080/TodoServer/services/TodoInterface?wsdl
Client-Implementations
Using the WSDL descriptor the client-sided implementation usually reduces to a few lines. In the section some brief examples of these implementations in different programming languages are listed.
Microsoft .NET
The development environment Microsoft Visual Studio NET brings the tool wsdl.exe, with which help the client-sided implementation can be automated:
The code
wsdl.exe /language:VB http:~/~/<Todoserver>:8080/TodoServer/services/TodoInterface?wsdl
generates in the file RpcMethodService.vb a full client code. In the main program you use the interface like this:
d = New RpcMethodsService
jobid = d.newJob(76, "aus Visual Basic", "Eine Beschreibung", 45, 39))
status = d.getJobStatus(jobid)
If you want an implementation in C #
wsdl.exe /language:CS http:~/~/<Todoserver>:8080/TodoServer/services/TodoInterface?wsdl##
can be used.
PHP
The example waived intercepting SOAP exceptions, which must be implemented urgently in real operation. It requires the NuSOAP library (see http://sourceforge.net/projects/nusoap/).
require ('lib/nusoap.php');
$serverurl = 'http:~/~/<Todoserver>:8080/TodoServer/services/TodoInterface?wsdl';
$client = new soapclient($serverurl, true);
$param = array (
'addressedGroupId' => 22, ~/~/ ID der Adressierten Gruppe
'title' => 'Beispiel-Titel',
'description' => 'Ein Beispiel-Text',
'minutes' => 45,
'ownerId' => 39 ~/~/ ID des Besitzers);
$result = $client->call('newJob', $param, '', '', false, true);
{{/code}}
Java
Use the Axis library (via http://ws.apache.org/axis/). Add the Axis libraries in the classpath and use the code
java org.apache.axis.wsdl.WSDL2Java -o . "http:~/~/<Todoserver>:8080/TodoServer/services/TodoInterface?wsdl"
In the local directory the necessary interface files in the package com.proxemo.Todo.service will now be generated.
You can generate a service code following this example:
package com.proxemo.Todo.services;
public class TestClient{
public static void main(String args[]){
try{
RpcMethods methods = new RpcMethodsServiceLocator().getTodoInterface();
int id = methods.newJob(76, "ein SOAP-Job","mit einer Beschreibung", 25, 39);
}
catch(RemoteException re){
System.out.println("Remote-Exception: "+re.getMessage());
} catch(Exception e){
e.printStackTrace();}
}
}