Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Converting from Soap 2011 endpoint to XMLHttpRequest

$
0
0

I have this type of request

<s:Envelope
xmlns='url1'
xmlns:s='url2'
xmlns:a='url3'
xmlns:i='url4'>
<s:Body>
<Execute>
<request>
<a:Parameters>
<a:KeyValuePairOfstringanyType>
<b:key>KeyOne</b:key>
<b:value i:type='c:string'>stringValue</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>KeyTwo</b:key>
<b:value i:type='c:boolean'>true</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil='true' />
<a:RequestName>RequestName</a:RequestName>
</request>
</Execute>
</s:Body>
</s:Envelope>"

I would like to convert it to:

var req =new XMLHttpRequest();
//Post the WEB API Request
req.open("POST", url +"/api/data/v8.0/"+ RequestName, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

req.onreadystatechange =function () {
if (this.readyState ==4/* complete */) {
req.onreadystatechange =null;
if (this.status ==200||this.status ==204)
{
} else {
var error = JSON.parse(this.response).error;
alert("Error in Action: "+error.message);
}
}
};
Does anybody know how to do this?
 

Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images