RestClient.NewSecure JSON payload with XML field
Hi
I'm trying to call a an HTTPS rest endpoint from oScript using RestClient.NewSecure. Due to historic reasons, I need to post some xml data, but it it embedded in the json payload as a json field.
I build the xml from mostly attribute values - OK.
I build the json string:
String cSiebelMessage = Str.CString(siebelMessage) String jsonPayload = '{' jsonPayload += '"body":{' jsonPayload += '"Component":"WfProcMgr",' jsonPayload += '"Mode":"Sync",' jsonPayload += '"Method":"RunProcess",' jsonPayload += '"WfParams": {' jsonPayload += '"ProcessName":' + '"' + .GetPreferences().Siebel_Workflow_Name + '",' jsonPayload += '"' + .GetPreferences().Siebel_Payload_Field_Name + '": ' + cSiebelMessage + '' jsonPayload += '}' jsonPayload += '}' jsonPayload += '}'
So I've used Str.CString to convert the xml to a C string and escape the double quotes:
"<?xml version=\"1.0\" encoding=\"UTF-16\" ?>........."
the problem is that when this is posted through the client, it looks like it escapes all the '\' again, so it posts:
"IncomingXML": "<?xml version=\\"1.0\\" encoding=\\"UTF-16\\" ?><......."
If I don't use the Str.CString, then I don't get the double quotes escaped, making the json invalid.
any ideas please on how to make the xml then json strings, then post the json (with the xml in it) to the target?
thanks
Guy.
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 151 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories