Having read through my last post, I realised it wasn't really very clear what I was doing/having a problem with. Hopefully now it isn't so early in the day I can be a bit clearer!
So, I have an EJB that I have secured. I can connect to this through my remote client. The remote client has a jndi.properties file that defines the various values for the principal, credentials, factory.initial, etc. This is working fine.
Then I've got a servlet that I'm using as a webservice. This takes a couple of parameters for the principal and credentials. This then calls
Hashtable env = new Hashtable(); env.put("java.naming.security.principal", principal); env.put("java.naming.security.credentials", credentials); nameCtxt = new InitialContext(env);