InitialContext iniCtx = getInitialContext();
Service service = (Service)iniCtx.lookup("java:comp/env/service/ConfidentialSecured");
QName portName = new QName("http://org.jboss.ws/samples/secureejb", "ConfidentialPort");
OrganizationService port = (OrganizationService)service.getPort(portName, OrganizationService.class);
Stub stub = (Stub)port;
String address = (String)stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY);
assertEquals("https://" + getServerHost() + ":8443/jaxrpc-samples-ejb/ConfidentialSecured", address);
// test non-confidential access
try
{
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://" + getServerHost() + ":8080/jaxrpc-samples-ejb/ConfidentialSecured");
port.getContactInfo("mafia");
fail("Security exception expected");
}
catch (RemoteException ignore)