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());
String value = "";
Object oVal = psp.getValue();
if ((oVal != null) && (oVal instanceof String)) {
value = Val.chkStr((String)oVal);
}
if ((key.length() > 0) && (value.length() > 0)) {
//System.err.println(key+"=="+value);
if (key.equalsIgnoreCase("Title")) {
serviceInfo.setName(value);
} else if (key.equalsIgnoreCase("Author")) {
serviceInfo.setCreator(value);
} else if (key.equalsIgnoreCase("Comments")) {
serviceInfo.addRDFPair("mxd.comments",value);
} else if (key.equalsIgnoreCase("Subject")) {
serviceInfo.addRDFPair("mxd.subject",value);
} else if (key.equalsIgnoreCase("Category")) {
serviceInfo.addRDFPair("mxd.category",value);
} else if (key.equalsIgnoreCase("Keywords")) {
serviceInfo.addKeywords(value,",");
} else {
}
}
}
}
}
// layers
MapLayerInfo[] layers = mapInfo.getMapLayerInfos();
if (layers != null) {
for (MapLayerInfo layer: layers) {
serviceInfo.addRDFPair("service.layername",layer.getName());
/*
System.err.println("layerName="+layer.getName());