Forum Discussion
Sure, you can just use Groovy Strings to do that:
String port = "8089" def get = new URL("http://localhost:${port}/budg/inforeuro/api/public/monthly-rates").openConnection()
As for where to set the value for 'port', why not read it directly from the MockService itself?
String port = context.expand('${=project.getRestMockServiceByName("MockService").port}') def get = new URL("http://localhost:${port}/budg/inforeuro/api/public/monthly-rates").openConnection()
- Michalis7 years agoOccasional Contributor
I think that I answer my question when I was writing it. I have the same script, the one that builds the MockService URL and returns the response, in two places. In MockService level and in Get Currencies level (into the MockService). So maybe, the scripts were running one by one, so the first time, the port was taken. So I was receiving a connection refuse exception.
I have retain the script in the Get Currencies level, I hope this is the correct level to have it. And now I am able, using command line to run the service in any port and build dynamically the URL in the MockProxy using the solution you gave me.
Thank you for helping, it was the first time I am writing to such a community, I should have done it earlier.
- Michalis7 years agoOccasional Contributor
Nice, thank you for the reply! I din't know how to pass this variable from one service to another.
From SoapUI seems to working, when I change from MockService Preferences the Port to "5555" then the MockProxy is running successfully.
But, is there any reason why this is not working from command line? I use this:
./mockservicerunner.sh -m "MockService" -p "5555" "/home/oracle/InfoEuro_WS_Mock.xml"
and after that, in a different command line tab, I use this:
./mockservicerunner.sh -m "MockProxy" "/home/oracle/InfoEuro_WS_Mock.xml"
but I am getting a connection refuse exception.
If I do not change the port of the service (-p "5555"), both services work fine.
Related Content
- 12 years ago
- 10 months ago
Recent Discussions
- 2 days ago
- 2 days ago