Calling webservice from JavaScript

S

Steven Licciardi

Hello,

I am successfully using the code below to call a webservice from within
JavaScript, however I would like to call another function that takes two
variables, how do I send the two variables using the method below.

var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
xmlHTTP.open ("POST", "http://localhost/FastTimes/racetimes.asmx",
false);
xmlHTTP.setRequestHeader( "Content-Type","text/xml; charset=utf-8");
xmlHTTP.setRequestHeader(
"SOAPAction","http://tempuri.org/FastTimes/racetimes/getRaceTimes");

strRequest = "<?xml version='1.0' encoding='utf-8'?>";
strRequest = strRequest + "<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/'>";
strRequest = strRequest + " <soap:Body>";
strRequest = strRequest + "<getRaceTimesResult
xmlns='http://tempuri.org/' />";
strRequest = strRequest + "</soap:Body>";
strRequest = strRequest + "</soap:Envelope>";

xmlHTTP.send(strRequest);
//alert(xmlHTTP.responseXML.xml);
var resp = unescape(xmlHTTP.responseXML.xml);

Thanks,

Steven
 
S

Steven Licciardi

I have managed to solve this problem using the WebService Behavior instead.

Steven
 
J

Justin Dutoit

I have a couple questions on SOAP headers and web service behaviors, can you
help me?
I want to set a username and password in a SOAP header, and use that to call
a web service which requres custom authentication.

Justin Dutoit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top