I have an Ajax function doing a POST for a SOAP webservice and I need to insert values into the request XML elements based on what the page user inserts into an input text. How can I do this?
My script looks like this:
var soapMessage = '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://teste.transaction.service">\
<SOAP-ENV:Header>\
<ns1:testeHeader>\
<channel>Portal</channel>\
</ns1:testeHeader>\
</SOAP-ENV:Header>\
<SOAP-ENV:Body>\
<teste:VC>\
<teste:VCRequestHeader>\
<PIN>1234</PIN>\
</teste:VCRequestHeader >\
</teste:VC_WSLOGIN>\
</SOAP-ENV:Body>\
</SOAP-ENV:Envelope>';
$.ajax({
type: "POST",
dataType: "xml",
url: wsUrl,
data: soapMessage,
crossDomain: true,
success: function(data) {
console.log(data);
},
error: function(error) {
console.log(error);
}
});
Thank you in advance for your attention.