You are here: Chapter 11: FootPrints API > FootPrints Web Services API > Sample Code > php Samples

php Samples

The following samples show how to access FootPrints Web Services using php.

create_issue.php

<h2>Web Service Test - create new issue</h2>

<?

try {

$client = new SoapClient(NULL,

   array(

"location"=>"http://some.server.com/MRcgi/MRWebServices.pl",

"uri"=>"MRWebServices",

"style"=>SOAP_RPC,

        "use" => SOAP_ENCODED       

   )

);

$issue_number = $client->MRWebServices__createIssue("WebServices",'myPassword','',

array(projectID =>99,

       title=>"Test Issue creation.",

                              status=>"Open" ,

                      priorityNumber => 3,

                      description => "This is a test"

              )

);

print "<BR><b> Issue created; Issue number = $issue_number</b><br><hr>\n";

 

 } catch (SoapFault $exception) {

print "ERROR! - Got a SOAP exception:<br>";

echo $exception;             

 }

?>

edit_issue.php

<h2>Web Service Test - edit issue #1</h2>

<?

try {

$client = new SoapClient(NULL,

   array(

"location"=>"http://some.server.com/MRcgi/MRWebServices.pl",

"uri"=>"MRWebServices",

"style"=>SOAP_RPC,

        "use" => SOAP_ENCODED       

   )

);

$issue_number = $client->MRWebServices__editIssue("WebServices",'myPassword','',

array(

projectID =>99,

       title=>"NEW: editing Test Issue from WebService.",

mrID =>1,

                  priorityNumber => 2,

                  description => "Changing priority to 2"

            )

);

print "<BR><b> Issue changed;<hr>\n";

 

 } catch (SoapFault $exception) {

print "ERROR! - Got a SOAP exception:<br>";

echo $exception;             

 }

?>

get_issue_dets.php

<h2>Web Service Test - get issue #1 details</h2>

<?

try {

$client = new SoapClient(NULL,

   array(

"location"=>"http://some.server.com/MRcgi/MRWebServices.pl",

"uri"=>"MRWebServices",

"style"=>SOAP_RPC,

        "use" => SOAP_ENCODED       

   )

);

$iss_details = $client->MRWebServices__getIssueDetails("WebServices",'myPassword','','99',"1");

print "<b>Issue details:</b><br>";

print "<pre>";

print_r($iss_details );

print"</pre><br>\n";

 

 } catch (SoapFault $exception) {

print "ERROR! - Got a SOAP exception:<br>";

echo $exception;             

 }

?>

search.php

<h2>Web Service Test - search</h2>

<?

try {

$client = new SoapClient(NULL,

   array(

"location"=>"http://some.server.com/MRcgi/MRWebServices.pl",

"uri"=>"MRWebServices",

"style"=>SOAP_RPC,

        "use" => SOAP_ENCODED       

   )

);

$issues = $client->MRWebServices__search("WebServices",'myPassword','',

"select mrID, mrTITLE from MASTER99 WHERE lower(mrTITLE) LIKE 'test%'");

print "<BR><b> Search:<hr><br>\n";

print "<pre>";

print_r($issues);

print"</pre><br>\n";

 } catch (SoapFault $exception) {

print "ERROR! - Got a SOAP exception:<br>";

echo $exception;             

 }

?>