2017-10-09 8 views
0

J'ai rencontré une erreur indiquant: "Causée par: groovy.lang.GroovyRuntimeException: Impossible de trouver le constructeur correspondant pour: groovyx.net.httpResponseException (java .lang.Integer, java.lang.String) "lors de l'exécution du code ci-dessous. Est-ce que je manque quelque chose? Merci!Impossible de trouver le constructeur correspondant à: 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; 
     } 
    } 

Répondre

0

Il n'y a qu'un seul constructeur pour groovyx.net.http.HttpResponseException et il accepte seulement groovyx.net.http.HttpResponseDecorator (à savoir respectivement dans l'échantillon).