Calling the Web Service through Java Script



Download the Soap client script from Codeplex:
http://javascriptsoapclient.codeplex.com/

Then Add the Soap client script file on Form consume the functions to call the external public hosted web service.
Sample code to call the web service using the Soap client.
function EntityOnChange()
{
var entity = null;

if (!IsNull(Xrm.Page.getAttribute("new_entity"))) {
if (!IsNull(Xrm.Page.getAttribute("new_entity").getSelectedOption()))
entity = Xrm.Page.getAttribute("new_entity").getSelectedOption().text;
}
var params = new SOAPClientParameters();
//Gets recently Viewed Data
//SOAPClient.invoke("https:///AppWebServices/RecentlyViewedWebService.asmx", "RetrieveRecentlyViewedData", params, true, HelloTo_callBack);

params.add("entityName", entity);

SOAPClient.invoke("https:///AppWebServices/LookupService.asmx", "RetrieveTypeCode", params, true, HelloTo_callBack);
}

function HelloTo_callBack(r) {
alert(r);
}

Advertisements

About Kishore Dhanekula

MS Dynamics CRM and .NET Architect
This entry was posted in Ms Dynamics CRM 2013. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s