使用过spring-boot-web-services依赖项。启动应用程序时,我可以正确看到wsdl,但是当我使用带有适当输入的chrome wizdler进行操作时,出现失败提示
“无法获得回复”。
配置:-
@EnableWs
@Configuration
public class WebServiceConfig {
@Bean
public ServletRegistrationBean<MessageDispatcherServlet> messageDispatcherServlet(ApplicationContext context) {
MessageDispatcherServlet messageDispatcherServlet = new MessageDispatcherServlet();
messageDispatcherServlet.setApplicationContext(context);
messageDispatcherServlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean<MessageDispatcherServlet>(messageDispatcherServlet,"/ws/*");
}
@Bean(name="courses")
public DefaultWsdl11Definition defaultWsd11Definition(XsdSchema coursesSchema) {
DefaultWsdl11Definition definition = new DefaultWsdl11Definition();
definition.setPortTypeName("CoursePort");
definition.setTargetNamespace("http://com.course-management//courses");
definition.setLocationUri("/ws");
definition.setSchema(coursesSchema);
return definition;
}
@Endpoint
public class CourseManagementEndPoint {
//input- getAllCourseDetailsRequest
//output- GetAllCourseDetailsResponse
@PayloadRoot(namespace="http://com.course-management/courses",
localPart="GetAllCourseDetailsRequest")
public @ResponsePayload GetAllCourseDetailsResponse processAllCourseDetailsRequest(@RequestPayload GetAllCourseDetailsRequest request) {
GetAllCourseDetailsResponse response = new GetAllCourseDetailsResponse();
Coursedetails course = new Coursedetails();
course.setId(request.getId());
course.setDescription("Learn for Satisfaction!!!");
course.setName("Head First");
response.setCoursedetails(course);
System.out.println("End Point working!!!");
return response;
}