View Issue Details

IDProjectCategoryView StatusLast Update
0016252mantisbtapi soappublic2014-02-07 18:24
Reporterzrybola Assigned Torombert  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.15 
Target Version1.2.16Fixed in Version1.2.16 
Summary0016252: API SOAP provides no answer after MantisBT upgrade
Description

Recently, I have upgraded MantisBT from 1.2.4 to 1.2.15. This update includes also API SOAP upgrades.

We have a Java client using the SOAP webservice of Mantis to create bugs and get project users. However, after the upgrade, the webservice provides no answer for the call of any of the services.

To keep my application running after the MantisBT updade, I have had to use the old SOAP API of MantisBT 1.2.4.

Does anyone have any idea why the current MantisBT 1.2.15 SOAP API does not work?

Steps To Reproduce

I have used SoapUI to test the webservice. I tested the webservice calling the service mc_project_get_users. When calling the endpoint of the old Mantis 1.2.4 SOAP API I got the correct answer with the following headers:

X-SOAP-Server NuSOAP/0.9.5 (1.123)
Date Tue, 06 Aug 2013 08:08:15 GMT
Content-Length 649
#status# HTTP/1.1 200 OK
Last-Modified Mon, 31 Jan 2011 12:10:02 GMT
Content-Encoding gzip
Connection close
Content-Type text/xml; charset=UTF-8
Server Apache/2.2.3 (CentOS)
X-Powered-By PHP/5.1.6
Cache-Control private, max-age=10800, pre-check=10800

However, when calling the endpoint of the new MantisBT 1.2.15 SOAP API there is no answer and the headers are like this:

Date Tue, 06 Aug 2013 08:08:55 GMT
Content-Length 0
#status# HTTP/1.1 200 OK
Last-Modified Fri, 12 Apr 2013 07:37:02 GMT
Connection close
Content-Type text/html; charset=UTF-8
Server Apache/2.2.3 (CentOS)
X-Powered-By PHP/5.1.6
Cache-Control private, max-age=10800, pre-check=10800

Additional Information

We use MantisBT 1.2.15.

We use MantisConnect for Java 1.1.1.1 (mantisconnect-client-api-1.1.1.1-src.zip) as it is the most recent version available at the MantisConnect website. This means no change since the last deployment.

We use PHP 5.1.6 on httpd-2.2.3.

TagsNo tags attached.

Activities

rombert

rombert

2013-08-06 05:11

reporter   ~0037625

Please don't use MantisConnect as it's not affiliated with this project and AFAIK not maintained.

If you use Java, you can either generate your own stubs using your tool of choice or reuse the ones from http://search.maven.org/#search|gav|1|g%3A%22biz.futureware.mantis%22%20AND%20a%3A%22mantis-axis-soap-client%22 ( Axis 1 ).

Please let me know if you still have problems after switching from MantisConnect.

zrybola

zrybola

2013-08-06 06:23

reporter   ~0037627

Thank you very much for that information. I did not find it anywhere. I will try the mantis-axis-soap-client in version 1.2.9 and let you know.

zrybola

zrybola

2013-08-06 06:31

reporter   ~0037628

However, the problem does not seem to reside in the API client. I am not even able to call the service using SoapUI to test the API. The answer of the PHP webservice is empty as can be seen in the headers in "steps to reproduce".

When I call the service on the previous version 1.2.4 I got the users. When I call the service on the current version 1.2.15, I do get nothing.

atrol

atrol

2013-08-06 07:38

developer   ~0037630

Try adding the following line to mc_config_inc.php (create it if it doesn't exist in same directory where you find mc_config_defaults_inc.php)
$g_mc_use_nusoap = ON;

zrybola

zrybola

2013-08-06 08:47

reporter   ~0037632

I created the file mc_config_inc.php in the api/soap directory and added a line $g_mc_use_nusoap = ON;

I tried to call the service using the SoapUI and the result is not empty anymore. However, it returns exactly the content of the mc_config_inc.php file.

atrol

atrol

2013-08-06 08:49

developer   ~0037633

Change the file to
<?php
$g_mc_use_nusoap = ON;

zrybola

zrybola

2013-08-06 09:40

reporter   ~0037634

I am sorry, I forgot about the starting PHP tag :-)

