You need to sign in to do that
Don't have an account?
Sathyaish
Newbie question
I've programmed VB from VB4 during the last 6 yrs through to VB6, and am fairly conversant in the Win32 API. However, as regards sales force extentions, I am completely a newbie and am feeling lost. Where do I start? My questions are:
(1) Is it possible to use extend salesforce with VB6 and not VB.NET?
(2) Where do I find a quick tutorial on (that's less greasy with technical gibberish as found in specifications) using the SOAP toolkit with VB6?
Hi Sathyaish,
It is definitely possible to use our SOAP API with vb6. It is not as pretty as .Net, but reliable none the less. What you need to have a thorough understanding of is SOAP and SOAP namespaces, and one of the MS http/soap libraries. You can choose from wininet, MSXML or MSSOAP. Wininet will require that you write a lot of code to parse the inbound and outbound xml and properly setup http header information. MSSOAP wraps alot of that functionality for you, but may not allow the granularity of control required to properly create and process the messages. MSXML seems to be the most flexible and popular choice.
In addition you can try pocketSOAP, but I don't think it's mature enough to interop with our service. pocketSOAP is very promising, but at this stage, it may be more trouble than it's worth.
Below is a snippet that shows how to login.
Option Explicit
Const NAME_SPACES = "xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" " & _
"xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" " & _
"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" " & _
"xmlns:sfdc=""urn:enterprise.soap.sforce.com"""
Private top_g_serverAddress As String '= "https://www.salesforce.com/services/Soap/c/2.0"
Public parseIndex
Public Function initXMLHTTP()
'//this sucks, but the doc's say that the object has to be reset before it can be reused, just not
'//how to reset them
If Not g_xmlhttp Is Nothing Then Set g_xmlhttp = Nothing
Set g_xmlhttp = New MSXML2.XMLHTTP30
g_xmlhttp.Open "POST", top_g_serverAddress, False
g_xmlhttp.setRequestHeader "SOAPAction", """"""
g_xmlhttp.responseXML.validateOnParse = False
End Function
Public Function doLogin(ByVal userName As String, ByVal password As String)
Dim s As String
s = buildLoginQuery(userName, password)
'//internal callback function from msxml handler
Dim doc As MSXML2.DOMDocument30
Set doc = sendRequest(s)
Do While g_xmlhttp.readyState <> 4
DoEvents
Loop
doc.setProperty "SelectionNamespaces", "xmlns=""urn:enterprise.soap.sforce.com"" xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"""
Dim nl As IXMLDOMElement
Set nl = doc.selectSingleNode("/soapenv:Envelope/soapenv:Body/soapenv:Fault")
If nl Is Nothing Then
loginFinished doc
Else
MsgBox nl.selectSingleNode("detail").Text, vbOKOnly + vbCritical, "Error on Login"
End If
End Function
Public Function loginFinished(responseXML)
Dim resultXML As MSXML2.IXMLDOMElement
Set resultXML = responseXML.selectSingleNode("/soapenv:Envelope/soapenv:Body/loginResponse/result")
If resultXML Is Nothing Then
Debug.Print "Session has no result, possible bad query."
Exit Function
End If
If getResultNodeValue("serverUrl", resultXML) <> "" Then
URL = getResultNodeValue("serverUrl", resultXML)
End If
gblstrSessionID = getResultNodeValue("sessionId", resultXML)
gblstrUserID = getResultNodeValue("userId", resultXML)
End Function
Dear Dave,
Can you paste a sample ASP or ASP.Net code for Login or link me to a tutorial on salesforce.com for consuming your webservice!
Regards
Tim
Hi esimplest,
The samples for .Net are sufficient for ASP.net I don't have asp samples as this requires MSXML or pocketSOAP and neither support are WSDL very well.
Cheers