1 Reply Latest reply on Nov 12, 2008 4:19 PM by Shane Bryzak

    Restrict not loggedIn not working in WebService

    Shervin Asgari Master


      I have looked on how the Seambay example works like, and they have a method login and logout, and another with @Restrict.
      However, they are using JavaScript to use the webservice, whilst I have the more common Axis way of doing it.

      However, when I use my stub to call the login, I can see in the server that it logs in correctly, and then when I call my restricted method, I get an exception that it is not logged in.

      This is my webservice:

      @WebService(name = "RelationService", serviceName = "RelationService")
      @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
      public class RelationService implements RelationServiceLocal {
              public boolean login(@WebParam(name = "username")
              String username, @WebParam(name = "password")
              String password) {
                      return Identity.instance().isLoggedIn();
              public boolean logout() {
                      return !Identity.instance().isLoggedIn();
              public List<RelationCanonical> getRelationsFromPerson(@WebParam(name = "foedselsnummer") { 

      And this is my @Test class using the stub. The problem may be that I am not familiar in using webservice.

      RelationServiceStub stub = new RelationServiceStub();
                      assert stub != null;
                      // We need to first log in, then perform action, then log out
                      RelationServiceStub.Login login = new RelationServiceStub.Login();
                      RelationServiceStub.LoginE loginImpl = new RelationServiceStub.LoginE();
                      RelationServiceStub.LoginResponseE loginRes = stub.login(loginImpl);
                      // stub.startlogin(loginImpl, callback)
                      assert loginRes != null;
                      RelationServiceStub.LoginResponse rslr = loginRes.getLoginResponse();
                      boolean isLoggedIn = rslr.get_return();
                      assert isLoggedIn == true;
                      // stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
                      // Boolean.FALSE);
                      RelationServiceStub.GetRelationsFromPerson getRFP = new RelationServiceStub.GetRelationsFromPerson();
                      RelationServiceStub.GetRelationsFromPersonE rfpImpl = new RelationServiceStub.GetRelationsFromPersonE();
                      RelationServiceStub.GetRelationsFromPersonResponseE response = stub.getRelationsFromPerson(rfpImpl);

      The console shows that I do infact log in, but the last line throws notLoggedIn Exception.