응용프로그램은 Bean의 홈 인터페이스를 통해 알맞은 원격 세션 Bean에 액세스합니다.
이 타스크의 수행 목적 및 시기
세션 Bean은 프로세스 응용프로그램에 대해서는 BusinessFlowManager 세션 Bean 또는
타스크 응용프로그램에 대해서는 HumanTaskManager 세션 Bean일 수 있습니다.
이 타스크의 단계
- 원격 세션 Bean에 대한 참조를 응용프로그램 전개 설명자에 추가하십시오. 다음 파일 중 하나에
참조를 추가하십시오.
- J2EE(Java™ 2 Platform,
Enterprise Edition) 클라이언트 응용프로그램의 경우, application-client.xml 파일
- 웹 응용프로그램의 경우, web.xml 파일
- EJB(Enterprise JavaBeans™)
응용프로그램의 경우, ejb-jar.xml 파일
프로세스 응용프로그램의 원격 홈 인터페이스에 대한 참조가 다음 예에 표시됩니다.
<ejb-ref>
<ejb-ref-name>ejb/BusinessFlowManagerHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.ibm.bpe.api.BusinessFlowManagerHome</home>
<remote>com.ibm.bpe.api.BusinessFlowManager</remote>
</ejb-ref>
타스크 응용프로그램의 원격 홈 인터페이스에 대한 참조가 다음 예에 표시됩니다.
<ejb-ref>
<ejb-ref-name>ejb/HumanTaskManagerHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.ibm.task.api.HumanTaskManagerHome</home>
<remote>com.ibm.task.api.HumanTaskManager</remote>
</ejb-ref>
WebSphere®
Integration Developer를 사용하여 EJB 참조를 전개 설명자에 추가하는 경우 EJB 참조의 바인딩은
응용프로그램이 전개될 때 자동으로 작성됩니다. EJB 참조 추가에 대한 자세한 내용은
WebSphere Integration Developer
문서를 참조하십시오.
- 응용프로그램에서 생성된 스텁을 패키지하십시오.
사용자의
응용프로그램이 BPEContainer 응용프로그램 또는 TaskContainer 응용프로그램이 실행되는
JVM(Java Virtual Machine)과 다른 JVM에서 실행되는 경우
다음 조치를 완료하십시오.
- 프로세스 응용프로그램의 경우,
<install_root>/ProcessChoreographer/client/bpe137650.jar 파일을
응용프로그램의 EAR(Enterprise Archive) 파일에 패키지하십시오.
- 타스크 응용프로그램의 경우, <install_root>/ProcessChoreographer/client/task137650.jar
파일을 응용프로그램의 EAR 파일에 패키지하십시오.
- 응용프로그램 모듈의 manifest 파일에 있는 Class-Path 매개변수에
Jar 파일이 포함되도록 설정하십시오. 응용프로그램 모듈은 J2EE 응용프로그램, 웹 응용프로그램 또는 EJB 응용프로그램일 수 있습니다.
- JNDI(Java
Naming and Directory Interface) 찾아보기 메커니즘을 사용하여
세션 Bean의 홈 인터페이스를 응용프로그램에서 사용할 수 있도록 합니다. 다음 예는
프로세스 응용프로그램에 대한 해당 단계를 표시합니다.
// Obtain the default initial JNDI context
InitialContext initialContext = new InitialContext();
// Lookup the remote home interface of the BusinessFlowManager bean
Object result =
initialContext.lookup("java:comp/env/ejb/BusinessFlowManagerHome");
// Convert the lookup result to the proper type
BusinessFlowManagerHome processHome =
(BusinessFlowManagerHome)javax.rmi.PortableRemoteObject.narrow
(result,BusinessFlowManagerHome.class);
세션 Bean의 홈 인터페이스에는
EJB 오브젝트에 대한 작성 메소드가 포함됩니다.
이 메소드는 세션 Bean의 원격 인터페이스를 리턴합니다.
- 세션 Bean의 원격 인터페이스에 액세스하십시오. 다음 예는
프로세스 응용프로그램에 대한 해당 단계를 표시합니다.
BusinessFlowManager process = processHome.create();
- 서비스 인터페이스에서 표시한 비즈니스 기능을 호출하십시오. 다음 예는
프로세스 응용프로그램에 대한 해당 단계를 표시합니다.
process.initiate("MyProcessModel",input);
응용프로그램의 호출이 트랜잭션으로 실행됩니다. 트랜잭션은
다음 방법 중 하나로 설정 및 종료됩니다.
다음 예제에서는 3단계에서 5단계까지를 통해 타스크 응용프로그램을 찾는 방법을
보여줍니다.
// Obtain the default initial JNDI context
InitialContext initialContext = new InitialContext();
// Lookup the remote home interface of the HumanTaskManager bean
Object result =
initialContext.lookup("java:comp/env/ejb/HumanTaskManagerHome");
// Convert the lookup result to the proper type
HumanTaskManagerHome taskHome =
(HumanTaskManagerHome)javax.rmi.PortableRemoteObject.narrow
(result,HumanTaskManagerHome.class);
...
//Access the remote interface of the session bean.
HumanTaskManager task = taskHome.create();
...
//Call the business functions exposed by the service interface
task.callTask(tkiid,input);