rest
  • groovy
  • httpresponse
  • 2017-10-09 23 views 0 likes 
    0

    「原因:groovy.lang.GroovyRuntimeException:groovyx.net.http.HttpResponseExceptionの一致するコンストラクタが見つかりませんでした.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)を受け入れます。

    関連する問題