2017-10-09 74 views
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; 
     } 
    } 

回答

0

只有一个用于groovyx.net.http.HttpResponseException构造和它仅接受一个groovyx.net.http.HttpResponseDecorator(即在样品中RESP)。

相关问题