Now the API seems to work. I get the answer using both the SoapUI and the application of ours.

Thank you very much for your help.

atrol

atrol

2013-08-06 12:03

developer   ~0037636

Last edited: 2013-08-06 12:03

@zrybola, I recommend to use a newer PHP version.
You should remove mc_config_inc.php after the upgrade and check if it works.
It should work and the SOAP API should work faster.

@rombert
it seems that there is a problem with soap extension in older versions of PHP (zrybola uses 5.1.6)

Of course there are differences between PHP versions, e.g.
http://www.php.net/manual/de/book.soap.php#90379

Maybe we should restrict usage of the SOAP extension to PHP versions >= 5.3?

dregad

dregad

2013-08-06 16:27

developer   ~0037637

Based on atrol's comment, maybe it would be good to improve the test to set soap default to php-soap only if php >= 5.3 [1]

[1] https://github.com/mantisbt/mantisbt/blob/master-1.2.x/api/soap/mc_config_defaults_inc.php#L57

rombert

rombert

2013-08-07 15:15

reporter   ~0037642

I agree, but I'd rather test this and see what goes on. PHP 5.1.6 sounds like Centos/RHEL 5, which is still a pretty widely used platform and I would like to see the soap extension working on that.

rombert

rombert

2013-08-07 16:43

reporter   ~0037643

By running SOAP tests against a Centos5 VM I notice the following error in the logs

PHP Fatal error: Uncaught SoapFault exception: [Server] Error Type: SYSTEM NOTICE,\nError Description: Use of undefined constant SOAP_USE_XSI_ARRAY_TYPE - assumed 'SOAP_USE_XSI_ARRAY_TYPE' in /var/www/html/mantisbt/api/soap/mc_api.php:107\nStack trace:\n#0 /var/www/html/mantisbt/api/soap/mc_api.php(530): SoapActions::sendSoapFault('Server', 'Error Type: SYS...')\n#1 /var/www/html/mantisbt/api/soap/mantisconnect.php(120): mc_error_handler(8, 'Use of undefine...', '/var/www/html/m...', 120, Array)\n#2 {main}\n thrown in /var/www/html/mantisbt/api/soap/mc_api.php on line 107

According to the changelog ( http://php.net/ChangeLog-5.php#5.2.2 ) this constant was first added in PHP 5.2.2. To be on the safe side, I've added a defined() check for this constant in addition to checking for the soap extension being available. Although I think it's enough to check just for the constant but I can't be 100% sure.

atrol

atrol

2013-08-07 17:01

developer   ~0037644

The check for master is not needed as we have PHP 5.3.2 as minimum required PHP version.
https://github.com/mantisbt/mantisbt/blob/master/core/php_api.php#L33

Related Changesets

MantisBT: master-1.2.x 1f1ce77f

2013-08-07 12:43

rombert


Details Diff
soap api: make sure we have a compatible soap extension installed

Even though the soap extension is installed, versions of PHP older than
5.2.2 do not support all the features we need. To guard against
unexpected errors, we now enable the soap extension if the
SOAP_USE_XSI_ARRAY_TYPE constant is defined. This constant is used at
runtime by the SOAP extension and is a good indicator of a recent enough
soap extension.

Fixes 0016252: API SOAP provides no answer after MantisBT upgrade
Affected Issues
0016252
mod - api/soap/mc_config_defaults_inc.php Diff File

MantisBT: master 16a6139c

2013-08-07 12:43

rombert


Details Diff
soap api: make sure we have a compatible soap extension installed

Even though the soap extension is installed, versions of PHP older than
5.2.2 do not support all the features we need. To guard against
unexpected errors, we now enable the soap extension if the
SOAP_USE_XSI_ARRAY_TYPE constant is defined. This constant is used at
runtime by the SOAP extension and is a good indicator of a recent enough
soap extension.

Fixes 0016252: API SOAP provides no answer after MantisBT upgrade
Affected Issues
0016252
mod - api/soap/mc_config_defaults_inc.php Diff File