Forum Discussion
In the soapui, we are passing the JSON request as "helloworld". But while saving the project as soapui.xml file, the request payload is converting from "helloworld" to "hello??world" in .xml file. (attached screen shots for more detials)
- richie6 years agoCommunity Hero
Hey ravi_ava
ok so - first things first - you're passing "hello world" in .json - but the screenshot you've provided of the .request with the ."json payload" isn't actually wellformed .json - have you edited the screenshot before taking it - cos typically we'd really need that.
Secondly - are you using SoapUI or ReadyAPI!? the screenshot looks like SoapUI.....quite often it helps to diagnose and provide solutions if people know the application and version number to being used.
It appears that the Ready.xml file being created is being created as xml v1.0 (defined in the xml declaration in yoru project file). XML v1.0 doesn't support control characters - I said this in last post and wanted to make sure you noticed!), so they need to be converted BEFORE the project .xml file is saved - otherwise you will always get these ?? placeholders.
Next you are injecting a json payload - right? json's default charset is UTF-8. You can only inject characters that have a reference within the UTF-8 charset alphanumeric list.
I had a look around and found this which lists all the characters supported by UTF-8.
Fortunately there are escape sequences for the control characters you care about (if there wasn't, you wouldn't be able to do anything except delete the chars from your payload):
for the SOH character sequence replace 'SOH' with ''
for the STX character sequence replace 'STX' with ''
If you replace the control character sequences with the appropriate escape sequence (in the case above the hex but you can use others) - this will mean that the characters will be recognised by the UTF-8 (which is charset for both .json (request payload) and .xml (project file) and will get around the fact that control characters are banned in xml v1.0
BTW - UTF-16 is a far greater charset than UTF-8 - it can be considered to be an extension of UTF-8 - so if the char exists in UTF-8 it will in UTF-16 (with the same escape sequences) (UTF-8 vs UTF-16 stuff)
Hope this helps,
nice one,
rich
- ravi_ava6 years agoOccasional Contributor
Hi, Ok, I will try with the options and will update you on the same.
Related Content
- 5 years ago
Recent Discussions
- 5 days ago
- 10 days ago