When I make a call to a SOAP API method I am getting the following message:
First chance exception at $74EDB9BC. Exception class EAccessViolation with
message 'Access violation at address 007004F6 in module 'DB2.exe'.
Read of address 00000005'. Process DB2.exe (3768)
Here is what I am getting from the stack trace:
74EDB9AF 8945C0 mov [epb-$40],eax
74EDB9B2 8D45B0 lea eax,[edp-$50]
74EDB9B5 50 push eax
74EDB9B6 FF155C11ED74 call dword ptr [$74ed115c]
74EDB9BC C9 leave
I am not very familiar with Delphi (just maintaining an older program). Can someone tell me how to debug what is happening here? I am using Delphi 2005.
Here is the code that is failing. The error comes when calling UpdateContact
and I know the data for aContact
& FCompanyID
are there and correct:
function TScheduleCenterBeta.AccountUpdate(aContact: c_ScheduleCenterBetaAPI.Contact): boolean;
begin
try
SendAuthHeader();
FContact := FSoapService.UpdateContact(aContact, FCompanyID);
except
on e:Exception do begin
MessageDlg(e.Message,mtWarning,[mbOK],0);
end;
end;
result := true;
end;
The object FContact
is created when creating the master object:
constructor TScheduleCenterBeta.Create(aOwner: TComponent; aCallID: integer = -1);
begin
inherited Create(aOwner);
FCallID := aCallID;
FCompanyID := c_ScheduleCenterBetaAPI.CompanyID.Create();
FCompanyID.ServiceCompanyID := StrToInt(TfrmCall(Screen.ActiveForm).Company.IP_CompanyID);
FProperty_ := c_ScheduleCenterBetaAPI.Property_.Create();
FContact := c_ScheduleCenterBetaAPI.Contact.Create();
FContact.ContactID := -1;
FContact.Address := c_ScheduleCenterBetaAPI.Address.Create();
FAppointmentSlot := c_ScheduleCenterBetaAPI.AppointmentSlot.Create();
end;
One other oddity is that the error comes and goes. If I stop the program and then start it again (using Delphi debug mode) I may or may not encounter the error. I have also restarted Delphi to make sure it wasn't something with Delphi itself but that didn't seem to change anything.