Hi,
I have a web API which needs I have a web API which expect plain XML in the request body. My following program pass the XML as form data instead of raw request payload. Where am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<title>Data Call</title>
<link href="kendo/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="kendo/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<script src="kendo/js/jquery.min.js" type="text/javascript"></script>
<script src="kendo/js/kendo.web.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var dataSource = new kendo.data.DataSource({
type: "xml",
transport: {
read: {
type: 'POST',
dataType: "xml",
data: "xmlstring",
url: "https://9.9.9.9:8443/kendotest/api/GetAccounts",
data: { escape('<?xml version="1.0" encoding="UTF-8" standalone="no"?><accountrequest><accountno>23</accountno></accountrequest>')},
beforeSend: function(xhr)
{
xhr.setRequestHeader('X-Token','6452734413286534260')
}
}
}
});
dataSource.read();
});
</script>
</head>
<body>
<div id="info"></div>
</body>
</html>
Thanks,
Asat
I have a web API which needs I have a web API which expect plain XML in the request body. My following program pass the XML as form data instead of raw request payload. Where am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<title>Data Call</title>
<link href="kendo/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="kendo/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<script src="kendo/js/jquery.min.js" type="text/javascript"></script>
<script src="kendo/js/kendo.web.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var dataSource = new kendo.data.DataSource({
type: "xml",
transport: {
read: {
type: 'POST',
dataType: "xml",
data: "xmlstring",
url: "https://9.9.9.9:8443/kendotest/api/GetAccounts",
data: { escape('<?xml version="1.0" encoding="UTF-8" standalone="no"?><accountrequest><accountno>23</accountno></accountrequest>')},
beforeSend: function(xhr)
{
xhr.setRequestHeader('X-Token','6452734413286534260')
}
}
}
});
dataSource.read();
});
</script>
</head>
<body>
<div id="info"></div>
</body>
</html>
Thanks,
Asat