0
我碰到一個錯誤,它說:「由於:groovy.lang.GroovyRuntimeException:找不到匹配的構造函數:groovyx.net.http.HttpResponseException(java .lang.Integer,java.lang.String)「當在下面運行代碼時。我錯過了什麼嗎?謝謝!找不到匹配的構造函數:groovyx.net.http.HttpResponseException
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')
import groovyx.net.http.Method
import groovyx.net.http.RESTClient
import org.apache.http.entity.StringEntity
import groovyx.net.http.ContentType
import groovyx.net.http.HttpResponseException
import groovyx.net.http.HttpResponseDecorator
class callmpgPortout implements Runnable {
// Input variables
String MSISDN;
Date REQUEST_START_TIME;
String NP_TXN_ID;
String PORT_ID;
String LOG_ID;
String OLO;
String VARIABLE1;
String VARIABLE2;
String VARIABLE3;
String VARIABLE4;
String VARIABLE5;
// Output variables
String MSGCODE;
String MSGDESC;
private Long status;
public void run() {
def client = new RESTClient('http://sgbdcmpweb01:7980')
client.handler.failure = { resp, data ->
resp.setData(data)
String headers = ""
resp.headers.each {
headers = headers+"${it.name} : ${it.value}\n"
}
throw new HttpResponseException(resp.getStatus(),"HTTP call failed. Status code: ${resp.getStatus()}\n${headers}\n"+
"Response: "+(resp as HttpResponseDecorator).getData())
return resp
}
def resp = client.post(
path : '/RTDM/rest/runtime/decisions/mpgPortout',
requestContentType : ContentType.JSON,
body: [ version:'1', correlationId:'91', clientTimeZone:'GMT', inputs: [MSISDN:'MSISDN',REQUEST_START_TIME:'REQUEST_START_TIME',NP_TXN_ID:'NP_TXN_ID',PORT_ID:'PORT_ID',LOG_ID:'LOG_ID',OLO:'OLO',VARIABLE1:'VARIABLE1',VARIABLE2:'VARIABLE2',VARIABLE3:'VARIABLE3',VARIABLE4:'VARIABLE4',VARIABLE5:'VARIABLE5'] ]
)
status = resp.status;
}
public Long getStatus() {
return status;
}
}