【问题标题】:SoapUI web service authentication programmatically以编程方式进行 SoapUI Web 服务身份验证
【发布时间】:2014-09-12 16:05:56
【问题描述】:

我正在使用 SoapUi API 编写 SOAP Web 服务测试。我为此使用 SoapUITestCaseRunner。
我的代码看起来像

public class MyRunner extends SoapUITestCaseRunner{
  public void runTest(){
     setProjectFile("pro_file_path");
     setEndpoint("endpoint");
     setUsername("username");
     setPassword("password");
     setTestSuite("testSuiteName");
     setTestCase("TestCaseName");
     run();
 }

}
public class MyTestClass(){
    @Test
    public void test(){
        new MyRunner().runTest();
    }
}

但用户名和密码作为属性传递(我可以在 junit 故障日志中看到它们)。
服务说我 401 未经授权?我错过了什么吗?传递用户名和密码需要做些什么吗?

【问题讨论】:

    标签: web-services junit soapui


    【解决方案1】:

    我得到了答案。问题在于我用来创建 project.xml 文件的 SoapUI 版本。如果我们使用低于 5.0.0 的版本创建项目并在编写 junit 时使用 5.0.0,它将无法正常工作。
    实际上,SoapUI ahs 似乎对 5.0.0 中的身份验证部分进行了更改,其中没有更多选项,例如 NTML。
    所以我们必须在 project.xml 中配置身份验证类型,并通过 project.xml 中预先配置或通过 junit 手动发送用户名和密码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-12
      • 1970-01-01
      • 1970-01-01
      • 2012-07-28
      • 1970-01-01
      • 2012-02-10
      • 1970-01-01
      相关资源
      最近更新 更多