我正在尝试为简单的 Enpoint Web 服务编写 junit 测试:
@Endpoint
public class TestWS {
@PayloadRoot(localPart = "GetAllPlayersRequest", namespace = NAMESPACE_URI)
public @ResponsePayload GetAllPlayersResponse handleGetAllPlayersRequest() {
...
}
}
我的测试看起来像:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:**/tb-ws-servlet.xml" })
public class TeambridgeWSTest extends AbstractWebServiceServerTest {
private MockWebServiceClient client;
@Autowired
public void setApplicationContex(ApplicationContext applicationContext) {
client = createClient(applicationContext);
}
@Test
public void shouldReturnAllPlayers() throws Exception {
ParametrizableRequestCreator message = withMessage("GetAllPlayersRequest.xml");
client.sendRequest(message).andExpect(message("messages="GetAllPlayersResponse.xml"));
}
}
和 GetAllPlayersRequest.xml:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://ws.tb.company.com/schemas">
<soapenv:Header/>
<soapenv:Body>
<sch:GetAllPlayersRequest/>
</soapenv:Body>
</soapenv:Envelope>
我不知道为什么我得到
No endpoint mapping found for [SaajSoapMessage http://ws.tb.company.com/schemas}GetAllPlayersRequest]
我在 Spring 方面经验丰富,但在 Spring WS 中仍然是新手。你对我的问题有什么建议吗?