IHttpRequest RequestBuilder don't use the good ContentTy

Posted by Samuel ETTERLEN on 21-Sep-2016 05:00

Hi There,

I'm Trying to call a WebServices like this:

oRequest = RequestBuilder:Post(substitute("&1/Kinetic.Services.StreamService.svc",cWindreamServerAdresse), oRequestBody)
:ContentType ('text/xml;charset=UTF-8')
:AddHeader ('SOAPAction', 'services.kinetic.ch/.../DownloadFile')
:AddHeader ('Accept-Encoding', 'gzip,deflate')
:AddHeader ('Connection', 'Keep-Alive')
:Request.

When I take a look to the HTTP-Stream, I see that the ContentType value is set to "text/xml; charset=ISO-8859-1" instead of "text/xml; charset=UTF-8".

If I change my code to : ContentType ('text/html;charset=UTF-8'), then the ContentType in the HTTP-Stream is set to the good value.

Did somebody already experience this case ? Have somebody a workaround ?

All Replies

Posted by Brian K. Maher on 21-Sep-2016 05:06

Why aren’t you using the regular Web Services functionality?

Posted by marian.edu on 21-Sep-2016 05:28

What kind of ‘body’ is the oRequestBody? Maybe the encoding of xml document is actually iso-8859-1.


Marian Edu

Acorn IT 
+40 740 036 212

Posted by Samuel ETTERLEN on 21-Sep-2016 06:14

I can't use the regular Web Services functionality, while my web-service give me an DTOM Response...

I've any xml document for the header, i've wrote in directly like this:

cResponse = '<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../" xmlns:ser="services.kinetic.ch/">'  + CRLF +

              '<soapenv:Header>' + CRLF +

              '<ser:FileId>' + cFileId + '</ser:FileId>' + CRLF +

              '</soapenv:Header>' + CRLF +

              '<soapenv:Body/>'+ CRLF +  

              '</soapenv:Envelope>'.

oRequestBody = new string(cResponse) .

oRequest = RequestBuilder:Post(substitute("&1/Kinetic.Services.StreamService.svc",cWindreamServerAdresse), oRequestBody)

                        :ContentType    ('text/xml;charset=UTF-8')

                        :AddHeader      ('SOAPAction', 'services.kinetic.ch/.../DownloadFile')

                        :AddHeader      ('Accept-Encoding', 'gzip,deflate')                        

                        :AddHeader      ('Connection', 'Keep-Alive')                        

                        :Request.

The complet HTTP-REQUEST look like this:

POST /KineticServices/Kinetic.Services.StreamService.svc HTTP/1.1

Connection: close

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=iso-8859-1

SOAPAction: "services.kinetic.ch/.../DownloadFile"

Content-Length: 269

Host: svr-de-windrea2.ivnet.ch

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../" xmlns:ser="services.kinetic.ch/">

  <soapenv:Header>

     <ser:FileId>add92c5f-9ebd-4b40-9547-1c61da5fc6f1</ser:FileId>

  </soapenv:Header>

  <soapenv:Body/>

</soapenv:Envelope>

Posted by Brian K. Maher on 21-Sep-2016 06:22

Oh, okay.

Posted by marian.edu on 21-Sep-2016 06:26

Does it make any difference if instead of the character variable you use a longchar one and do fix-codepage on it with utf-8 before? 



Marian Edu

Acorn IT 
+40 740 036 212

Posted by Samuel ETTERLEN on 21-Sep-2016 06:52

with fix-codepage it work ! Thanks a lot !

This thread is closed