+ Start a Discussion
Rich.ax131Rich.ax131 

SOAP return message

Not .NET, but  . . .

I'm attempting to use the SOAP Login method from the documentation using classic ASP.  This same techniqe worked with v1 of the API, but when I execute the following code all I get returned from strResponse is "Premature end of file."  I can't find any documentation regarding exactly what that error means.  Any pearls of wisdom?

strUsername = [username]
strPassword = [password]
sforceSoapServer = "https://na1-api.salesforce.com/servlet/servlet.SoapApi"

strSoapBody = strSoapBody & ""
strSoapBody = strSoapBody & "   http://schemas.xmlsoap.org/soap/envelope/"""
strSoapBody = strSoapBody & "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://"
strSoapBody = strSoapBody & "www.w3.org/2001/XMLSchema"">"
strSoapBody = strSoapBody & "      "
strSoapBody = strSoapBody & "         "
strSoapBody = strSoapBody & "            " & strUsername & ""
strSoapBody = strSoapBody & "            " & strPassword & ""
strSoapBody = strSoapBody & "         "
strSoapBody = strSoapBody & "      "
strSoapBody = strSoapBody & "   "
   
'Build the SOAP header
Set XMLHTTP = CreateObject("Msxml2.ServerXMLHTTP")
XMLHTTP.open "POST", sforceSoapServer, False   'False = do not respond immediately
XMLHTTP.setRequestHeader "Man", POST & " " & sforceSoapServer & " HTTP/1.1"
XMLHTTP.setRequestHeader "Content-Type", "text/xml"
   
'Send the SOAP request
XMLHTTP.send (strSoapRequest)
strResponse = XMLHTTP.responseText
response.Write strResponse

DevAngelDevAngel

Hi Rich,

The best approach for "old" ASP is to use the office Toolkit.  This is a com object that wraps the SOAP for you.  You use this as you would any other com object and it insulates you from the intricacies of rolling your own SOAP messages.  You can obtain the Office Toolkit by installing the Office Edition from Studio within the APP.

Once installed, you can add a reference to SF_MSApi.dll (described as SforceOfficeToolkit v1.0).  This dll is located in C:\Program Files\salesforce.com\OfficeToolkit\1.0

You can excercise this com object from vbScript, javaScript are create COM/DCOM components in VB 6.

Cheers