Add self-signed certificate to the Netsuite https module to access third party Web Service
up vote
0
down vote
favorite
Does anyone know how to create a request using Netsuite https module attaching a self-signed certificate file(.pem or .pfx extension) to an external Web service?
I want to report invoices to Spain Tax registration entity (SII) automatically using a map/reduce script. I have tested my generated XML into the SII web interface, using POSTMAN and CURL command line and the web service received my request and return an expected XML response. But I am unable to achieve the same results creating the request using N/https module, mainly because I have no idea how to ship that request with the certificate file attached to it. My script fails with a message:
"type":"error.SuiteScriptError","name":"SSS_CONNECTION_TIME_OUT"
Here is the code which I have tried:
var siiURL = 'https://www7.aeat.es/wlpl/SSII-FACT/ws/fe/SiiFactFEV1SOAP';
//get the content of the generated xml
var xml_content = getXMLContent(url);
//get the url of the certificate file that is saved in the NS file cabinet
var certificate = getClientCertificate();
log.audit({ title: 'Certificate File', details: certificate });
var headers = {
'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction': 'SuministroLRFacturasEmitidas',
'local_cert': certificate,
'passphrase': '****'
};
var SIIresponse = https.post({ url: siiURL, body: xml_content, headers: headers });
log.audit({title: 'Response from SII', details: SIIresponse.code + ' | ' + SIIresponse.body });
The example snippet was taken from a post in PHP: https://es.stackoverflow.com/questions/77233/conectar-con-el-web-service-de-sii-aeat-soap-php
The Spain tax report entity provides a pfx file to authenticate with. For test purposes, I created a PEM file (both cl and key and also a bundle .pem file) using this post: https://es.stackoverflow.com/a/131407/59793
I guess that web service does not expect the certificate file in the header of the request but I have no idea where it should be placed or if there is an appropriate header key for this. Also, I found information about how to save .cert/.pem files to Netsuite but as far as I know, this is for suite commerce:
https://noblue.co.uk/blog/netsuite-tips-installing-an-ssl-certificate-on-suitecommerce
Thanks for any help or comment.
PD. Please excuse any grammar mistake or typo.
ssl netsuite suitescript2.0
add a comment |
up vote
0
down vote
favorite
Does anyone know how to create a request using Netsuite https module attaching a self-signed certificate file(.pem or .pfx extension) to an external Web service?
I want to report invoices to Spain Tax registration entity (SII) automatically using a map/reduce script. I have tested my generated XML into the SII web interface, using POSTMAN and CURL command line and the web service received my request and return an expected XML response. But I am unable to achieve the same results creating the request using N/https module, mainly because I have no idea how to ship that request with the certificate file attached to it. My script fails with a message:
"type":"error.SuiteScriptError","name":"SSS_CONNECTION_TIME_OUT"
Here is the code which I have tried:
var siiURL = 'https://www7.aeat.es/wlpl/SSII-FACT/ws/fe/SiiFactFEV1SOAP';
//get the content of the generated xml
var xml_content = getXMLContent(url);
//get the url of the certificate file that is saved in the NS file cabinet
var certificate = getClientCertificate();
log.audit({ title: 'Certificate File', details: certificate });
var headers = {
'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction': 'SuministroLRFacturasEmitidas',
'local_cert': certificate,
'passphrase': '****'
};
var SIIresponse = https.post({ url: siiURL, body: xml_content, headers: headers });
log.audit({title: 'Response from SII', details: SIIresponse.code + ' | ' + SIIresponse.body });
The example snippet was taken from a post in PHP: https://es.stackoverflow.com/questions/77233/conectar-con-el-web-service-de-sii-aeat-soap-php
The Spain tax report entity provides a pfx file to authenticate with. For test purposes, I created a PEM file (both cl and key and also a bundle .pem file) using this post: https://es.stackoverflow.com/a/131407/59793
I guess that web service does not expect the certificate file in the header of the request but I have no idea where it should be placed or if there is an appropriate header key for this. Also, I found information about how to save .cert/.pem files to Netsuite but as far as I know, this is for suite commerce:
https://noblue.co.uk/blog/netsuite-tips-installing-an-ssl-certificate-on-suitecommerce
Thanks for any help or comment.
PD. Please excuse any grammar mistake or typo.
ssl netsuite suitescript2.0
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Does anyone know how to create a request using Netsuite https module attaching a self-signed certificate file(.pem or .pfx extension) to an external Web service?
I want to report invoices to Spain Tax registration entity (SII) automatically using a map/reduce script. I have tested my generated XML into the SII web interface, using POSTMAN and CURL command line and the web service received my request and return an expected XML response. But I am unable to achieve the same results creating the request using N/https module, mainly because I have no idea how to ship that request with the certificate file attached to it. My script fails with a message:
"type":"error.SuiteScriptError","name":"SSS_CONNECTION_TIME_OUT"
Here is the code which I have tried:
var siiURL = 'https://www7.aeat.es/wlpl/SSII-FACT/ws/fe/SiiFactFEV1SOAP';
//get the content of the generated xml
var xml_content = getXMLContent(url);
//get the url of the certificate file that is saved in the NS file cabinet
var certificate = getClientCertificate();
log.audit({ title: 'Certificate File', details: certificate });
var headers = {
'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction': 'SuministroLRFacturasEmitidas',
'local_cert': certificate,
'passphrase': '****'
};
var SIIresponse = https.post({ url: siiURL, body: xml_content, headers: headers });
log.audit({title: 'Response from SII', details: SIIresponse.code + ' | ' + SIIresponse.body });
The example snippet was taken from a post in PHP: https://es.stackoverflow.com/questions/77233/conectar-con-el-web-service-de-sii-aeat-soap-php
The Spain tax report entity provides a pfx file to authenticate with. For test purposes, I created a PEM file (both cl and key and also a bundle .pem file) using this post: https://es.stackoverflow.com/a/131407/59793
I guess that web service does not expect the certificate file in the header of the request but I have no idea where it should be placed or if there is an appropriate header key for this. Also, I found information about how to save .cert/.pem files to Netsuite but as far as I know, this is for suite commerce:
https://noblue.co.uk/blog/netsuite-tips-installing-an-ssl-certificate-on-suitecommerce
Thanks for any help or comment.
PD. Please excuse any grammar mistake or typo.
ssl netsuite suitescript2.0
Does anyone know how to create a request using Netsuite https module attaching a self-signed certificate file(.pem or .pfx extension) to an external Web service?
I want to report invoices to Spain Tax registration entity (SII) automatically using a map/reduce script. I have tested my generated XML into the SII web interface, using POSTMAN and CURL command line and the web service received my request and return an expected XML response. But I am unable to achieve the same results creating the request using N/https module, mainly because I have no idea how to ship that request with the certificate file attached to it. My script fails with a message:
"type":"error.SuiteScriptError","name":"SSS_CONNECTION_TIME_OUT"
Here is the code which I have tried:
var siiURL = 'https://www7.aeat.es/wlpl/SSII-FACT/ws/fe/SiiFactFEV1SOAP';
//get the content of the generated xml
var xml_content = getXMLContent(url);
//get the url of the certificate file that is saved in the NS file cabinet
var certificate = getClientCertificate();
log.audit({ title: 'Certificate File', details: certificate });
var headers = {
'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction': 'SuministroLRFacturasEmitidas',
'local_cert': certificate,
'passphrase': '****'
};
var SIIresponse = https.post({ url: siiURL, body: xml_content, headers: headers });
log.audit({title: 'Response from SII', details: SIIresponse.code + ' | ' + SIIresponse.body });
The example snippet was taken from a post in PHP: https://es.stackoverflow.com/questions/77233/conectar-con-el-web-service-de-sii-aeat-soap-php
The Spain tax report entity provides a pfx file to authenticate with. For test purposes, I created a PEM file (both cl and key and also a bundle .pem file) using this post: https://es.stackoverflow.com/a/131407/59793
I guess that web service does not expect the certificate file in the header of the request but I have no idea where it should be placed or if there is an appropriate header key for this. Also, I found information about how to save .cert/.pem files to Netsuite but as far as I know, this is for suite commerce:
https://noblue.co.uk/blog/netsuite-tips-installing-an-ssl-certificate-on-suitecommerce
Thanks for any help or comment.
PD. Please excuse any grammar mistake or typo.
ssl netsuite suitescript2.0
ssl netsuite suitescript2.0
asked Nov 19 at 18:16
elotgamu
136
136
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380482%2fadd-self-signed-certificate-to-the-netsuite-https-module-to-access-third-party-w%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380482%2fadd-self-signed-certificate-to-the-netsuite-https-module-to-access-third-party-w%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown