PDA

View Full Version : QT + axis2c



clebail
5th September 2012, 09:23
I'm using axis2c to create a webservices client that use message like this :


<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
</soap:Header>
<soap:Body>
<m:CAS xmlns:m="http://www.example.org/ca">
<m:CA>
<m:Periode>2012-01</m:Periode>
<m:amount>189.23</m:amount>
</m:CA>
<m:CA>
<m:Periode>2012-02</m:Periode>
<m:amount>259.74</m:amount>
</m:CA>
<m:CA>
<m:Periode>2012-03</m:Periode>
<m:amount>895.1</m:amount>
</m:CA>
</m:CAS>
</soap:Body>
</soap:Envelope>


It work very well, in my console I can see :


2012-01: 189.23
2012-02: 259.74
2012-03: 895.10


When I include my code in Qt, the result :


2012-01: 189,00
2012-02: 259,00
2012-03: 895,00


The decimal symbol was changed and the decimal part has been deleted !

I think is problem of Locale.

Does the Qt Locale is different from the System Locale ?

It is possible to deactive the use of Qt Locale before call my WS ?

Thank

Corentin

high_flyer
5th September 2012, 09:32
Have you tried the docs?
QLocale

clebail
5th September 2012, 09:50
I did not read it great ...

I think a :


QLocale::setDefault(QLocale::C);


In the start of my code will resolve the problem.
I will try it tomorow.

Thank

clebail
6th September 2012, 09:30
QLocale::setDefault(QLocale::C);

Don't work !

The axis2c library is a pure C library, it does not work with QLocale, the C function setlocale must be used instead.
So I've added this code in the constructor of my class that uses axis2c and everything works fine ! :)


setlocale (LC_NUMERIC, "C");