JIRA+PHP SOAP Client

1.jira配置要求

参照Url: http://confluence.atlassian.com/display/JIRA/Creating+a+SOAP+Client

2.权限Check
1. does the intended developer have the permission to be assigned issues?
2. does the Jira Administrator has the permission to assign issues? (remember, a Jira Admin can administrate the system, it does not necessarily grant any rights in projects...)
3. I'm not so sure about this one, but I think for SOAP to set a field, you might have to have the field on the "Create" screen.
Simple way to test this - log in as the Jira Admin user and click "create" and check what appears in the "assignee" field...

3.create issue
在创建页面需显示创建issue时必要的field。
备注:如果不显示assignee的选项,在soap中不能修改assignee,显示为默认项目负责人。同时创建用户需要assgin权限。
	<?php
		// Jira WSDL
		$wsdl = “http://localhost:8080/rpc/soap/jirasoapservice-v2?wsdl”;
	
		// Login info
		$login = “admin”;
		$password = “111111”;
	
		// Create the soap Client
		$client = new soapclient($wsdl);
	
		// Login to Jira
	 	$login = $client->login( $login,$password);
	 	
	 	$project = "CHECKING";
	 	$type = 6;
	 	$date = date('Ymd');
	 	$detailUrl = JIRA_DETAIL_URL;
		$userName = “test”;
		$remoteIssue = array(array ("customfieldId"=>"customfield_10050", "values"=>array (“test0”)),
								array ("customfieldId"=>"customfield_10123", "values"=>array (“test1”)),
								array ("customfieldId"=>"customfield_10167", "values"=>array (“test2”)));

		$issue = array(
				"project" => $project,
	            "type" =>3,
	            "summary" => 	“TESTDEMO”,
				"assignee"=>$userName,
				"reporter"=>$login,
	     	    "customFieldValues" => $remoteIssue
	           );
			
		//  Create the Issue
		$remoteIssue = $client->createIssue( $login,$issue);
		
		// Add attachment
		$attachment_file =”d:\\1.txt”;
			$content = base64_encode(file_get_contents($attachment_file));
			$attachmentName = basename($attachment_file);
			$result = $client->addBase64EncodedAttachmentsToIssue($login, $remoteIssue->key, array($attachmentName), array($content) );
   ?>

你可能感兴趣的:(PHP,SOAP)