Forum Discussion

mmoser18's avatar
mmoser18
Frequent Contributor
5 years ago

How to use a custom property to define a mock service's listening port?

We are developing an application that is pretty connected, i.e. it communicates with about a dozen of surrounding services via SOAP requests. During testing these services are mocked, i.e. we defined about a dozen of mock services in a "mocks-soapui-project.xml".

These mocks can all run on the same system and even the same port, but in different environments they should be able to listen on DIFFERENT port numbers. I would thus like to use a custom property, say "MockPort", to specify the Port-field in the SOAP MockService Options-dialogue. However, that doesn't seem to be possible. Entering something like ${#Project#MockPort} in said configuration field is ignored, i.e. after clicking OK the former port number is displayed again.

Is there any way or trick to use placeholders in the SOAP MockService Options dialogue? Or how could one change the listening port of multiple mocks in one go?

 

In that context I have another question: what is the priority between an items default properties and its custom properties? I tried to define a Custom Property "Port" in the MockService Properties in an attempt to overrule the default property with the same name but obviously that does not work as I had hoped. Is maybe such a "property overwriting" possible somehow?

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Screen shot please (what you are referring to? and where that is used?)
    • mmoser18's avatar
      mmoser18
      Frequent Contributor

      I would like to be able to enter a property (i.e. something like ${#Project#MockPort}) into one of the two fields that I marked in red in the attached screenshots, i.e. either in the Port's value of the mock-service or in the Port-field of a mockservice's options.

      That would allow me to change the port for an entire set of mock services (in our case we have 8 mocks running all on one port). Right now one can not enter anything into the first field (that value is taken from the WSDL - I guess) or only a fixed number into the second field, not a place-holder.

       

      Hope I could make myself clear...