예: WS-Notification 가져오기 위치에서 메시지 가져오기

제공된 코드 추출 예를 기반으로, 가져오기 위치에서 메시지를 요청하여 가져오기 스타일 이용자 역할을 수행하는 JAX-RPC 클라이언트에 대한 코드를 작성하려면 이 태스크를 사용합니다.

이 태스크 정보

이 예제는 XML 기반 원격 프로시저 호출(JAX-RPC) API용 Java™ API를 WS-Notification 서비스 지점 작성의 결과로 생성된 알림 브로커 WSDL에 대해 실행되는 WSDL2Java 도구를 사용하여 생성된 코드와 WebSphere® Application Server API 및 SPI와 함께 사용하는 것을 기반으로 합니다.

WebSphere Application Server에서는 WS-Notification 서비스의 두 가지 구현(버전 6.1 및 버전 7.0)이 있습니다. 이 JAX-RPC 예제는 버전 6.1 또는 버전 7.0 WS-Notification 서비스 지점과 상호작용할 수 있습니다. 그러나 정책 세트가 있는 WS-Notification을 사용하려면(예를 들어, WS-ReliableMessaging이 있는 컴포지션을 사용하려면), WS-Notification 애플리케이션이 XML 기반 웹 서비스(JAX-WS) 프로그래밍 모델용 Java API를 사용하도록 인코딩되어야 하며 버전 7.0 WS-Notification 서비스 지점과 상호작용해야 합니다. JAX-WS 클라이언트 애플리케이션 프로그래밍에 생소하면 다음 주제를 참조하십시오.

코드 추출 예에서 추가 정보를 참조하여, 가져오기 위치에서 메시지를 요청하여 가져오기 스타일 이용자 역할을 수행하는 JAX-RPC 클라이언트에 대한 코드를 작성하려면 다음 단계를 완료하십시오.

프로시저

  1. JAX-RPC 서비스를 찾아보십시오. JNDI 이름은 웹 서비스 클라이언트 구현에 따라 다릅니다.
  2. 조작을 호출하려는 포트의 스텁을 가져오십시오.
  3. 요청과 가져오기 위치를 연관시키십시오. pullPointEPR은 CreatePullPoint 연산을 호출하여 리턴되는 EndpointReference입니다.
  4. 검색하려는 메시지 수를 지정하십시오.
  5. 선택적 정보를 작성하십시오.
  6. 요청 정보를 작성하십시오.
  7. 스텁에 대한 연관된 메소드를 호출하여 GetMessages 조작을 호출하십시오.
  8. 응답에서 리턴된 메시지를 가져오십시오.

다음 코드 예는 가져오기 위치에서 메시지를 요청하여 가져오기 스타일 이용자 역할을 수행하는 JAX-RPC 클라이언트를 설명합니다.

// Look up the JAX-RPC service. The JNDI name is specific to your web services client implementation
InitialContext context = new InitialContext();
javax.xml.rpc.Service service = (javax.xml.rpc.Service) context.lookup(
    "java:comp/env/services/NotificationBroker");

// Get a stub for the port on which you want to invoke operations
NotificationBroker stub = (NotificationBroker) service.getPort(NotificationBroker.class);

// Associate the request with a pull point. The pullPointEPR is the EndpointReference returned
// from invoking the CreatePullPoint operation
((Stub) stub)._setProperty(WSAConstants.WSADDRESSING_DESTINATION_EPR, pullPointEPR);

// Specify the number of messages you want to retrieve
Integer numberOfMessages = new Integer(2);

// Create any optional information
SOAPElement[] optionalInformation =  new SOAPElement[] {};

// Create the request information
GetMessages request = new GetMessages(numberOfMessages, optionalInformation);

// Invoke the GetMessages operation by calling the associated method on the stub
GetMessagesResponse response = stub.getMessages(request);

// Get the messages returned from the response
NotificationMessage[] messages = response.getMessages();

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tjwsn_ex_pp_get
파일 이름:tjwsn_ex_pp_get.html