Problem of format after POST to a webservice

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Problem of format after POST to a webservice

Post by bangkok » Tue Jun 05, 2012 3:05 pm

I send successfully a query to a webservice with a POST command.

Here are the raw data sent back by the webservice :

Code: Select all

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Tue, 05 Jun 2012 13:40:26 GMT

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" [.... SOAP stuff]

<resultXml xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?><RESULT><GRP ID="G1"><FLD NAME="SOHNUM" TYPE="Char">NOR1203END00058</FLD></GRP><GRP ID="G2"><FLD NAME="SOHTYP" TYPE="Char">NOR</FLD><FLD NAME="SALFCY" TYPE="Char">END</FLD><FLD NAME  [. etc ...]
althought they are ok in the SOAP header..
" are not displayed as "
> are not displayed as >
.... in the <resultXml xsi:type="xsd:string">

Furthemore, i receive strings with accentued characters (like "référence transformed in r&#xE9;f&#xE9;rence )

I've tried :
set the htmltext... no effect
the unidecode.... no effect

If i open such a file with Firefox or Internet Explorer, everything looks fine. Any idea ?

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Problem of format after POST to a webservice

Post by shaosean » Tue Jun 05, 2012 4:39 pm

Check out the URLDecode function..

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Problem of format after POST to a webservice

Post by bangkok » Tue Jun 05, 2012 7:11 pm

shaosean wrote:Check out the URLDecode function..
I did.

But

Code: Select all

put urldecode("TYPE="Char">")
doesn't change the string.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Problem of format after POST to a webservice

Post by mwieder » Tue Jun 05, 2012 7:38 pm

No, sorry, urldecode() doesn't change the "&xxx;" forms - it translates the "%NN" forms and changes "+" to spaces. Yo have to handler the "&" forms yourself with replace commands.

...or take the easy way out using an intermediate field to do the conversion:

set the htmlText of field "fldOutput" to tInputStream
put field "fldOutput" into tConvertedStream

Post Reply