Spring Boot WS: нет адаптера для конечной точкиJAVA

Программисты JAVA общаются здесь
Anonymous
Spring Boot WS: нет адаптера для конечной точки

Сообщение Anonymous »

Я пытаюсь использовать Spring Boot WS, чтобы создать сервис SOAP, но я столкнулся с исключением «Нет адаптера для конечной точки ...». < /p>

Вот мой xsd < /p>

Код: Выделить всё

























































< /code>

Вот класс для сервлета < /p>

import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema;

@EnableWs
@Configuration
public class WebServiceConfig {

@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet,  "/nis/*");
}

@Bean(name = "nisDoEvent")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema doEventSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("nisDoEvent");
wsdl11Definition.setLocationUri("/nis/ws");
wsdl11Definition.setTargetNamespace("http://nisws.it.fastweb");
wsdl11Definition.setSchema(doEventSchema);
//      wsdl11Definition.setRequestSuffix("doEvent");
return wsdl11Definition;
}

@Bean (name = "doEventSchema")
public XsdSchema doEventSchema() {
return new SimpleXsdSchema(new ClassPathResource("doEventSchema.xsd"));
}

}
< /code>

И вот моя конечная точка < /p>

@Endpoint
public class CompletaMigrBNGEndpoint {

private static final String NAMESPACE_URI = "http://nisws.it.fastweb";

private static final String EXAMPLE_NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";

private CountryRepository countryRepository;

@Autowired
public CompletaMigrBNGEndpoint(CountryRepository countryRepository) {
this.countryRepository = countryRepository;
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "doEventRequest")
@ResponsePayload
public DoEventResponse doEvent(@RequestPayload DoEventRequest request){
DoEventResponse response = new DoEventResponse();
response.setHeader(request.getHeader());
response.setTrackingbody(request.getTrackingbody());
return response;
}

@PayloadRoot(namespace = EXAMPLE_NAMESPACE_URI, localPart = "getCountryRequest")
@ResponsePayload
public GetCountryResponse getCountry(@RequestPayload GetCountryRequest request) {
GetCountryResponse response = new GetCountryResponse();
response.setCountry(countryRepository.findCountry(request.getName()));

return response;
}
Как вы можете видеть, я также пытался следовать руководству "https://spring.io/guides/gs/producing-web-service/" написана/>
, и пример предоставил работает нормально. Исключение: < /p>

16:43:38.674 [http-nio-8080-exec-4] DEBUG o.s.w.s.server.SoapMessageDispatcher - Endpoint invocation resulted in exception - responding with Fault
java.lang.IllegalStateException: No adapter for endpoint [public org.hp.doEventSchema.DoEventResponse org.hp.resources.connection.soap.services.CompletaMigrBNGEndpoint.doEvent(org.hp.doEventSchema.DoEventRequest)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?
at org.springframework.ws.server.MessageDispatcher.getEndpointAdapter(MessageDispatcher.java:302) [spring-ws-core-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:235) [spring-ws-core-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176) [spring-ws-core-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
< /code>

Я считаю, что, вероятно, моя ошибка находится в картировании xsd или в конечной точке, но я не могу ее исправить. < /p>

>

Подробнее здесь: https://stackoverflow.com/questions/301 ... r-endpoint

Вернуться в «JAVA»