`

JIRA+PHP SOAP Client demo I

    博客分类:
  • jira
阅读更多
<?

try
{	// Jira WSDL
	$wsdl = "http://localhost:8080/rpc/soap/jirasoapservice-v2?wsdl";

	// Login info
	//$login = "admin";
	//$password = "111111";
	$login = "test1";
	$password = "test1";
	// Create the soap Client
	$client = new soapclient($wsdl);

	// Login to Jira
 	$login = $client->login( $login,$password);


	// Custom Field Array
	$remoteIssue[0] = array ("customfieldId"=>"customfield_10010", "values"=>array ("MAIN"));
	$remoteIssue[1] = array ("customfieldId"=>"customfield_10011", "values"=>array ("Component Name"));
	$remoteIssue[2] = array ("customfieldId"=>"customfield_10012", "values"=>array ("Force creation of Complete Release"));
	$remoteIssue[3] = array ("customfieldId"=>"customfield_10013", "values"=>array ("View:"));

	$issue = array(
			"project" => "JIRASOAP",
            "type" =>3 ,
            "summary" => "Test22222: Issue created via PHP/SOAP",
			"assignee"=>"test",
			"description"=>"samples Test!",
			"reporter"=>"admin",
		  //"attachmentNames"=>'1.txt'
     	  //  "customFieldValues" => $remoteIssue
           );

	//  Create the Issue
	$remoteIssue = $client->createIssue( $login,$issue);
	
	//$content = base64_encode(file_get_contents($attachment_file));
	//$attachment_file = basename($attachment_file);
	//JIRAInterface::getClient()->addAttachmentsToIssue(JIRAInterface::getLogin(), $ticket_id, $attachment_file, $content);
	
	//$content = base64_encode(file_get_contents('1.txt'));
	//$attachment_file = basename('1.txt');
	//$client->addAttachmentsToIssue($login, 'JIRASOAP-10', $attachment_file, $content);
	
	//$client->addAttachmentsToIssue($token,'JIRASOAP-10', array('attach1'), array(base64_encode($fileData)));

	//$remoteProject = $client->getProjectByKey( $login,'JIRASOAP' );

	// Log out
	$logout = $client->logout($login);
	if($logout ==  TRUE){
		echo 'Logged out';
	}else{
	 	echo '<br>Failed to logout';
	}

}catch(Exception $e){
	echo 'Error Caught';
	echo '<br>'.$e;
}
?>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics