Webservice+XMLPort

NoiK00NoiK00 Member Posts: 51
edited 2013-09-25 in NAV Three Tier
Hi all,

I've setup some webservices which returns the contents of a XMLport. Therefor i used the guides found here:
http://www.kauffmann.nl/blog/index.php/ ... ervices-1/

Also i've set up some specific filtering in the result, which works from the codeuit. But it seems that when the input isn't correct the webservice returns a unfiltered XMLPort as a result. Is there a way to just return with an empty XMLport or error string?

Heres the code i've tried:
UserPermissions(VAR UserPermission : XMLport "User Permissions";userId : Code[10])
IF userId <> '' THEN
BEGIN
  users.SETFILTER(users."No.", userId);

  UserPermission.SETTABLEVIEW(users);
END
ELSE
  //TODO: empty values instead of unfiltered XMLPort
  ERROR('Enter UserID');

Thanks in advance,
NoiK

Comments

  • mrQQmrQQ Member Posts: 239
    well you can always just set a filter on users which will not match anything, like

    users.setfilter("no.", '%1', '');

    or something like that.
  • james_csjames_cs Member Posts: 39
    or break the XML port if there is no user ID filter

    eg

    OnPreXMLPort
    IF Users.GETFILTER("No.") = '' THEN
    currXMLport.BREAK;
  • NoiK00NoiK00 Member Posts: 51
    my apologies, the code i posted DID work. Had to dig further in the error messages.
Sign In or Register to comment.