1. 程式人生 > >webService測試

webService測試

publicInteger wsText(AmSysServiceWs item) {
    try{
        URL urlObj = newURL(item.getServiceUrl());
HttpURLConnection oc = (HttpURLConnection) urlObj.openConnection();
oc.setUseCaches(false);
oc.setConnectTimeout(2000); //設定超時時間
intstatus = oc.getResponseCode();//請求狀態
if(200 == status) {
            return
1; }else{ return0; } } catch(Exception e) { System.out.println("33333333333333333333"); return0; } }