Copy link to clipboard
Copied
Hello.
I am trying to use socket in javascript to replace calls that I have like the following
in c++ that also use a socket library to use HTTPS. The response returned by the server is in XML. Can someone help me or tell me if there is any example of calls to a server over HTTPS that receive an XML response.
Greetings.
Copy link to clipboard
Copied
I hope something here helps - I'm not an expert in this area at all. There are people here who are far better at this than I am.
example.com should bbe your hostname
jSessionId should the actual value
data variable shout output when response completes
Node.js might simplify the process
Maybe this is a bit easier then dealing with sockets, if in a browser the HTPPs requests have security restrictions and it might be better to Fetch API or XMLHttpRequest
Again - I'm not an expert - I'm learning things every day and this has been an interesting one for me.
I'm looking forward to the replies too.
const https = require('https');
const options = {
hostname: 'example.com',
port: 443,
path: '/Trebol/getIPLocal.do?sessionId=indesign',
method: 'GET',
headers: {
'Cookie': `JSESSIONID=${jSessionId}`
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.end();
Copy link to clipboard
Copied
Hi Eugene.
First of all, thank you for your response.
What I need is how to use the socket object of the indesign javascrip sdk and in your example I think what you are using is nodejs.
As I said before, thanks for your response but it's not what I'm looking for.
Copy link to clipboard
Copied
You could call out to javascript from your c++ PlugIn.
P.
Copy link to clipboard
Copied
Hi pickory.
Correct and i have a plug-in that call to javascript, but the javascript are .jsx indesign javascript and i don't know if you call to another javascript type. Have you any example?
thanks.
Copy link to clipboard
Copied
If you have a C++ plugin then you don't need to code in extendscript to make this call, it would be too much hassle.
Other easier options that you can use are
-Manan