【问题标题】:Programmatically create issue in Mantis以编程方式在 Mantis 中创建问题
【发布时间】:2015-03-10 04:34:57
【问题描述】:

我正在编写将运行多个命令的小型 node.js 脚本,如果任何一个命令失败,它将报告关于mentis 的问题。我正在使用以下代码报告 mantis bugtracker 中的问题。 Mantis bug tracker 带有一堆 SOAP api 来做这样的事情。 http://www.mantisbt.org/bugs/api/soap/mantisconnect.php?wsdl#op.idp90022480

var soap = require('soap');
  var url = 'http://localhost/mantisbt-1.2.19/api/soap/mantisconnect.php?wsdl';
  var user = 'administrator';
  var password = 'root';
  var args = {
        username: user, 
        password: password,         
        project: {
            id: 1
        },
        category: 'General',
        summary: 'Test summary', 
        description: 'test description'
    };  

  soap.createClient(url, function(err, client) {

      client.mc_issue_add(args, function(err1, result) {
        if(err1)
            console.log( err1 );
        else
            console.log('Issue successfully created');
      });

  });

但我收到以下错误日志:

<faultstring>Project \'\' does not exist.</faultstring>

我有一个 id 为 1 的项目,我可以使用 php 创建具有相同数据的问题。我的理解是项目 ID 没有正确发送。等效的php代码如下。

$c = new SoapClientDebug("http://localhost/mantisbt-1.2.19/api/soap/mantisconnect.php?wsdl", ['trace' => true]);

$username = 'administrator';
$password = 'root';
$issue = array ( 
    'summary' => 'PHP test issue', 
    'description' => 'PHP test description', 
    'project'=> array(      
        'id'=>1     
    ), 
    'category'=>'General',
);
$c->mc_issue_add($username, $password, $issue);

php 代码功能正常。

【问题讨论】:

    标签: node.js soap soap-client


    【解决方案1】:

    你的参数应该是这样的:

    var args = {
        username: user, 
        password: password,
        issue: {         
          project: {
            id: 1
          },
          category: 'General',
          summary: 'Test summary', 
          description: 'test description'
        }
    };  
    

    【讨论】:

      猜你喜欢
      • 2012-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多