1. Cesar Albospino
  2. PowerBuilder
  3. Monday, 6 June 2022 18:17 PM UTC

hello all

We are using this code to call a WebService :
Please help 

lo_client = Create httpClient

lo_client.SetRequestHeader("Content-Type", "text/xml;charset=UTF-8")

lo_client.SetRequestHeader("SOAPAction", ls_soap_action)

lo_client.SetRequestHeader("Accept-Language", "es")

lo_client.SetRequestHeader("Content-Length", String(len(ls_xml_request) ))

lo_client.Timeout = 15

li_ret = lo_client.sendrequest('POST', ls_url, ls_xml_request, EncodingUTF8! )


Request :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsm="">









         <wsm:Cabecera>CENTRAL IMPORT SRL;80009876;5;;1;11;;;;1;;1;0;0;0;5;0;0.000000;0.000000;;fantástico ;;0</wsm:Cabecera>





when the cabecera have a text with accent like the sample we recieve the error Bad Request

if we use the same request just removing the accent in fantástico it works with no problems

using the same request in SOAPUI it works with no issues 



Arnd Schmidt Accepted Answer Pending Moderation
  1. Monday, 6 June 2022 22:16 PM UTC
  2. PowerBuilder
  3. # 1

Hello Cesar,

the submitted Content-Length is not correct if your are using some "special" characters.

Remember UTF-8 is not fixed sized per character. The content-length has to be the length in bytes (octets).


You can try to send the request without setting the content-length.



  1. Mark Lee @Appeon
  2. Tuesday, 7 June 2022 05:09 AM UTC
Hi Cesar,

I think Arnd's understanding must be correct.

You only need to comment the code below to make it work.

//lo_client.SetRequestHeader("Content-Length", String(len(ls_xml_request) ))

Please confirm that you've resolved the issue.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.