I tried following these steps, which talk about how to use SoapUI to create an https soap mock.. However, I'm finding the equivalent doesn't work for REST:
I started off by creating a very simple REST action which delivers a JSON response on port 8080 via HTTP:
It works fine:
Subsequently, I created a keystore file with the JDK and updated the SSL settings for the mock:
My understanding from reading the guide is that this should allow me to connect to https://localhost:8443
and get to my end-point. However, it does not. Unlike the http test which produces JSON, this test produces HTML from soapUI:
[TestMethod]public void TestHttpsNoValidation(){ using (HttpClient client = new HttpClient(new HttpClientHandler { ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true })) { HttpResponseMessage response = client.GetAsync("https://localhost:8443/api/employees").Result; if (response.IsSuccessStatusCode) { string content = response.Content.ReadAsStringAsync().Result; Console.WriteLine(content); } else { Assert.Fail($"Failed to fetch data. Status code: {response.StatusCode}"); } }}
The output is:
I tried setting the mock service to explicitly use 8443, however this throws an error because as soon as you update the SSL settings in the preferences, an HTTPS server port is set up listening on that port and if you change the mock service to use that directly, it can't start.
Any ideas how you're actually supposed to do this?