简体   繁体   English

吉拉肥皂与PHP

[英]Jira Soap with a Php

I have seen little to know instruction on using php to develop a client website to make remote calls to JiRA. 我对使用php开发客户端网站以远程调用JiRA的指示知之甚少。

Currently I'm trying to make a soap client using JSP/Java to connect to a local jira instance. 目前,我正在尝试使用JSP / Java制作肥皂客户端以连接到本地jira实例。 I would like to create and search issues that is all. 我想创建和搜索所有问题。 We are currently having some problems using Maven2 and getting all the files we need from the repository since we are behind a major firewall(yes I've used the proxy). 由于使用了Maven2,我们目前遇到一些问题,因为我们位于主要的防火墙后面(是的,我已经使用了代理),因此无法从存储库中获取所需的所有文件。

I have a lot of experience with PHP and would like to know if using the PHP soapclient calls can get the job done. 我在PHP方面有很多经验,想知道使用PHP soapclient调用是否可以完成这项工作。

http://php.net/manual/en/soapclient.soapclient.php http://php.net/manual/zh/soapclient.soapclient.php

Yes it can be done, using SOAP or XML-RPC . 是的,可以使用SOAPXML-RPC来完成。

Using the APIs is pretty much straight forward - have a look at the API documentation to find the right functions for you. 使用API​​非常简单-请查看API文档以找到适合您的功能。 your code should look something like : 您的代码应类似于:

<?
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
...  
... # get/create/modify issues
... 
?>

Example of adding a new comment: 添加新评论的示例:

$issueKey = "key-123";
$myComment = "your comment";

$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$soapClient->addComment($token, $issueKey, array('body' => $myComment));

Example of creating an issue: 创建问题的示例:

$issue = array(
    'type'=>'1',
    'project'=>'TEST',
    'description'=>'my description',
    'summary'=>'my summary',
    'priority'=>'1',
    'assignee'=>'user',
    'reporter'=>'user',
);
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$soapClient->createIssue($token, $issue);

Note that you need to install php-soap in linux (or it's equivalent in windows) to be able to use the SOAP library. 请注意,您需要在linux中安装php-soap (或在Windows中等效),才能使用SOAP库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM