I'm trying to call the Create
method passing in a TriggeredSend
typed object named Objects
to an ExactTarget SOAP Web Service using the node-soap package.
I need to create something that looked like this (note the xsi:type="ns0:TriggeredSend"
):
<SOAP-ENV:Envelope xmlns:etns="http://exacttarget.com" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns0="http://exacttarget.com/wsdl/partnerAPI" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:CreateRequest>
<ns0:Objects xsi:type="ns0:TriggeredSend">
<ns0:TriggeredSendDefinition>
<ns0:CustomerKey>abc</ns0:CustomerKey>
</ns0:TriggeredSendDefinition>
</ns0:Objects>
</ns0:CreateRequest>
</ns1:Body>
</SOAP-ENV:Envelope>
With the code below I get close:
var soap = require('soap')
soap.createClient(url, function(err, client){
client.Create({
Objects: {
TriggeredSendDefinition: {
CustomerKey: 'abc'
}
},
function(err, response) {})
});
});
Which gives me this (without the xsi:type
):
<ns0:CreateRequest>
<ns0:Objects>
<ns0:TriggeredSendDefinition>
<ns0:CustomerKey>abc</ns0:CustomerKey>
</ns0:TriggeredSendDefinition>
</ns0:Objects>
</ns0:CreateRequest>
How do I specify the TriggeredSend
type for the Objects
element?