add new function in SOAP

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
monn
Posts: 17
Joined: 16 Feb 2011, 03:20

add new function in SOAP

Post 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
monn
Posts: 17
Joined: 16 Feb 2011, 03:20

Re: add new function in SOAP

Post by monn »

any help?
atrol
Site Admin
Posts: 8536
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: add new function in SOAP

Post by atrol »

A better place for this is the mailing list "MantisBT SOAP API development talk"
http://www.mantisbt.org/mailinglists.php
Please use Search before posting and read the Manual
monn
Posts: 17
Joined: 16 Feb 2011, 03:20

Re: add new function in SOAP

Post by monn »

Thanks Atrol.


Anyway I found the issue here. Turn Off Cache for SOAP in php.ini
atrol
Site Admin
Posts: 8536
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: add new function in SOAP

Post 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
Please use Search before posting and read the Manual
monn
Posts: 17
Joined: 16 Feb 2011, 03:20

Re: add new function in SOAP

Post 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.
Post Reply