2014-12-03 6 views
1

ONVIF 호환 IP 카메라 서비스에 Apache CXF를 사용할 것입니다.Apache CXF를 사용한 WS-Discovery 장치 유형을 지정하는 방법은 무엇입니까?

은 CXF-서비스-WS-검색 서비스 항아리가 자동으로 "안녕하세요" 메시지를 게시하는 ServerLifecyleListener을 등록합니다 : 아웃 오브 박스는 기기와 서비스 및 cxf supports it을 찾기 위해 WS-발견을 사용 . 또한 게시 된 서비스와 일치하는 모든 프로브 요청에 응답합니다.

cxf는 ProbeMatches 응답으로 보낼 장치 유형을 어떻게 감지합니까? 내 장치가 IP 카메라인지 지정하려면 어떻게해야합니까? (예 :과 같이 ProbeMatches 응답에서 구체적인 장치 유형을 설정해야합니다)?

답변

0

CXF 소스 코드 (WSDiscoveryServiceImpl 클래스)에보고 한 후 내가 답을 발견했습니다

public ProbeMatchesType handleProbe(ProbeType pt) { 
     List<HelloType> consider = new LinkedList<HelloType>(registered); 
     //step one, consider the "types" 
     //ALL types in the probe must be in the registered type 
     if (pt.getTypes() != null && !pt.getTypes().isEmpty()) { 
      ListIterator<HelloType> cit = consider.listIterator(); 
      while (cit.hasNext()) { 
       HelloType ht = cit.next(); 
       boolean matches = true; 
       for (QName qn : pt.getTypes()) { 
        if (!ht.getTypes().contains(qn)) { 
         matches = false; 
        } 
       } 
       if (!matches) { 
        cit.remove(); 
       } 
      } 
     } 
     //next, consider the scopes 
     matchScopes(pt, consider); 

     if (consider.isEmpty()) { 
      return null; 
     } 
     ProbeMatchesType pmt = new ProbeMatchesType(); 
     for (HelloType ht : consider) { 
      ProbeMatchType m = new ProbeMatchType(); 
      m.setEndpointReference(ht.getEndpointReference()); 
      m.setScopes(ht.getScopes()); 
      m.setMetadataVersion(ht.getMetadataVersion()); 
      m.getTypes().addAll(ht.getTypes()); 
      m.getXAddrs().addAll(ht.getXAddrs()); 
      pmt.getProbeMatch().add(m); 
     } 
     return pmt; 
    } 

간단히 - 그것은 출판 서비스를 반복 처리의 QName를 비교합니다. 검색된 qname이 출판물에서 발견되면 ProbeMatch에 추가됩니다. 그래서 그것을 구현하기 위해 필요한 QName 서비스를 구현하고 게시해야합니다.