Page 1 of 1

SOAP API - mc_issue_add - doesn't like reporter id

Posted: 11 Jun 2014, 14:44
by sketa
I am using the mc_issue_add api to add new issues to mantis. The thing is that I am storing the reporter's id in the $uid variable. When I use the code below, it returns an error. If I remove the 'reporter'=>array('id'=>$uid), line, it works just fine. Any suggestions would be appreciated.

Code:

Code: Select all

$issue = array ( 
                    'summary' => $summary, 
		    'reporter'=>array('id'=>$uid),
                    'description' => $descr, 
                    'project'=>array('id'=>$pid),
                    'category'=>'General',
		    'version'=>$pversion,
                    'custom_fields'=>array(
                                        array('field' => array('id'=>1,'name'=>'Reporter Name'),'value'=>$urealname),
                                        array('field' => array('id'=>3,'name'=>'Page Filename'),'value'=>$pg)
                                    )
                    );
$bid = $mantisClient->mc_issue_add($username, $password, $issue);
Error with the reporter line:

Code: Select all

<br />
<b>Fatal error</b>:  Uncaught SoapFault exception: [SOAP-ENV:Server] Error Type: APPLICATION ERROR #401,
Error Description: Database query failed. Error received from database was #0: [Microsoft][ODBC SQL Server Driver]Invalid parameter number for the query: 
			SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
			FROM mantis_custom_field_project_table p
				INNER JOIN mantis_custom_field_table f ON f.id = p.field_id
				LEFT JOIN mantis_custom_field_string_table s
					ON s.field_id = p.field_id AND s.bug_id = ?
			WHERE p.project_id = ?
			ORDER BY p.sequence ASC, f.name ASC. in C:\~HIDDEN~\includes\savecomment.php:147
Stack trace:
#0 C:\~HIDDEN~\includes\savecomment.php(147): SoapClient->__call('mc_issue_add', Array)
#1 C:\~HIDDEN~\includes\savecomment.php(147): SoapClient->mc_issue_add('aviewer', 'W76d!ffr+5#i4J...', Array)
#2 {main}
  thrown in <b>C:\~HIDDEN~\includes\savecomment.php</b> on line <b>147</b><br />
EDIT/UPATE:
One thing is that even with the above error, the data/information is submitted to mantis correctly and the issue is created. It is just that the call does not return the bug/issue ID.

Re: SOAP API - mc_issue_add - doesn't like reporter id

Posted: 13 Jun 2014, 06:20
by atrol
I recommend to write also to mantisbt-soap-dev mailing list for such kind of questions
http://www.mantisbt.org/mailinglists.php

Re: SOAP API - mc_issue_add - doesn't like reporter id

Posted: 13 Jun 2014, 19:37
by paul
Hi Sketa,

From the error message you receive, it looks like you are using MSSQL - I personally run MSSQL with Mantis in production at work, and have been a developer on mantis for the last 10 years. It is a known issue that support for non-MySQL is problematic in the current release - we are planning to fix this properly by replacing the current database layer shortly after the 1.3 release ( I've been told previously by others in the team we can aim to do with within a month of the 1.3 release), so for now, you may be better off using MySQL or manually patching the issue.

I've been using the following text on the bug tracker for issues relating to other databases:

MantisBT currently supports Mysql and has support for other database engines.

The support for other databases is known to be problematic.

Having implemented the current database layer into Mantis 10 years ago, I'm currently working on replacing the current layer.

If you are interested in using Mantis with non-mysql databases - for example, Oracle, PGSQL or MSSQL, and would be willing to help out testing the new database layer, please drop me an email at paul@mantisforge.org

In the meantime, I'd advise running Mantis with Mysql Only to avoid issues.

Thanks
Paul