You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用SoapUI创建HTTPS协议的REST Mock服务?

问题:SoapUI中REST Mock服务配置HTTPS无效的解决方法

我按照SoapUI官方关于SOAP Mock服务配置SSL的步骤操作,但这套流程在REST场景下不生效,具体情况如下:

  • 先创建了一个简单的REST接口,通过HTTP 8080端口返回JSON响应,运行正常:
    HTTP接口正常运行截图

  • 用JDK生成密钥库文件后,更新了Mock服务的SSL设置:
    Mock服务SSL设置截图

  • 按照教程预期,应该能通过https://localhost:8443访问接口,但实际请求返回的是SoapUI的HTML内容,而非预期的JSON。测试代码如下:

    [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}");
            }
        }
    }
    

    返回内容截图:
    HTTPS请求返回HTML截图

  • 尝试将Mock服务直接设置为8443端口时,启动失败,提示该端口已被偏好设置中配置的HTTPS服务器占用。

请问REST Mock服务配置HTTPS的正确方法是什么?


内容的提问来源于stack exchange,提问作者Benj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 20:07:12