Hi guys,

I am trying create an order based on Data Service API developer guide (v 1.2) documentation. Follow that documentation I have to do 2 steps for create an order:
1: Get last public key
2: Use that last public key to call create order API

But I just passed at step 1, for step 2 It's responded: no message, no error, no last public key... that's difficult to fix for me.

Can anyone please help me correct my code (using nodejs) below ?

Code:
/*
 * createOrder API
 */
function createOrder(callback) {

	return checkPublickey( (err, data) => {
		if (err) callback(true, data);
		// call
		var message = {
			"Name" 		: "APIORDERPADCREATEORDER",
			"Version"	: "1.0",
			"Data" 		: {
				"Symbol"		: "NAB",
				"AccountNumber" : "8900330",
				"MarketId"		: 0,
				"TimeInForce"	: 2,
				"OrderType"		: 0,
				"Side"			: 1,
				"TotalQuantity" : 40,
				"LimitValue"	: 35.29,
				"RoanoAdvice"	: 1,
				"OrderGivenBy"	: "Hewisons"
			}
		}
		var xml =
			'<soapenv:Envelope '
			+   'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" '
			+   'xmlns:par="http://paritech.com/Paritech.DataServices.API">'
			+	'<soapenv:Header/>'
			+   '<soapenv:Body>'
			+		'<par:Execute>'
			+			'<par:message>'
			+   			'<par:ApiKey>' + API_KEY + '</par:ApiKey>'
			+				'<par:ClientIpAddress>' + API_CLIENT_IP + '</par:ClientIpAddress>'
			+				'<par:HttpSessionId>' + session_id + '</par:HttpSessionId>'
			//+       		'<par:Message>{"Name":"APIORDERPADCREATEORDER","Version":"1.0","Data":{"Symbol":"NAB","AccountNumber":"8900330","Market":0,"TimeInForce":2,"OrderType":0,"Side":1,"TotalQuantity":40,"LimitValue":35.29}}'
			+				'<par:Message>'
			+					message
			+				'</par:Message>'
			+				'<par:OutputFormat>Json</par:OutputFormat>'
			+				'<par:PluginName>OrderPad</par:PluginName>'
			+				'<par:PublicKey>' + last_public_key + '</par:PublicKey>'
			+			'</par:message>'
			+		'</par:Execute>'
			+   '</soapenv:Body>'
			+ '</soapenv:Envelope>';

		var http_options = {
			hostname: 'apistaging.paritech.com',
			path: 'https://apistaging.paritech.com/Paritech.DataServices.API/ApiService.svc',
			method: 'POST',
			headers: {
				'Content-Type'	: 'text/xml',
				'Content-Length': xml.length,
				'Connection' 	: 'keep-alive',
				'SOAPAction' 	: 'http://paritech.com/Paritech.DataServices.API/IApiService/Execute'
			}
		}

		// do request
		doRequest(xml, http_options, (err, result) => {
			// If error result is message string
			//console.log(result[0]['ExecuteResponse'][0]['ExecuteResult'][0]['ControlSource'][0])
			//console.log(result[0]['ExecuteResponse'][0]['ExecuteResult'][0]['ErrorMessage'][0])
			//console.log(result[0]['ExecuteResponse'][0]['ExecuteResult'][0]['PublicKey'][0])
			last_public_key = result[0]['ExecuteResponse'][0]['ExecuteResult'][0]['PublicKey'][0]
			return callback(err, result);
		});

	})
}


This is responed:

Code:
{"result":[{"ExecuteResponse":[{"$":{"xmlns":"http://paritech.com/Paritech.DataServices.API"},"ExecuteResult":[{"$":{"xmlns:i":"http://www.w3.org/2001/XMLSchema-instance"},"ControlSource":[{"$":{"i:nil":"true"}}],"ErrorMessage":[{"$":{"i:nil":"true"}}],"PublicKey":[{"$":{"i:nil":"true"}}]}]}]}]}


Thanks,
Manh Vu