rest api发布服务 连接失败??

0 投票
242 浏览
var token="TmV7n19CYk8F5RWsUb7pJF0zd-w7yQvSVe8NtUwnEK2K7C7iehJTpUZ9TwC_RA81dtIq6uJfvBa7t5JyWfvYBg..";
var url;
var requestBody;
function uploadmap(){
    var destUrl=
            "http://localhost:8090/iserver/manager/workspaces.rjson?returnContent=true&token=";
    url=destUrl+token;
    if(window.XMLHttpRequest){  
         
        xmlHttprequest=new XMLHttpRequest();  
        if(xmlHttprequest.overrideMineType){  
             
            xmlHttprequest.overrideMineTYpe("text/xml");  
        }  
    }else if(window.ActiveXObject){  
         
        var activeName=["MSXM2.XMLHTTP","Miscrosoft.XMLHTTP"];  
        for(var i=0;i<activeName.length;i++){  
            try {  
               xmlHttprequest=new ActiveXObject(activeName[i]);  
               break;  
            } catch (exception) {  
                 
            }             
        }  
    }  
 if(xmlHttprequest==undefined || xmlHttprequest==null){  
        alert("鍒涘缓xmlHttprequest澶辫触");  
         
    }else{  
        this.xmlhttp=xmlHttprequest;  
    }
    
   
    
    var method="POST";
    var async=false;
//    var requestbody = {};
//    requestbody.servicesTypes=["RESTMAP", "RESTDATA", "WMS111"];
//    requestbody.workspaceConnectionInfo="C:\Users\Administrator\Desktop\testData.smwu";
    
    var requestBody={
    
    "servicesTypes": ["RESTMAP", "RESTDATA", "WMS111"],

    "workspaceConnectionInfo": "./testDate/testData.smwu"

    };
    
    xmlHttprequest.open(method,url,async);
    
    
    xmlHttprequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    xmlHttprequest.send(JSON.stringify(requestBody));
    alert(JSON.stringify(requestBody));

//运行之后得到500error:工作空间信息连接失败
最新提问 7月 12, 2017 分类:  242次浏览 | 用户: 啊Sam2080 (0 分)

1个回答

0 投票

1. 若写相对路径, ./ 即当前目录是iServer应用根目录,即tar或zip包安装目录下/webapps/iserver目录
2. 若写绝对路径,Windows下需要将 \ 换成 /
3. 应站在iServer的角度看待,比如,iServer所在机器是否存在该路径、能否正常打开该工作空间文件及根据工作空间文件的记录打开对应的数据源(文件型或数据库型数据源)

最新回答 7月 13, 2017 用户: 毛瑞 名扬四海 (1,768 分)
...