• Pohukai
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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;

 

 

I'm able to successfully upload data as an attachment to salesforce.  These are all jpg images.  However, if I do not provide the 'ContentType', when viewing the attachment in a browser, I see the base64 encoded data.  If I use the 'image/jpg' tag, the image is broken and nothing displayed.

 

To confirm the base64 encoded data is valid, I copy that out of the brower and go to an independent decoder website and it creates the jpg correctly.

 

What am I not setting in the SOAP?

 

This is Delphi.

 

Jim

 

 

TheAttachment := Attachment.Create;
TheAttachment.ParentId := aCaseID; //required
TheAttachment.ContentType := 'image/jpg';
TheAttachment.IsPrivate := False;
FileData := ArrOfByte(aDataStream.GetAsString); //aDataStream is already base64 encoded.
TheAttachment.Body := FileData;
TheAttachment.Description := aName;
TheAttachment.Name_ := aName; //required
SetLength(AttachmentArray,1);
AttachmentArray[0] := TheAttachment;
cr := fBinding.create( AttachmentArray );
if not cr[0].success then
  ShowMessage(aName + ' not saved to SalesForce CaseID: ' + aCaseID);