phpsoapui

SOAPUI MockService: WSDL Validation for parameters?


I configured with SoapUI 5.0 a MockService using a copy of this WSDL definition (http://www.webservicex.com/globalweather.asmx?WSDL).

I cant test against the MockService with PHP SoapClient just fine:

        ini_set("soap.wsdl_cache_enabled", 0);
        $client = new \SoapClient("http://172.20.1.52:8088/mockGlobalWeatherSoap?WSDL", array('trace' => 1));
        $response = $client->__soapCall('GetCitiesByCountry', array());

However, I started to play with the definition to ensure mandatory parameters for some methods.

For example, I wanted to ensure CountryName to be a mandatory parameters for the GetCitiesByCountry() method:

  <s:element name="GetCitiesByCountry">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="CountryName" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>

However, whatever I throw at SoapUI, my MockService will always send me a correct response diregarding whether the parameter has been provided or not.

How to ensure the basic validation as described in the WSDL file in SoapUi?

I tried the same thing from within SoapUI with sending a dummy soap request with missing parameters but SoapUI doesn't care and sends me a response back.


Solution

  • SoapUI mocking does not simulate what is in the WSDL. It will only simulate a response. You have to configure SoapUI to simulate the specific response that you want.

    Did you try the SoapUI documentation? http://www.soapui.org/Service-Mocking/simulating-complex-behaviour.html