codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  sending soap requests  cheriansabs at 05:53 on Friday, October 06, 2006
 

hello everybody,
I have written a code to send soap requests using javascript.It
works perfectly fine in Internet explorer though it
does give a security warning.But when it comes to
netscape and firefox it doesnt work. I will paste the
code below.
In the following code it does not go beyond the
smsRequest.open("POST",
"http://sms.mxtelecom.com/soap/servlet/rpcrouter",false);
statement.Hope you would have a look at it and give
your valuable suggestions.


<script language="javascript">
function sendSMS()
{
alert("hello")

var smsRequest=createAjaxObj()
alert("hello1")
smsRequest.open("POST",
"http://sms.mxtelecom.com/soap/servlet/rpcrouter",false);
alert("hello2")
smsRequest.onreadystatechange=function()
{
if ((smsRequest.readyState==4) &&
(smsRequest.status==200))
{
alert(smsRequest.responseText)
}
}

smsRequest.setRequestHeader("Content-Type",
"text/xml")
smsRequest.setRequestHeader("SOAPMethodName",
"sendSMSMessage")
var strEnvelope
var
number=document.getElementById("hidNumber").value
var
message=document.getElementById("txtMessage").value
alert(number)
alert(message)
strEnvelope = "<?xml version='1.0'function sendSMS()
{
alert("hello")

var smsRequest=createAjaxObj()
alert("hello1")
smsRequest.open("POST", "http://sms.mxtelecom.com/soap/servlet/rpcrouter",false);
alert("hello2")
smsRequest.onreadystatechange=function()
{
if ((smsRequest.readyState==4) && (smsRequest.status==200))
{
alert(smsRequest.responseText)
}
}

smsRequest.setRequestHeader("Content-Type", "text/xml")
smsRequest.setRequestHeader("SOAPMethodName", "sendSMSMessage")
var strEnvelope
var number=document.getElementById("hidNumber").value
var message=document.getElementById("txtMessage").value
alert(number)
alert(message)
strEnvelope = "<?xml version='1.0' encoding='UTF-8'?>"
strEnvelope = strEnvelope + "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"
strEnvelope = strEnvelope + "<SOAP-ENV:Body>"
strEnvelope = strEnvelope + "<ns1:sendSMSMessage xmlns:ns1='urn:SOAPSend' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>"
strEnvelope = strEnvelope + "<user xsi:type='xsd:string'>xxxxxx</user>"
strEnvelope = strEnvelope + "<pass xsi:type='xsd:string'>xxxxxx</pass>"
strEnvelope = strEnvelope + "<to xsi:type='xsd:string'>" + number + "</to>"
strEnvelope = strEnvelope + "<from xsi:type='xsd:string'>Inpora</from>"
strEnvelope = strEnvelope + "<note xsi:type='xsd:string'>testing</note>"
strEnvelope = strEnvelope + "<subaccount xsi:type='xsd:string'></subaccount>"
strEnvelope = strEnvelope + "<report xsi:type='xsd:int'>1</report>"
strEnvelope = strEnvelope + "<text xsi:type='xsd:string'>" + message + "</text>"
strEnvelope = strEnvelope + "<flash xsi:type='xsd:boolean'>false</flash>"
strEnvelope = strEnvelope + "<split xsi:type='xsd:int'>0</split>"
strEnvelope = strEnvelope + "</ns1:sendSMSMessage>"
strEnvelope = strEnvelope + "</SOAP-ENV:Body>"
strEnvelope = strEnvelope + "</SOAP-ENV:Envelope>"
alert(strEnvelope)
smsRequest.send(strEnvelope)
}
function createAjaxObj()
{
var httprequest=false
if (window.XMLHttpRequest)
{ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
alert("in here")
}
else
if (window.ActiveXObject)
{ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}
</script>


Thanks in advance.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Select index`s and HTML Forms
•  Re: How to change the location?
•  Re: How can I read ASCII data file in C++
•  Display new link everyday for whole year in a sequence
•  sending soap requests
•  New to Data Access Classes
•  format date/time to return to database - second attempt
•  format date/time to return to database
•  Trying to create a C++ Object Oriented game


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2006