[Webtest] [dev] Post encoding for Invoke (for SOAP actions)
Paul King
Paul King <paulk@asert.com.au>
Mon, 17 Sep 2007 20:41:55 +1000
Marc Guillemot wrote:
> Hi,
>
> I guess the question are mainly for Paul.
>
> I have encoding problems using invoke to test web services. My main
> concerns are that:
> - invoke contentFile's content is read with system default encoding
> - Content-type header is set to charset ISO-8859-1
> - WebRequestSettings' charset is not set
>
> This configuration doesn't work for me (with UTF-8 as system and
> contentFile encoding) and I'd like to change it like this to use system
> default file encoding (as I don't see any simple access to the encoding
> of the ant build file being executed).
>
> My SOAP knowledge are quite limited. Do you see any drawbacks of such a
> change?
Yes, the hard-coded ISO-8859-1 is a hangover from when I contributed to a
PostSOAP example to httpclient - a couple of lines are similar. :-)
Checking some ant source:
main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
Both seem to use: System.getProperty("file.encoding")
So that is probably what we want. Though it may pay to re-purpose an
optional <header> entry to allow it to be overridden manually, e.g.:
<invoke method="POST" contentFile=...>
<header name="Content-type" value="text/xml; charset=ISO-8859-1"/>
</invoke>
I am doing a bit of web service work, so can try out any changes to make
sure existing systems don't break.
Paul.