View Issue Details

IDProjectCategoryView StatusLast Update
0012971mantisbtapi soappublic2019-12-13 18:06
ReporterMagicBuzz Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product Version1.2.5 
Summary0012971: mc_projects_get_user_accessible() produce inconsistant encoded strings
Description

When you send a wrong login/password threw the mc_projects_get_user_accessible() method, the it returns an error message using an iso-8856-1 encoding while the webservice announce utf-8 encoding.

It's blocking for .NET devs as the .NET support of webservices fail and the message error from the webservice is not usable.

TagsNo tags attached.
Attached Files
MantisCrash.7z (59,433 bytes)

Activities

rombert

rombert

2011-05-03 17:25

reporter   ~0028742

This sounds pretty annoying. I assume that you mean ISO-8859-1, right? If that is the case, how do you detect the string encoding? AFAIK it only uses characters which overlap with the UTF-8 encoding.

MagicBuzz

MagicBuzz

2011-05-04 02:38

reporter   ~0028744

Last edited: 2011-05-04 02:39

Hello,
You're right, it's ISO-8859-1.
Actually I absolutely don't know how .NET detects the characters encoding.
When my program sends wrong credentials, the webservice throw an exception that contains only this information :
Main Exception : Web service error.
Inner Exception : Wrong encoding detected in the webservice response.

I can't even read the webservice response at all.

PS : I'm using Mantis and my client program on a french computer, with french settings.
Higher ASCII characters like accents é, è, à, etc. are often making troubles when using differents encodings.

Exemple :
éèê

Could become, when mismatching encodings :
éèê

MagicBuzz

MagicBuzz

2011-05-04 03:10

reporter   ~0028745

I found this in class.nusoap_base.php (in the /library/nusoap folder) :

function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
// TODO: add an option to automatically run utf8_encode on $body and $headers
// if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
// one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1

It looks like the nusoap library has known problems when using UTF-8 encodings. The comments seems to say exactely what happens to me. May be there is an update ?

MagicBuzz

MagicBuzz

2011-05-04 04:10

reporter   ~0028747

The problem seems to be (dirty) fixed by changing two times two lines :

Line 151 in class.nusoap_base.php :

var $soap_defencoding = 'ISO-8859-1';
//var $soap_defencoding = 'UTF-8';

becomes :

//var $soap_defencoding = 'ISO-8859-1';
var $soap_defencoding = 'UTF-8';

And line 151 in nusoap.php :

var $soap_defencoding = 'ISO-8859-1';
//var $soap_defencoding = 'UTF-8';

becomes :

//var $soap_defencoding = 'ISO-8859-1';
var $soap_defencoding = 'UTF-8';

=> I don't have the inconsistent charset message anymore.

But now I get the problem 0012977

rombert

rombert

2011-05-04 15:08

reporter   ~0028752

I am having a hard time reproducing this since both Java and PHP implementations work just fine. Please provide a sample implementation in C# ( preferrably running under Mono ) which fails. It can be whichever is most convenient for you, e.g. a minimal SQL dump of the database and a SOAP invocation.

MagicBuzz

MagicBuzz

2011-05-05 08:04

reporter   ~0028755

I uploaded a simple project (source + binaries).

The seems not to be culture specific regarding the output I obtain when launching it on this server's webservices with en-US culture :


Choose the culture : fr-[F]R or en_[U]S
Changing culture to en-US.
Connecting to Mantis WebServices.
Connected to Mantis version 1.2.5.

Do you want to [D]isplay the error in the program, or make it [C]rash and see th
e error in a debuger ?
Error level 1 : Un problème s'est produit avec le code XML qui a été reçu du rés
eau. Pour plus d'informations, consultez l'exception interne..
Error level 2 : L'encodage dans la déclaration 'ISO-8859-1' ne correspond pas à
l'encodage du document 'utf-8'..

Hit any key to end the program.

rombert

rombert

2011-05-18 15:58

reporter   ~0028800

I've tried importing this into monodevelop but am unable to build the solution. The error ( repeated 57 times ) is

System.ServiceModel.XmlSerializerFormatAttribute' does not contain a definition forSupportFaults'

Any idea why that happens?

rombert

rombert

2011-05-19 17:35

reporter   ~0028804

Reminder sent to: vboctor

Victor, you should be the best person to look into this. Any thoughts about the .NET SOAP client problems?

rombert

rombert

2011-05-26 16:34

reporter   ~0028854

I've tried to reproduce with with plain Mono, but was unable to . Here's what I did

  • downloaded the WSDL file
  • ran wsdl mantis.wsdl
  • ran gmcs /target:library MantisConnect.cs -r:System.Web.Services
  • created a MonoDevelop solutionm imported the MantisConnect.dll
  • Ran the following program

           MantisConnect m = new MantisConnect();
Console.Out.WriteLine("Connected to MantisBT version " + m.mc_version());

        string userName = "toto";
        string password = "toto";

        ProjectData[] projects = m.mc_projects_get_user_accessible(userName, password);

        foreach ( ProjectData project in projects )
            Console.Out.WriteLine("User has access to project " + project.name);</pre>

The output is:

Connected to MantisBT version 1.2.5

Unhandled Exception: System.Web.Services.Protocols.SoapException: Access denied.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse (System.Net.WebResponse response, System.Web.Services.Protocols.SoapClientMessage message, System.Web.Services.Protocols.SoapExtension[] extensions) [0x0022c] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs:351
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x000b8] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs:379
at MantisConnect.mc_projects_get_user_accessible (System.String username, System.String password) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) MantisConnect:mc_projects_get_user_accessible (string,string)
at MantisBTMonoClient.MainClass.Main (System.String[] args) [0x0002c] in /home/robert/git-repos/MantisBT-Mono-Client/Main.cs:16

Which seems right to me. With a proper username/password I can also list the accessible projects.

rombert

rombert

2011-12-06 17:48

reporter   ~0030481

I've finally managed to install VS Express and look into this issue. I've reproduced the 'inconsistent' encoding problem, but managed to work around it by adding a 'Web Reference' instead of a 'Service Reference'. I've followed the steps at http://www.sanity-free.com/125/php_webservices_and_csharp_dotnet_soap_clients.html :

  • Add Service Reference
  • Click Advanced
  • Click Add Web Reference
  • Use the WSDL URL
  • Click Go

I now have a working web service client which works as expected. Please let me know if this works for you as well, I'd like to add it to the reference documentation.

atrol

atrol

2018-05-20 06:59

developer   ~0059873

Unassigned after a long time of inactivity.

dregad

dregad

2019-12-03 06:04

developer   ~0063167

Considering that this issue was reported on an old version of MantisBT and the problem seems related to the nusoap library which is no longer used in MantisBT since 1.3.0-beta.1 (see 0016444), I'm closing this issue. Feel free to reopen if the error can be reproduced in the latest version.