using mantisconnect from a php script

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
jramirez
Posts: 2
Joined: 26 May 2008, 06:16

using mantisconnect from a php script

Post by jramirez »

In mantis 1.1.1 version, I'm trying to test mantisconnect creating my own php script, but I can't find any example of how to use it, and the standards nusoap examples are not working.
I have tried creating a test.php with the following code:
<?
include('api/soap/nusoap/nusoap.php');
$url = 'api/soap/mantisconnect.php';
$soapclient = new soapclient($url);
$function = 'mc_version';
$params = array('name' => 'Pepe');
$result = $soapclient->call( $function , $params );
echo $result;
?>

But I get this error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.mantisbt.org/bugs/api/soap/mantisconnect.php' in /var/www/apache2-default/test.php:7 Stack trace: #0 /var/www/apache2-default/test.php(7): SoapClient->SoapClient('http://www.mant...') #1 {main} thrown in /var/www/apache2-default/test.php on line 7
giallu
Posts: 20
Joined: 06 Feb 2008, 11:34

Re: using mantisconnect from a php script

Post by giallu »

This works for me:

Code: Select all

<?php
  require_once('nusoap.php');

  $endpoint = "http://www.mantisbt.org/bugs/api/soap/mantisconnect.php";

  $client = new soapclient($endpoint);

  $result = $client->call('mc_version',array());
  print_r($result);
output is "1.2.0a1"
nourdine
Posts: 9
Joined: 04 Aug 2011, 08:39

Re: using mantisconnect from a php script

Post by nourdine »

hi !

I have test your example in my local machine
an have this error


PHP Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/mantis/api/soap/mantisconnect.php' : Extra content at the end of the document
in /var/www/mantis/test.php:4
Stack trace:
#0 /var/www/mantis/test.php(4): SoapClient->SoapClient('http://localhos...')



thanks by advance
snapple42

Re: using mantisconnect from a php script

Post by snapple42 »

I'm playing this a bit..

You need to add "?wsdl" to the end of the url..

Now I'm getting different errors!
nourdine
Posts: 9
Joined: 04 Aug 2011, 08:39

Re: using mantisconnect from a php script

Post by nourdine »

Hi,
Please Expain me where to put this code, in order to test iti



Thanks By Adavance
Nourdine Chabane
Post Reply