0 Replies Latest reply on Aug 27, 2009 6:57 PM by phoenixknight88

    Seam Identity through SOAP Web Services

    phoenixknight88

      Hi,
        I was wondering if anyone can help me. I am currently trying to create web services that tie into my seam set-up using the Java-WS framework. I am currently just trying to create a test ws service but I have run into an issue. When I login a user it works correctly but if I do another web service call after that the user has been logged out.


      Here is my code:-


      import javax.annotation.Resource;
      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      
      import javax.xml.ws.BindingProvider;
      import javax.xml.ws.WebServiceContext;
      
      import org.jboss.seam.Component;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.security.Identity;
      import org.jboss.wsf.spi.annotation.WebContext;
      
      
      import uk.co.kraya.quark.admin.usermanagement.AdminUserHome;
      import uk.co.kraya.quark.domain.AdminUser;
      
      @Stateless
      @Name("agentTestService")
      @WebService(name = "AgentTestServiceWS", serviceName = "AgentTestService")
      @WebContext(contextRoot="agent/services")
      public class TestWS implements TestWSRemote {
              @Resource
              WebServiceContext wsCtxt;
      
              @WebMethod
              public String testMethod() {
                    Identity.instance().getCredentials().setUsername("admin");
                    Identity.instance().getCredentials().setPassword("Password1");
                    Identity.instance().login();
                    return Identity.instance().isLoggedIn() ? "success" : "fail";
              }
              
              @WebMethod
              public String getMyInfo()
              {
                      if(Identity.instance().isLoggedIn())
                      {
                              return Identity.instance().getCredentials().getUsername();
                      }
                      getAuctionAction().getInstance().getEmail();    
                      return "None";
              }
              
              
               private AdminUserHome getAuctionAction()
                 {
                    // Get seam component named "auctionAction" from context
              
                    return (AdminUserHome) Component.getInstance(AdminUserHome.class, true);
                 }
      
      }
      



      Thanks in advance