【发布时间】:2019-08-26 22:36:39
【问题描述】:
您好,我正在尝试为我的 soap 集成测试创建一个脏测试。我刚刚在我的 Spring Boot 应用程序上运行 SSL,我想看看它是否会达到我的肥皂终点。
当我在集成测试中运行 man verify 时,出现以下错误:
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?
这是我的测试代码:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {EndPointTestConfiguration.class
})
public class SoapIT {
private static ApplicationContext context;
@BeforeClass
static public void setup(){
SpringApplication springApplication = new SpringApplicationBuilder()
.sources(MockServerApp.class)
.build();
context = springApplication.run();
}
@Autowired
private String studyDetailDemo;
@Test
public void soapTest() throws ClientProtocolException, IOException {
String result = Request.Post("https://127.0.0.1:28443/nulogix/ws/billingtool")
.connectTimeout(2000)
.socketTimeout(2000)
.bodyString(studyDetailDemo, ContentType.TEXT_PLAIN)
.execute().returnContent().asString();
}
}
我是集成测试的新手,不知道这个错误是什么意思
感谢您的帮助
【问题讨论】:
-
您以纯文本形式发送请求,这就是
ContentType.TEXT_PLAIN的含义。相反,您应该发送 XML 的内容类型。
标签: java spring-boot soap integration-testing