XML request and an empty XML file

A little, big problem (as usual).
I need to convert images from one format to a different one using an online service (https://www.online-convert.com/, there are many others but this seems to be the most professional). Before trying to access the conversion application I need to know which server to use for server load balancing reasons. According to their website I have to make a XML request as follows:

<?xml version="1.0" encoding="utf-8"?>
<queue>
	<apiKey>2e3152........03258494237510e6</apiKey>
	<targetType>image</targetType>
</queue>

and the answer should look like this

<?xml version="1.0" encoding="utf-8"?>
<queue-answer>
  <status>
    200
    <message>Found free slot on server.</message>
  </status>
  <params>
    <server>http://www18.online-convert.com</server>
  </params>
</queue-answer>

To use this service from Servoy I have written this simple method

var xmlfile = "<?xml version='1.0' encoding='utf-8'?><queue><apiKey>8703ce0ed6dfb9c06nhybe5f65c841f1</apiKey><targetType>image</targetType></queue>";
var client = plugins.http.createNewHttpClient();
var poster = client.createPostRequest('http://api.online-convert.com/get-queue');
var head = poster.addHeader('Content-type', 'multipart/form-data');
poster.addParameter('queue',xmlfile);
var response = poster.executeRequest();
var httpBody = response.getResponseBody();

But I always receive an error message saying

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<queue-answer>
  <status>
    8
    <message>The XML file is empty. Please verify that you have send us a variable \"queue\" filled with the XML data.</message>
  </status>
</queue-answer>

Any idea on where I am wrong? Thanks.

With a POST you typically send the data in the body (poster.addParameter(null,xmlfile):wink: using null for the parameter. Named variable in the error message leads me to think you need to use GET.

Thank you david for your reply, but I am still receiving the same error message.

I asked the developer of online-convert.com assistance with the problem described in my original post. The answer was fast. They asked me a trace file, which I enclose in case anyone was interested, and told me that according to their tests the script was ok and that putting double quotation marks (" ") as in here ```

<?xml version="1.0" encoding="utf-8"?>
Alas this is not the case and I am therefore asking you Servoyans if you could devise which could be the problem. I know that sometimes the interaction between javascript and java produces weird results but i could not imagine what could have happened in this specific case.
This is the final version of the script

var xmlfile = ‘<?xml\ version="1.0" encoding="utf-8"?>8703ce0ed6dfb9c06cf1be5f65c841f1image’;
var client = plugins.http.createNewHttpClient();
var poster = client.createPostRequest(‘http://api.online-convert.com/get-queue’);
poster.addHeader(“Content-type”, “text/xml”);
poster.addParameter(“queue”,xmlfile);
var response = poster.executeRequest();
var httpBody = response.getResponseBody();


The trace file is attached (to read it you should change the extension to .pcap)

[test100.txt|attachment](upload://efnR7wsrE3WkpYveaFH61CtbGti.txt) (1.76 KB)