.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 >> JavaScript/VBScript >> Post New QuestionBookmark and Share Subscribe to Forum

Soap encryption

Posted By: Pawan kumar Shukla     Posted Date: December 28, 2011    Points:5   Category :JavaScript/VBScript
i like to know how to encrypt soap using javascript from html file
to call a webservice that is on asp.net.

please help me.
thanks in advance.

my code:


<script type="text/javascript">
var storage;

document.getElementById("h12").innerHTML = storage;
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 CallWebService() {

var objXMLHttpRequest = CreateXMLHttpRequest();
objXMLHttpRequest.open("POST", "http://localhost:4212/WebService1.asmx", false);
objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
//var packet = '<?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:encodingStyle="URI"><soap:Body><add xmlns="http://tempuri.org/"><a>2</a><b>2</b></add></soap:Body></soap:Envelope>';
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:encodingStyle="URI"><soap:Body>';
strPostArgs += ' <login xmlns="http://tempuri.org/"><userName>' + document.getElementById("txtUser").value + '</userName><passKey>' + document.getElementById("txtPass").value + '</passKey></login></soap:Body></soap:Envelope>';
alert(strPostArgs);
objXMLHttpRequest.send(strPostArgs);
document.getElementById('h12').innerHTML = objXMLHttpRequest.responseText;
//storage=objXMLHttpRequest.responseText ;
// xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue

//alert(document.getElementById('h12').getElementsByTagName("loginresult")[0].childNodes[0].nodeValue.toString());

var status = document.getElementById('h12').getElementsByTagName("loginresult")[0].childNodes[0].nodeValue;

// alert(status);

if (status=="true") {
window.location = "http://localhost:4212/HTMLPage2.htm";
alert("Welcome");
}
else {
alert("Please Enter correct username or password");
}
}
//CallWebService();
</script>


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