Pass response value of one service to other(With Authentication)?

I’ve a service which creates something, in response it generates random number,now i need to pass this random number as a parameter to other service.

Basically i want to know how to handle passing response from one service to other as a parameter?

Please someone guide me on this.

Thanks in advance


RequestObject ro = new RequestObject("x")

String resp = WS.sendRequest(ro).getResponseText()

Now you have your response saved in resp variable. You can either pass it to other method or parse it if you need.

Thanks for the quick response.

I already have the code till getting a response from one service and storing it in a ‘String’.Now the problem is i need to pass the same String value to the other Service as a parameter,i’m looking for those piece of code.

So there is another method for setting request parameter. It takes a List of parameters where you can add whatever you want.

ro.setRestParameters(new List().add(yourParameter))

Sorry Marek,still not clear.

Let me elaborate the problem statement.

I need to test 2 services .Pass response of one service to input to other.
Eg:Service1 and Service2

Service1 has 3 parameters & Service 2 has 2 parameters.


When i send the request(POST) to Service1,in response i’ll get a auto generated number(Eg:1234),now i want to pass this value(1234) to Service2 has a input value along with other parameters

1)If i get a complete working code then it will be helpful.
2)How can we pass dynamic value to HTTP body as a parameter.