Last active
February 14, 2016 12:42
-
-
Save dimovelev/aa4edf654227e956ec45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebService | |
public class FacadeJaxWs implements FacadeWebService { | |
@EJB(lookup = "FrontendEjb") | |
protected FrontendEjbHome frontendEjbHome; | |
public void updateCustomer() { | |
Context ctxBackend = null; | |
try { | |
Properties envBackend = new Properties(); | |
envBackend.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); | |
envBackend.put(Context.PROVIDER_URL, "t3://backend:7001"); | |
envBackend.put(Context.SECURITY_PRINCIPAL, "backend_user"); | |
envBackend.put(Context.SECURITY_CREDENTIALS, "backend_password"); | |
ctxBackend = new InitialContext(envBackend); | |
BackendEjbHome home = (BackendEjbHome) ctxBackend.lookup("BackendEjb"); | |
BackendEjb remote = home.create(); | |
remote.updateCustomerInBackend(mode); | |
} finally { | |
if (ctxBackend != null) { | |
ctxBackend.close() | |
} catch (NamingException e) { | |
// do not rethrow as this might swallow any exception thrown before that | |
// at least log it... | |
} | |
} | |
FrontendEjb remote = frontendEjbHome.create(); | |
remote.updateCustomerInFrontend(mode); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment