1
0
-1

We are having difficulty with the PostRequest calls made TM services to other TM boxes.

In the first example (written in Fluent), it all works ... we can retrieve back the request details when calling from Service 1a to Groovy Service 1b.    Note: Groovy Service 1b acts as a REST Endpoint (as the plan is to move the service to another TM box later).


// The 'calling' Service 1a
String message = '''{
"success": ''' + params.get('success')+'''

}''

//endpoint = Groovy Service 1b
HttpResponse response = new PostRequest(endpoint)
.setMessage(message)
.setBasicAuth(username, password)
.execute(



// Groovy Service 1b

String myStream = org.apache.commons.io.IOUtils.toString(request.getInputStream());

def result = myStream
return result
// returns back always the {"success":true} JSON payload - correct

However, if we plan in this for a TM box (4.3), then things fail, in the example below refactored for standard groovy (non fluent), then 


a) the parameters can never be read AND

b) we do not seem to have access to the request object, therefore the inputstream is not exposed and we can't attempt to get what is passed down this route either


Any ideas ?


// The 'calling' Service 2a 

String message = '''{
"success": ''' + parameters.get('success')+'''

}'''

def parms=[:]
parms.success=parameters.get('success')

//endpoint = Groovy Service 2b
def response = new PostRequest(endPoint)
response.setMessage(message)
response.setBasicAuth(username, password)
response.setParams(parms)

result = response.execute()
// Returns back always null, null, 0

// Groovy Service 2b

def result = 'parameters:'+parameters+' , '+'success:'+parameters['success']+ ' , '+'size:'+parameters.size()
// Returns back always [:], null, 0
    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Solution is to remove the .setmessage call in Groovy Service 2b, that masks the payload completely - then the parameters can be read

        CommentAdd your comment...