You need to sign in to do that
Don't have an account?
Pohukai
SOAP API with Delphi
I was able to easily import the WSDL into Delpi XE and make a SOAP connection to Saleforce. However, according to documentation, doing anything with the connection requires the serverURL to used as the END_POINT, including the Logout. How is this done? There are no methods/propererites available to do this in the code generated in the WSDL import.
I aways get the "UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService.
Any ideas? and doing this in JAVA is not an option.
// Create service object SalesForce := GetSoap; // Invoke the login call and save results in LoginResult lr := SalesForce.login(cUserName, cPassword + cSecurityToken); memo.Lines.Add( 'serverurl: ' + lr.serverUrl); memo.Lines.Add( 'sessionid: ' + lr.sessionId); //Somehow, the "endPoint" / lr.serverurl needs to updated in the SalesForce object for any more calls can be made...but how? No "endpoint" methods //or properties exist in the unit that was created when the WSDL was imported. SalesForce.logout;
The URL you used for the login is ONLY used for the login call. It creates a session and returns the sessionID and the correct URL for all the SOAP calls you are going to make during your session. Take a look at all the xml data returned from your login. The new endpoint ends up being your instance URL.
This is an old post, but I encountered the same problems trying to get Delphi to work with Salesforce APIs. There are two things you need to specify with each API invocation:
The destination URL is specified with an overloaded version of the GetSoap function. To build on your example some more, use the following:
The Session ID is handled by a SOAP header of class SessionHeader. Here's an example of a Logout that specifies both destination URL and Session ID:
In this example I have refactored the SOAP interface to SFSOAP to avoid name clashes. The example stores the values for the target URL and Session ID in Labeled Edit Boxes although in practice you would probably not want to display these values to the user. You also need to include the SOAP.InvokeRegistry unit in your uses clause. (This is the source of the "SOAP" name clash.
What unit is the SessionHeader in?
The SessionHeader is a class defined in the WSDL. You must first obtain and prepare the WSDL (an XML Document) from Salesforce. You can use the WSDL Import Wizard from the Delphi IDE to import and process the WSDL directly from Salesforce or you can use the WSDLIMP.exe command line program to process a WSDL XML file you have previously downloaded from Salesforce. Either way, you get a Unit that you must include in your project.
The Pascal unit you obtain from either method contains the definition for the SessionHeader class:
The WSDL unit I clipped the example from contains nearly 66,000 lines of code, so it's not easy to find without search tools.
Hope this helps.