r4 - 03 Feb 2009 - 09:12:03 - Main.amorosYou are here: TWiki >  Atlas Web  >  GridComputing > EGEEHome > AboutWebservices

About Webservices in the SW helpdesk

Some hints about how to setup something similar to the SW helpdesk:

  • The SW helpdesk was at the beginning developped from Oneorzero but the code has been touched many times.

  • The DB used is MySQL. I do not expect critical difference between versions, however for your information the version we installed is
  mysql  Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i686)

  • The webservices package used is nuSOAP, so this one you should have installed. Our version is
  nusoap-0.7.2-5

  • Then there are some files that I would try to explain: (the authorization is not included, it does not affect the webservices functionality ):
    • index_empty.php (the main file: that calls to the nuSOAP classes and includes the files with the webservices functions)
    • create_empty.php (this file has the functionality to create a new ticket. This file is called by the helpdesk itself to actualize the database and also communicate to GGUS with the modifyWS function included in the common_empty.php.)
    • common_empty.php (include the set up to communicate with the GGUS webservices through the specifications in helpdesk_empty.xml. The client->TicketModify is the call to the GGUS webservices.)
    • helpdesk_empty.xml (collection of the main configuration variables: GGUS password for GGUS webservices,...)
    • classes/xmlconfig.php
    • init.php, just to parser the xml variables in helpdesk_empty.xml

  • Example:

Call to nuSoap, create a new server and configure it:

  require "NuSOAP/nusoap.php";
  $server = new soap_server();
  $server->configureWSDL($helpdeskID, "urn:$helpdeskID", $helpdesk['provider'], 'document');
  ....
  require "myService.php";
  ... 
  $server->service($HTTP_RAW_POST_DATA);
The variables $helpdeskID and $helpdesk have been intialized before and myService.php has the service to include; for example, the service to create a new ticket. In myService.php is defined the input and output fields:
$server->wsdl->addComplexType(
        'CreateInputMap',
        'complexType',
        'struct',
        'sequence',
        '',
        $createElements
        );

$server->wsdl->addComplexType(
        'CreateOutputMap',
        'complexType',
        'struct',
        'sequence',
        '',
        $ReqID
        );
Here the name associated to the input values is CreateInputMap and the fields are included in $createElements, something like
$createElements = array_merge( $ExternalID , Array(
        'Date' => Array('name' => 'Date' , 'type' => 'xsd:string')
        ));
where the $externalID could be something like
$ExternalID = Array( 'Origin_ID' => Array('name' => 'Origin_ID', 'type' => 'xsd:string' ) );

After the definition you can register the service:

$server->register('opCreate',
        Array('input'=>'tns:CreateInputMap'),
        Array('result'=>'tns:CreateOutputMap'),
        'urn:' . $helpdeskID,
        'urn:' . $helpdeskID . '/opCreate',
        'document',
        'literal'
        );

and finally you should provide the correct function opCreate:

function opCreate($array) {
 ....
 return Array( 'result' => Array( 'Request-ID' => "$tid" ) );
 }

This is the basic framework to create your own webservices.

Within the function that manages the result for the service, there is a workflow quite general to follow:

  1. Check the permissions/authorization.
  2. Check the mandatories fields.
  3. Format the input data to the data in the DB.
  4. Check the possibilities for autotasks.
  5. Check and avoid loops (SW helpdesk to GGUS to SW helpdesk ...).
  6. Do the queries in the DB.
  7. Do the assignments.
  8. Inform the users/supporters.
  9. Update the external helpdesk: GGUS,...
  10. ...

About the operations in the web services page: http://swegus.ific.uv.es/SWEws

The webservices does not include too many operations, just the main ones:

  • opCreate: the input fields are some of the information you need to create a ticket. The mandatory field is Short_description. In case the ticket is created by an external helpdesk, the external ID and the identifciation of the external helpdesk are also mandatory.
_ TicketGet? _

  • TicketModify

-- Main.amoros - 28 Nov 2008

Edit | WYSIWYG | Attach | PDF | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback