function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
smilo33smilo33 

Javascript/MSXML/SOAP

adamg mentioned code having a code example using Javascript/SOAP. Can I see this?

I would like to see how to use MSXML with Javascript to access the API.

Sorry I'm starting a new thread, but I can't tell if the old thread is still getting attention.

Much thanks,

Samantha
smilo33smilo33
Found this if anyone finds it useful...

http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;555057
smilo33smilo33
An SForce object example that I toyed with. Maybe someone else will find it useful as a very simple example to get started with. (now, hopefully, I can figure out how to do this in Java or ActiveX, so I can just call the methods and not have to build the soap message.) This requires IE and MSXML 3 or 4.

smilo33smilo33
<script language="JScript">

strMethodPkg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
strMethodPkg += "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" "
strMethodPkg += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
strMethodPkg += "<soapenv:Header>"
strMethodPkg += "<ns1:SessionHeader soapenv:mustUnderstand=\"0\" xmlns:ns1=\"SforceService\">"
strMethodPkg += "<ns2:sessionId xmlns:ns2=\"urn:enterprise.soap.sforce.com\">{!API_Session_ID}</ns2:sessionId>"
strMethodPkg += "</ns1:SessionHeader>"
strMethodPkg += "</soapenv:Header>"
strMethodPkg += "<soapenv:Body>"
strMethodPkg += "<retrieve xmlns=\"urn:enterprise.soap.sforce.com\">"
strMethodPkg += "<fieldList>Id, AccountNumber, Name, Website</fieldList>"
strMethodPkg += "<sObjectType>Account</sObjectType>"
strMethodPkg += "<ids>{!Account_ID}</ids>"
strMethodPkg += "</retrieve>"
strMethodPkg += "</soapenv:Body>"
strMethodPkg += "</soapenv:Envelope> "

var objXMLHTTP = new ActiveXObject("Msxml2.XMLHTTP.4.0")
objXMLHTTP.open("POST", "{!API_Enterprise_Server_URL_30}", false)
objXMLHTTP.setRequestHeader("Content-Type","text/xml")
objXMLHTTP.setRequestHeader("SOAPaction","retrieve")
objXMLHTTP.setRequestHeader("Content-Length", "978")

objXMLHTTP.send(strMethodPkg)
</script>
Vipin  PulinholyVipin Pulinholy

Hi Samantha,

           When I tried to run this script I am getting a JavaScript Error message " System cannot locate the resource specified"

Any Idea what may be the reason ?

das

Vipin  PulinholyVipin Pulinholy

How do we can get the response. ? I have to get the number of count of a particular field in the database and if I use the 'Query' how do I can access the result from the javascript ??

Can u please help me .....

smilo33.ax98smilo33.ax98
Try this:

//send package
objXMLHTTP.send(strMethodPkg)
//see what's in the package
document.write(objXMLHTTP.responseXML.xml)