For an API I need the possibility to create a byte array from a local pdf
file.
I've already checked Google, StackOverflow, but the existing solutions do
not work. Whenever I try to execute the code I get a bad request from the
soap API. If I send zero bytes then I get an error message that was sending
zero bytes. The credentials also work. The only thing I can not solve is
how I can generate a byte array from a pdf file and send it via node-soap.
This question I have already posted on StackOverflow but I received no
solution.
Here my code:
var fs = require('fs');var zlib = require('zlib');var soap =
require('soap');var path_to_wsdl = "url to wsdl";
var data = {};
data['Authentication'] = {
'Username': "myusername",
'Password': "mypass"}
data['Options'] = {
'Testmode': true}
data['Recipient'] = {
'Company': "Firma",
'FirstName': 'Vorname',
'Name': 'Name',
'Address': 'Street Nr.',
'Zip': "68753",
'City': 'Stadt',
'Country': 'DE'}
var smabuf = fs.createReadStream('test.pdf');
data['File'] = {
'Filename': "test.pdf",
'Bytes': smabuf,
'Color': false,
'Duplex': false,
'Enveloping': 0}
soap.createClient(path_to_wsdl, function (err, client) {
if (err) {
console.log(err);
}
client.BriefManager.BriefManagerSoap.CreateJob(data, function (err, result)
{
if (err) {
console.log(err);
} else {
console.log(result);
}
});});
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/8699723b-ec71-40ad-8381-82f82f26ebc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.