Hello!
Hello!
I am sure I am overlooking something stupid :)
This is my code:
private
FUserToken: String;
FUserService : IUserService;
{ Private declarations }
public
{ Public declarations }
procedure DoLogin( UserName, Password: String );
procedure DoGetEmployeeDetails( Token : String; out EmpDetails : TEmployeeDetails );
property UserToken : String read FUserToken;
...
procedure TDMMain.DoGetEmployeeDetails(Token: String;
out EmpDetails: TEmployeeDetails);
begin
if Not Assigned( FUserService ) then
raise Exception.Create('login first');
FUserService.GetEmployeeDetails( Token, EmpDetails );
end;
procedure TDMMain.DoLogin(UserName, Password: String);
begin
FUserService := GetIUserService;
FUserToken := FUserService.Login( UserName, Password );
end;
The Login call works, but apparently when I try calling GetEmployeeDetails, it doesn't even get into the webservice server(put a break point and does not stop).
Ideas?
Thanks!
A
I am sure I am overlooking something stupid :)
This is my code:
private
FUserToken: String;
FUserService : IUserService;
{ Private declarations }
public
{ Public declarations }
procedure DoLogin( UserName, Password: String );
procedure DoGetEmployeeDetails( Token : String; out EmpDetails : TEmployeeDetails );
property UserToken : String read FUserToken;
...
procedure TDMMain.DoGetEmployeeDetails(Token: String;
out EmpDetails: TEmployeeDetails);
begin
if Not Assigned( FUserService ) then
raise Exception.Create('login first');
FUserService.GetEmployeeDetails( Token, EmpDetails );
end;
procedure TDMMain.DoLogin(UserName, Password: String);
begin
FUserService := GetIUserService;
FUserToken := FUserService.Login( UserName, Password );
end;
The Login call works, but apparently when I try calling GetEmployeeDetails, it doesn't even get into the webservice server(put a break point and does not stop).
Ideas?
Thanks!
A
omg... you're in for a surprise... delphi and webservices don't really play well(at least in my experience, went as far as writing the XML directly through TIdTCPClient...), SoapUI is your best friend(http://www.soapui.org/pages/index2/frontpage-soapui-pro2.html), see what it generates, see server output and then compare with delphi's output/input
ReplyDeletePlease note that the Login call works, it's like it's forgetting the handle it has on the connection.
ReplyDeleteexactly these kind of issues were the ones that I had problems with, 1-2 calls were working, then 3-4 didn't... check SoapUI, you'll quickly see the difference.
ReplyDeleteWhat is SOAPUi exactly? The site is far from clear.
ReplyDeletea tool that helps you import a wsdl and test functionality while also seeing the request and response in raw format
ReplyDeleteP.S. it's very easy to use
ReplyDeleteThe basic sad truth is that doing webservices without RemObjects is hard... :(
ReplyDeleteI'd rephrase your comment into something like "the basic sad truth is that doing webservices in delphi is a lengthy process"
ReplyDeletetry C# if it's an option, it should be much faster and straight forward(haven't done it tho'...).
This is a proof of concept and for a number of reasons(not least because I know very little C#) has to be in Delphi.
ReplyDeleteC# is not that bad, you can get used to it quite easily...
ReplyDeleteanother thing you can do is to try to import the wsdl with various parameters, sometimes this works...
Andrea Raimondi If you have RO, why can you not use it in this case?
ReplyDeleteAlso, if you're not dealing with SOAP, the RealThinClient SDK is excellent for creating and consuming web services.
ReplyDeleteI have an old version that does not work properly in XE.
ReplyDeleteI would like to keep things opened, including SOAP.
The idea behind this proof of concept will(hopefully) become a product.
A
I assume you are consuming a web service? If the service does not use the standard types there will be some pain. What does the class generated by the WSDL look like?
ReplyDeleteIt's mostly strings and an XSDate.
ReplyDeleteAs stated, however, the method does not even get called(the breakpoint does not "break").
A
are you sure the source matches the DCU compiled into your application?
ReplyDeleteAndrea Raimondi why not set a breakpoint a line before and look into disassembler view to figure out what your source was compiled into?
ReplyDeletealso:
ReplyDelete- disable optimizations
- use debug dcu's
Oh yeah, switch off optimization first! I really don't know why but it made perpetual for-cycle once in my code.
ReplyDeleteFUserService.GetEmployeeDetails( Token, EmpDetails );
ReplyDeletemaybe GetEmployeeDetails not return any data in EmpDetails,
show header GetEmployeeDetails in FUserService
EmpDetails:TEmployeeDetails it's var parameter in the procedure or not?
procedure GetEmployeeDetails(TokenID:String; var EmpDetails:TEmployeeDetails)
As I said, the remote method is not being called, because the server side breakpoint I put on it isn't reached.
ReplyDeleteI will restart both today and try again though - could be some awful cache issue.
A