Page 1 of 1

add new function in SOAP

Posted: 05 Jul 2011, 07:04
by monn
Hi All,

I'm trying to add new function in SOAP but it returning me an error :
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] unable to serialize result
Can anyone please guide me of how to add new function in SOAP?
so far my codes are :

bug_api

Code: Select all

//attask task id
function bug_get_mantis_by_attask_id($attask_id){

    $sql = 'SELECT * FROM mantis_attask_table WHERE attask_id ="' . $attask_id .'"';
    $result = db_query($sql);
    $rows = db_fetch_array($result);

    return $rows;   
}
mc_issue_api

Code: Select all

function mc_attask_exists( $p_username, $p_password, $p_attask_id ) {
	$t_user_id = mci_check_login( $p_username, $p_password );
	if( $t_user_id === false ) {
		return mci_soap_fault_login_failed();
	}

    $attask_bug_info = bug_get_mantis_by_attask_id( $p_attask_id );


	if( count($attask_bug_info) != 0 ) {
		return $attask_bug_info;
	}

	return mci_null_if_empty($attask_bug_info);
}

mantisconnect

Code: Select all

### Attask mantis ID
$l_oServer->wsdl->addComplexType(
	'AttaskMantis',
	'complexType',
	'struct',
	'all',
	'',
	array(
        'id'                        =>	array( 'name' => 'id',                          'type' => 'xsd:string',     'minOccurs' => '0'),
		'mantis_bug_table_id'		=>	array( 'name' => 'mantis_bug_table_id',			'type' => 'xsd:string',     'minOccurs' => '0'),
        'attask_id'                 =>	array( 'name' => 'attask_id',                   'type' => 'xsd:string',     'minOccurs' => '0')
	)
);

### AttaskMantisArray
$l_oServer->wsdl->addComplexType(
	'AttaskMantisArray',
	'complexType',
	'array',
	'',
	'SOAP-ENC:Array',
	array(),
	array(array(
		'ref'				=> 'SOAP-ENC:arrayType',
		'wsdl:arrayType'	=> 'tns:AttaskMantis[]'
	)),
	'tns:AttaskMantis'
);


### mc_attask_exists
$l_oServer->register( 'mc_attask_exists',
	array(
		'username'	=>	'xsd:string',
		'password'	=>	'xsd:string',
		'attask_id'	=>	'xsd:string'
	),
	array(
		'return'	=>	'tns:AttaskMantis'
	),
	$t_namespace,
	false, false, false,
	'Check there exists an issue with the specified attask_id.'
);
Please help me and let me know what I missed.


Thanks

Re: add new function in SOAP

Posted: 05 Jul 2011, 08:00
by monn
any help?

Re: add new function in SOAP

Posted: 05 Jul 2011, 09:21
by atrol
A better place for this is the mailing list "MantisBT SOAP API development talk"
http://www.mantisbt.org/mailinglists.php

Re: add new function in SOAP

Posted: 11 Jul 2011, 02:13
by monn
Thanks Atrol.


Anyway I found the issue here. Turn Off Cache for SOAP in php.ini

Re: add new function in SOAP

Posted: 11 Jul 2011, 20:23
by atrol
I think disabling the cache is a good idea during development but will degrade performance in production systems.
Seems that you are not the first one who had to learn this lesson:
http://blog.utahcon.com/computers/code/ ... dl-caching

Re: add new function in SOAP

Posted: 14 Jul 2011, 09:10
by monn
atrol wrote:I think disabling the cache is a good idea during development but will degrade performance in production systems.
Seems that you are not the first one who had to learn this lesson:
http://blog.utahcon.com/computers/code/ ... dl-caching

Wow.. thanks for the blog atrol. Yeah in development my cache is disabled so every changes show the effect at once
and in prod it is enabled to fasten the request.