Forum Discussion

mmoser18's avatar
mmoser18
Frequent Contributor
3 years ago

Multiple REST mocks on same port?

We are using the SOAP Maven plugin to start several mock services while doing unit tests. This has worked fine so far (we were mocking several SOAP services and one REST service so far - all via the same local endpoint and same port).

Now we need to extend that a bit since we need to connect to yet another system and so we added a second REST mock to the project file but no matter what we are trying (and we fiddled already for almost a day): we always only get a "404 not found" back from that second mock service while running our UT on Jenkins.

 

Which finally makes me wonder: is there some restriction or limitation on this? Can one serve only ONE REST endpoint on the same port from that maven plugin?

 

I would find that really odd, since with SOAP-services that never was an issue. Also, serving multiple REST Mocks via the same port is not an issue at all in SOAPUI on my developer workstation. Local builds run just fine (but these don't use the Maven-Plugin to start the Mock. Rather there I always start SOAPUI locally and then fire up all the mocks (via a load script)).


But that more and more seems to be the only explanation why we don't get any reasonable response from that second service when executing things on Jenkins...

 

If that suspicion is true: can one redirect individual mock service to different ports via some plugin config option? Or do we really need to split our project file into two and then start TWO mock servers in parallel (if that's even possible)? That would be really tedious!

  • nmrao's avatar
    nmrao
    Champion Level 3

    Hi mmoser18 ,

    Can you please try to run the project using mockservicerunner.bat or .sh (based on your os) and see if it is successful?

    • mmoser18's avatar
      mmoser18
      Frequent Contributor

      That wouldn't buy me much. I am running the Mocks using the SOAP-UI Maven-plugin during a build on our Jenkins build server (for our UnitTests to find their mock-services).

      I don't see how I could run a shell command during that automatic build.