Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4720 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hallo,

I experience some problem with POST XML to URL plugin. I try to POST xml request to server, but there is some problem with characters - it shows ??? in the message. The problem is only with Russian chars, no problem with English or numbers. It seems to be problem with charset, in the request it must be only UTF-8.

The XML is the following:


<?xml version="1.0" encoding="utf-8" ?>

<package login="lik" password="XXXXXXXXXXX">

  <message>

    <default sender="LIK"/>

    <msg recipient="+79161770129">test и тест</msg>

  </message>

</package>

The message i get from SMS server - "test ? ????"

Please Help to solve the problem and sorry for my English)

Posted

The encoding must be only in UTF-8 for requests and response is also in UTF-8. But it seems like POST XML to URL plugin posts request in different encoding... Can you please tell me how to send the request in UTF-8 (now it seems to be in UTF-16)?

Posted

And here is the code of plug-in:


// Send data

URL url = new URL(url);

HttpURLConnection conn = url.openConnection();

if( soapaction != null ) conn.setRequestProperty( "SOAPAction", soapaction );

conn.setRequestProperty("Accept-Charset", "utf-8");

conn.setRequestProperty( "content-type", "text/xml; charset=utf-8");

conn.setDoOutput(true);

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());

wr.write(xml);

wr.close();

// Get the response

String response;

InputStream responseStream;

try {

responseStream = conn.getInputStream();

success = 1;

} catch( IOException e ) {

success = 0;

if( conn.getResponseCode() == 500 ) {

  responseStream = conn.getErrorStream();

} else throw e;

}

response = responseStream.getText("utf-8");

responseStream.close();

return response;





And XML i try to send:



<?xml version="1.0" encoding="utf-8" ?>

<package login="lik" password="XXXXXXXXXXX">

  <message>

    <default sender="LIK"/>

    <msg recipient="+79161770129">Some  text in Russian. Its where the problem is!</msg>

  </message>

</package>

Thank you!

Posted

The module is really simply a proof of concept. Changing the default encoding scheme is a little outside the scope of support. However, I've dug into this a bit an it looks like this forum post might be useful. Basically, it looks like you can modify the module to change the string coming from FileMaker to UTF-8 by adding something like the following:

xml = new String( xml.getBytes("UTF-8"), "UTF-8" );

You may also need to change the encoding on the response as well. If you'd like us to look into doing this for you we do offer custom development and I can provide a quote for that directly if you want to pursue that option.

Posted

I tried the URL you included but don't seem to be able to get it to work. Is it possible for you to email me the ScriptMaster file with the input variable (URL) included?

Posted

Oh, sorry, I forgot that they have IP filter...only requests from my IP will work. You can provide me your IP, or i can follow your instructions to test it and give you result...?

Posted

You can try adding the line above to the module. I'm not an encoding expert but I believe this will create a new string with the correct encoding. Again, you may have to do something similar thing with the response.

Posted

Thank you, it helped!!!)

For the others:

the full code is


// Send data

URL url = new URL(url);

HttpURLConnection conn = url.openConnection();

if( soapaction != null ) conn.setRequestProperty( "SOAPAction", soapaction );

conn.setRequestProperty("Accept-Charset", "utf-8");

conn.setRequestProperty( "content-type", "text/xml; charset=utf-8");

conn.setDoOutput(true);

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());

text = new String( text.getBytes("UTF-8"));

wr.write(xml+text+xml2);

wr.close();

// Get the response

String response;

InputStream responseStream;

try {

responseStream = conn.getInputStream();

success = 1;

} catch( IOException e ) {

success = 0;

if( conn.getResponseCode() == 500 ) {

  responseStream = conn.getErrorStream();

} else throw e;

}

response = responseStream.getText("utf-8");

responseStream.close();

return response;

and there are 4 Variables:

URL

XML

TEXT

XML2

SOAPACTION

THANK YOU VERY-VERY MUCH FOR HELP!!!

This topic is 4720 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.