.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> www.DotNetSpark.com >> Post New QuestionBookmark and Share Subscribe to Forum

how to call a web service using soap with javascript from phone

Posted By: Pawan kumar Shukla     Posted Date: January 25, 2012    Points:5   Category :www.DotNetSpark.com
it work fine with system but not with emulator


function CreateXMLHttpRequest() {
if (typeof XMLHttpRequest != "undefined") {
//All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) uses XMLHttpRequest object
return new XMLHttpRequest();
}
else if (typeof ActiveXObject != "undefined") {
//Internet Explorer (IE5 and IE6) uses an ActiveX Object
return new ActiveXObject("Microsoft.XMLHTTP");
}
else {
throw new Error("XMLHttpRequestnot supported");
}
}


function hello() {
var objXMLHttpRequest = CreateXMLHttpRequest();
objXMLHttpRequest.open("POST", "http://trend/new/Services/GWebServices.asmx", false);
objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

var strPostArgs = new String();
strPostArgs = '<?xml version="1.0" encoding="utf-8" ?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" ><soap:Body>';

strPostArgs += ' <HelloWorld xmlns="http://tempuri.org/"></HelloWorld></soap:Body></soap:Envelope>';
alert(strPostArgs);

objXMLHttpRequest.send(strPostArgs);



var heading = document.createElement("h6");
heading.setAttribute('style', 'visibility:hidden; font-size:0.01px;');
heading.id = 'h12UpdateIsDeletedByRecipient';

document.body.appendChild(heading);
document.getElementById('h12UpdateIsDeletedByRecipient').innerHTML = objXMLHttpRequest.responseText;
alert(document.getElementById('h12UpdateIsDeletedByRecipient').innerHTML);
}

Responses

No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend