Entrepreneur Geek

Nirav Mehta on life, technology and future

XPlanner PHP SOAP Client

without comments

I am working on a project management system and want to build a Mylyn plugin such that all tasks from the PMS show up in Eclipse / Aptana. I want to adapt Extreme Programming model of Iterations - User Stories and Tasks. XPlanner does this really well, and Mylyn already has an XPlanner connector.

So I want to keep the same XPlanner API and hook that up with my PMS! (Don't have time / skills to build a new Mylyn connector yet!)

XPlanner has a SOAP client in PHP, but that's written in NuSOAP. PHP's SOAP support uses a different convention for web services. Here's a simple XPlanner SOAP client for PHP (right after the jump!)

PHP:
  1. <?php
  2. $options['login'] = 'sysadmin';
  3. $options['password'] = 'admin';
  4. $xplanner = new SoapClient('http://localhost:7070/soap/XPlanner?wsdl', $options);
  5. ?>
  6.  
  7. <html>
  8. <body>
  9. <H1>XPlanner PHP SOAP Example</H1>
  10. <?php
  11. // Dump all properties of an object
  12. function dump_props($obj)
  13. {
  14.     echo '<ul>';
  15.     foreach ($obj as $key=>$value)
  16.     {
  17.         echo '<li>'.$key.': '.$value.'</li>';
  18.     }
  19.     echo '</ul>';
  20. }
  21.  
  22. $projects = $xplanner->getProjects();
  23. foreach ($projects as $project)
  24. {
  25.     echo '<h1>'.$project->name.'</h1><p>'.$project->description.'</p>';
  26.     $iterations = $xplanner->getIterations($project->id);
  27.     foreach($iterations as $iteration)
  28.     {
  29.         echo '<h2>'.$iteration->name.'</h2><p>'.$iteration->description.'</p>';
  30.         dump_props($iteration);
  31.         $stories = $xplanner->getUserStories($iteration->id);
  32.         foreach($stories as $story)
  33.         {
  34.             echo '<h3>'.$story->name.'</h3><p>'.$story->description.'</p>';
  35.             dump_props($story);
  36.             $tasks = $xplanner->getTasks($story->id);
  37.             foreach ($tasks as $task)
  38.             {
  39.                 echo '<h4>'.$task->name.'</h4><p>'.$task->description.'</p>';
  40.                 dump_props($task);
  41.             }
  42.         }
  43.     }
  44. }
  45. ?>

References:

Bookmark and Share

Related posts:

  1. WSDL to PHP – Generate PHP code from a WSDL file There are many classes available to generate a WSDL file...
  2. In search for a project management system, again! I was in search of a good project management system...
  3. Reports module for activeCollab launched Our new venture - appsMagnet - released its first product...

Written by Nirav

December 26th, 2008 at 6:40 pm

Posted in PHP

Tagged with , , ,

 

Leave a Reply