我对Soap enpoint遇到问题,要么没有公开,要么以其他名称公开。 找到了我正在使用的其他端点,但是在新端点上:
org.springframework.ws.NoEndpointFoundException: No endpoint can be found for request [SaajSoapMessage mySoapEndpointRequest]
如何从Spring集成测试中获得暴露的端点? -查看端点是否暴露,或以其他名称暴露-可能是拼写错误或其他。
在其他端点上,该服务可以正常工作,我看不出有什么区别。
这是我的整合测试:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {WebServiceConfigTest.class}, properties = {"application.address=http://hostname:port/context"})
public class MySoapEndpointWebServiceTest {
@Autowired
private ApplicationContext applicationContext;
private MockWebServiceClient mockClient;
@Before
@Autowired
public void init() {
mockClient = MockWebServiceClient.createClient(applicationContext);
MockitoAnnotations.initMocks(this);
}
@Test
public void shouldSearch() throws JAXBException {
//given
String givenSearchStr = "cfhfghfg";
Source requestPayload = buildRequestPayload(buildMockRequest(givenSearchStr)); // here the MySoapEndpointRequest object is serialized
Source expectedResponsePayload = buildTestResponsePayload(buildMockSearchResponse(givenSearchStr ));
//when
mockClient.sendRequest(withPayload(requestPayload))
//then
.andExpect(noFault())
.andExpect(payload(expectedResponsePayload));
}
Webservice设置如下:
@Endpoint
public class MySoapEndpointWebService {
public MySoapEndpointWebService (){}
@PayloadRoot(namespace = SoapConstants.MY_SOAP_NAMESPACE_URI, localPart = "mySoapEndpointRequest")
@ResponsePayload
public MySoapEndpointResponse search(@RequestPayload MySoapEndpointRequest request) {
throw new SoapFaultException("Service not implemented yet!");
}
}
有什么想法吗?