尋找到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的服務來修復它。