Spring Boot WS: Kein Adapter für den EndpunktJava

Java-Forum
Anonymous
 Spring Boot WS: Kein Adapter für den Endpunkt

Post by Anonymous »

Ich versuche, Spring Boot WS zu verwenden, um einen SOAP -Dienst zu erstellen, aber ich kann der Ausnahme "Nein Adapter für den Endpunkt ..." stellen.

Code: Select all

























































< /code>

Hier ist die Klasse für das Servlet < /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>

Und hier ist mein Endpunkt < /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;
}
Wie Sie sehen, habe ich auch versucht, der Anleitung zu folgen "https://spring.io/guides/gs/producing-web-service/anzen Ausnahme: < /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>

Ich glaube, dass mein Fehler wahrscheinlich in XSD oder in der Endpoint -Zuordnung ist, aber ich kann es nicht beheben.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post