Prashantkr
31 days agoFrequent Visitor
Endpoint forwarding and routing issue in ReadyAPI, with ReadyAPI SV version 3.58.0.
Hi Everyone, I am new to ReadyAPI, currently i am using ReadyAPI Service Virtualization version 3.58.0. I want to create a SV solution for which scenario is as :
Scenario : I have changed the application pointing to readyAPI service, now from there i want to take the application request based on my scenario 1 and forward it to another api(say https://endpoint2.com/service/user with post method). the failed scenario request should be passed through to the real server(say https://realserver.com/services/user).
i am using below groovy script, any help is appreciated:
import groovy.util.*
import groovy.xml.*
import com.eviware.soapui.model.mock.MockRunner
import com.eviware.soapui.model.mock.MockResult
// Access the request content
def requestContent = mockRequest.getRequestContent()
// Use context to get the mockResult
def mockResult = context.mockResult
def requestBody = mockRequest.getRequestContent()
//log.info ("Request Body : "+requestBody)
//def requestContent = mockRequest.getRequestContent()
if (patientID =="12345678") {
//def endpoint1 = "https://endpoint2.com/service/user"
log.info ("Request Body : "+requestBody)
context.setForwardUrl("https://endpoint2.com/service/user")
//mockResult.setForwardUrl(endpoint1)
log.info("Forwarded to Endpoint kkdevgp--kkmsqa1")
return "Scenario-1"
}else {
return "Scenario-3"
}
it's throwing below error:
WARN: Failed to send request: java.net.ConnectException