* @throws Exception if an exception occurs
*/
@Override
public void collectMetadata(ServiceHandlerFactory handlerFactory, ServiceInfo serviceInfo)
throws Exception {
MapServerBindingStub stub =
getCredentials()==null || getCredentials().getUsername().length()==0 || getCredentials().getPassword().length()==0?
new MapServerBindingStub(serviceInfo.getSoapUrl()):
new MapServerBindingStub(serviceInfo.getSoapUrl(), getCredentials().getUsername(), getCredentials().getPassword());
serviceInfo.getKeywords().add(serviceInfo.getType());
serviceInfo.addKeywords("liveData,service",",");
MapServerInfo mapInfo = stub.getServerInfo(stub.getDefaultMapName());
//serviceInfo.setName(mapInfo.getName());
serviceInfo.setDescription(mapInfo.getDescription());
serviceInfo.setEnvelope(mapInfo.getFullExtent());
//serviceInfo.setEnvelope(mapInfo.getExtent());
/*
System.err.println("nm="+mapInfo.getDefaultMapDescription().getName());
System.err.println("ld="+mapInfo.getDefaultMapDescription().getLayerDescriptions());
System.err.println(" getDefaultMapName()="+service.getDefaultMapName());
System.err.println(" getCopyrightText()="+mapinfo.getCopyrightText());
System.err.println(" getMapLayerInfos()="+mapinfo.getMapLayerInfos());
System.err.println(" getSpatialReference()="+mapinfo.getSpatialReference());
System.err.println(" getDefaultMapDescription()="+mapinfo.getDefaultMapDescription());
*/
// thumbnail
String thumbnailUrl = Val.chkStr(serviceInfo.getRestUrl());
if (thumbnailUrl.length() > 0) {
if (!thumbnailUrl.endsWith("/MapServer")) {
int idx = thumbnailUrl.lastIndexOf("/MapServer/");
if (idx != -1) {
thumbnailUrl = thumbnailUrl.substring(0,idx+10);
}
}
if (thumbnailUrl.endsWith("/MapServer")) {
serviceInfo.setThumbnailUrl(thumbnailUrl+"/export?size=256,256&f=image");
}
}
// MXD properties
PropertySet docInfo = stub.getDocumentInfo();
if (docInfo != null) {
PropertySetProperty[] psps = docInfo.getPropertyArray();
if (psps != null) {
for (PropertySetProperty psp: psps) {
String key = Val.chkStr(psp.getKey());