NodeJS UploadMessage

Uploads a document. The document can be provided to the order by referring to the DocumentId in the order properties.

Response UploadMessage(string sessionId,string orderId,string fileName,base64 content)

Response codes

ResultCodeMessageValue
200OK
401Authorization failed
404Object not found

UploadMessage request

PropertyDescription
sessionIdExample: o58t9fjgw9bjarp6q7byv13e
orderId
message

UploadMessageResponse

Property
UploadMessageResult

NodeJS example

var soap = require("soap");

var example = function(callback) {

	//Attachment
	attachment =  {};
	attachment.Data=new Buffer('1234', 'base64');;
	attachment.FileName="anything.jpg";

	//ArrayOfAttachment
	attachments = [attachment];
{

	}

	//Message
	message =  {};
	message.Attachments=attachments;
	message.Body="BodyTest";
	message.Created="2017-09-20T11:02:33.04Z";
	message.FromAddress="administrator@ascio-test-domain.com";
	message.Subject="base64-encoded or 7 Bit ASCII";
	message.ToAddress="ToAddressTest";
	message.Type="Message_to_Partner";	
	soap.createClient("../AscioServiceTest.wsdl", function(err, client) {
		if(err) {
			callback(err);
		} 
		else {
			client.UploadMessage({sessionId: "sessionId", orderId: "orderId", message: message}, function(err,result) {
				if(err) {
					callback({error: err.root.Envelope.Body.Fault.faultstring.$value, request : result.request.body});
				} else {
					if(result.UploadMessageResult.ResultCode == 200) {
						callback(null,result);	
					} else {
						callback({error: result.UploadMessageResult,request : request});
					}
				}
			});
		};
	});
};
example(function(err,result) {
	if(err) {
		console.log("\n\n Request \n\n",err.request, "\n\n Response \n\n" ,err.error,"\n");
	}
	else {
		console.log(result);
	}
});
WSDL for AWS v2
https://aws.demo.ascio.com/2012/01/01/AscioService.wsdl (OTE)
https://aws.ascio.com/2012/01/01/AscioService.wsdl (Live)