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

Comments

  1. 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

    ReplyDelete
  2. Please note that the Login call works, it's like it's forgetting the handle it has on the connection.

    ReplyDelete
  3. exactly 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.

    ReplyDelete
  4. What is SOAPUi exactly? The site is far from clear.

    ReplyDelete
  5. a tool that helps you import a wsdl and test functionality while also seeing the request and response in raw format

    ReplyDelete
  6. The basic sad truth is that doing webservices without RemObjects is hard... :(

    ReplyDelete
  7. I'd rephrase your comment into something like "the basic sad truth is that doing webservices in delphi is a lengthy process"

    try C# if it's an option, it should be much faster and straight forward(haven't done it tho'...).

    ReplyDelete
  8. 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.

    ReplyDelete
  9. C# is not that bad, you can get used to it quite easily...

    another thing you can do is to try to import the wsdl with various parameters, sometimes this works...

    ReplyDelete
  10. Andrea Raimondi If you have RO, why can you not use it in this case?

    ReplyDelete
  11. Also, if you're not dealing with SOAP, the RealThinClient SDK is excellent for creating and consuming web services.

    ReplyDelete
  12. I have an old version that does not work properly in XE.
    I would like to keep things opened, including SOAP.
    The idea behind this proof of concept will(hopefully) become a product.

    A

    ReplyDelete
  13. 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?

    ReplyDelete
  14. It's mostly strings and an XSDate.
    As stated, however, the method does not even get called(the breakpoint does not "break").

    A

    ReplyDelete
  15. are you sure the source matches the DCU compiled into your application?

    ReplyDelete
  16. Andrea Raimondi why not set a breakpoint a line before and look into disassembler view to figure out what your source was compiled into?

    ReplyDelete
  17. also:
    - disable optimizations
    - use debug dcu's

    ReplyDelete
  18. Oh yeah, switch off optimization first! I really don't know why but it made perpetual for-cycle once in my code.

    ReplyDelete
  19. FUserService.GetEmployeeDetails( Token, EmpDetails );
    maybe 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)

    ReplyDelete
  20. As I said, the remote method is not being called, because the server side breakpoint I put on it isn't reached.
    I will restart both today and try again though - could be some awful cache issue.

    A

    ReplyDelete

Post a Comment