使用以下代码调用rest api发布地图服务,发布失败,请帮们看下原因。
<script type="text/javascript">
var host = "http://localhost:8090";
//令牌有效期是一年
var token = "QTPQVdeePnFEusfoGz8y7uhfCRCZGlv5PaFy_tBEtNmRwp6UO_tXrV3eSC5IwbXg_Q0LRjOb3khRjZABmud9nw..";
function AutoOracleDwgToSV() {//自动更新oracle地图服务
var commit=getcommit();
var method="post";
var uri = host + "/iserver/manager/workspaces.rjson?token=" + token;
var async=false;
var user="";
var password="";
//以下示例请求体
//"servicesTypes": ["RESTMAP", "RESTDATA", "WMS111"], "workspaceConnectionInfo": "../samples/data/World/World.sxwu"
commit.open(method,encodeURI(uri),async,user,password);
commit.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//设置请求条件
var requestbody = {};
requestbody.servicesTypes=["RESTMAP", "RESTDATA", "WMS111"];
requestbody.workspaceConnectionInfo={
server="ORCL_10.6.1.0",
username="sys",
password="sa",
type="ORACLE",
database="",
name="workspaceoracle",
driver=null
};
commit.send(toJSON(requestbody));//发送请求
var response = json_parse(commit.responseText, null);
console.log(requestbody,response,"发布复合数据集请求体及响应");
var container = document.getElementById('container');
container.innerHTML +=toJSON(response)+"<br>";
}
</script>