Spring-ws -SOAP端点弹簧启动无法访问

我正在玩spring-boot ,我遇到了一个问题。 创建RESTful Web服务非常简单。 但我无法使用spring-boot运行soap服务。

实际上我的项目有spring-boot-starter-web依赖。

是否需要额外的sprint-boot-starter尚不存在?

有什么办法吗? 如果我有一个SOAP服务的web.xml,我可以在初始化过程中以某种方式包含它吗? 我知道类似的问题已经存在 ,但它并没有解决我的问题,因为那里的问题是基于spring-web。 所以我认为我的问题在其他地方。

我的soap-webservice的端点看起来像这样:

@Endpoint public class MyEndpoint { @PayloadRoot(localPart = "myRequest", namespace = "my.ns") @ResponsePayload public TResponse logRequest(@RequestPayload final TRequest request) { //some code } //more methods } 

端点在xml中很奇怪,它由spring-boot通过ImportResource注释加载。

所以我的入门级看起来像这样:

 @Configuration @EnableAutoConfiguration @ImportResource({ "classpath:/my/pack/app.xml" }) //soap-endpoint is configured here. public class Example { public static void main(final String[] args) { SpringApplication.run(Example.class, args); } } 

端点的配置

                                         my.pack.task.schema.beans          task      

除此之外,如果我有一个错误的依赖项我附加maven依赖树:

 [INFO] [dependency:tree {execution: default-cli}] [INFO] de.trao:spring-boot-tryout:jar:0.0.1-SNAPSHOT [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:0.5.0.M7:compile [INFO] | +- org.springframework.boot:spring-boot-starter:jar:0.5.0.M7:compile [INFO] | | +- org.springframework.boot:spring-boot:jar:0.5.0.M7:compile [INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:0.5.0.M7:compile [INFO] | | \- org.springframework.boot:spring-boot-starter-logging:jar:0.5.0.M7:compile [INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.5:compile [INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.5:compile [INFO] | | +- org.slf4j:log4j-over-slf4j:jar:1.7.5:compile [INFO] | | \- ch.qos.logback:logback-classic:jar:1.0.13:compile [INFO] | | \- ch.qos.logback:logback-core:jar:1.0.13:compile [INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:0.5.0.M7:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.47:compile [INFO] | | \- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:7.0.47:compile [INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile [INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile [INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile [INFO] | +- org.springframework:spring-web:jar:4.0.0.RELEASE:compile [INFO] | | +- aopalliance:aopalliance:jar:1.0:compile [INFO] | | +- org.springframework:spring-beans:jar:4.0.0.RELEASE:compile [INFO] | | \- org.springframework:spring-core:jar:4.0.0.RELEASE:compile [INFO] | \- org.springframework:spring-webmvc:jar:4.0.0.RELEASE:compile [INFO] | \- org.springframework:spring-expression:jar:4.0.0.RELEASE:compile [INFO] +- my.pack:my-soap-serv:jar:0.0.1-SNAPSHOT:compile [INFO] | +- org.springframework:spring-context:jar:4.0.0.RELEASE:compile [INFO] | +- org.springframework:spring-aop:jar:4.0.0.RELEASE:compile [INFO] | +- org.springframework:spring-aspects:jar:4.0.0.RELEASE:compile [INFO] | | +- org.aspectj:aspectjweaver:jar:1.7.4:compile (version managed from 1.8.0.M1) [INFO] | | \- org.springframework:spring-context-support:jar:4.0.0.RELEASE:compile [INFO] | +- org.springframework:spring-oxm:jar:4.0.0.RELEASE:compile [INFO] | +- org.springframework.ws:spring-ws-core:jar:2.1.4.RELEASE:compile [INFO] | | +- org.springframework.ws:spring-xml:jar:2.1.4.RELEASE:compile [INFO] | | +- wsdl4j:wsdl4j:jar:1.6.1:compile [INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile [INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile [INFO] | +- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.6.5:compile [INFO] | +- my.pack:datastore:jar:0.0.1-SNAPSHOT:compile [INFO] | | +- com.googlecode.genericdao:dao:jar:1.2.0:compile [INFO] | | | \- com.googlecode.genericdao:search:jar:1.2.0:compile [INFO] | | +- com.googlecode.genericdao:search-jpa-hibernate:jar:1.2.0:compile [INFO] | | | \- com.googlecode.genericdao:search-hibernate:jar:1.2.0:compile [INFO] | | +- org.hibernate:hibernate-entitymanager:jar:4.2.8.Final:compile [INFO] | | | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile [INFO] | | | +- org.hibernate:hibernate-core:jar:4.2.8.Final:compile [INFO] | | | | \- antlr:antlr:jar:2.7.7:compile [INFO] | | | +- dom4j:dom4j:jar:1.6.1:compile [INFO] | | | +- org.javassist:javassist:jar:3.18.1-GA:compile [INFO] | | | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile [INFO] | | | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile [INFO] | | | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.2.Final:compile [INFO] | | +- org.springframework:spring-orm:jar:4.0.0.RELEASE:compile [INFO] | | | \- org.springframework:spring-tx:jar:4.0.0.RELEASE:compile [INFO] | | +- org.springframework:spring-jdbc:jar:4.0.0.RELEASE:compile [INFO] | | \- com.google.guava:guava:jar:15.0:compile [INFO] | +- org.apache.ws.commons.axiom:axiom:jar:1.2.5:compile [INFO] | +- my.pack:shared:jar:0.0.1-SNAPSHOT:compile [INFO] | \- my.pack:common:jar:1.0.0-SNAPSHOT:compile [INFO] | +- com.typesafe:config:jar:1.0.2:compile [INFO] | +- org.slf4j:slf4j-api:jar:1.7.5:compile (version managed from 1.7.2) [INFO] | +- commons-lang:commons-lang:jar:2.6:compile [INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile [INFO] +- com.h2database:h2:jar:1.3.174:compile [INFO] +- junit:junit:jar:4.11:test [INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test [INFO] +- org.mockito:mockito-core:jar:1.9.5:test [INFO] | \- org.objenesis:objenesis:jar:1.0:test [INFO] \- org.hamcrest:hamcrest-library:jar:1.3:test 

Spring启动日志:

  . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v0.5.0.M7) 2014-01-14 14:59:30.196 INFO 15210 --- [ main] my.pack.Example : Starting Example on mango with PID 15210 (/home/myuser/Code/test/spring-boot-tryout/target/spring-boot-tryout-0.0.1-SNAPSHOT.jar started by myuser) 2014-01-14 14:59:30.250 INFO 15210 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4d8f36ef: startup date [Tue Jan 14 14:59:30 CET 2014]; root of context hierarchy 2014-01-14 14:59:30.624 INFO 15210 --- [ main] osbfxml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [my/pack/app.xml] 2014-01-14 14:59:30.750 INFO 15210 --- [ main] osbfxml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [my/pack/subpack/application-context-persistence.xml] 2014-01-14 14:59:31.216 INFO 15210 --- [ main] osbfsDefaultListableBeanFactory : Overriding bean definition for bean 'org.springframework.transaction.config.internalTransactionAdvisor': replacing [Root bean: class [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration; factoryMethodName=transactionAdvisor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]] 2014-01-14 14:59:31.243 INFO 15210 --- [ main] a.ConfigurationClassBeanDefinitionReader : Skipping bean definition for [BeanMethod:name=transactionManager,declaringClass=org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration]: a definition for bean 'transactionManager' already exists. This top-level bean definition is considered as an override. 2014-01-14 14:59:31.244 INFO 15210 --- [ main] a.ConfigurationClassBeanDefinitionReader : Skipping bean definition for [BeanMethod:name=entityManagerFactory,declaringClass=org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration]: a definition for bean 'entityManagerFactory' already exists. This top-level bean definition is considered as an override. 2014-01-14 14:59:31.504 WARN 15210 --- [ main] my.pack.common.config.AppSettings : ConfigFilePath is blank, using default configuration 2014-01-14 14:59:31.587 INFO 15210 --- [ main] my.pack.common.config.ConfigValidator : Beginning to validate the configuration 2014-01-14 14:59:31.710 INFO 15210 --- [ main] my.pack.common.config.ConfigValidator : Validating finished 2014-01-14 14:59:31.913 INFO 15210 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerByCGLIB$$a83839b9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2014-01-14 14:59:31.972 INFO 15210 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2014-01-14 14:59:31.990 INFO 15210 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2014-01-14 14:59:32.007 INFO 15210 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2014-01-14 14:59:32.302 INFO 15210 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 9001 2014-01-14 14:59:32.539 INFO 15210 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2014-01-14 14:59:32.539 INFO 15210 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.47 2014-01-14 14:59:32.630 INFO 15210 --- [ost-startStop-1] oaccC[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2014-01-14 14:59:32.630 INFO 15210 --- [ost-startStop-1] osweb.context.ContextLoader : Root WebApplicationContext: initialization completed in 2384 ms 2014-01-14 14:59:41.357 INFO 15210 --- [ost-startStop-1] oacatalina.util.SessionIdGenerator : Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [7,997] milliseconds. 2014-01-14 14:59:41.376 INFO 15210 --- [ost-startStop-1] oaccC[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet' 2014-01-14 14:59:41.376 INFO 15210 --- [ost-startStop-1] osweb.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started 2014-01-14 14:59:41.537 INFO 15210 --- [ost-startStop-1] oswshandler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2014-01-14 14:59:41.782 INFO 15210 --- [ost-startStop-1] osjdDriverManagerDataSource : Loaded JDBC driver: org.h2.Driver 2014-01-14 14:59:41.851 INFO 15210 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'reporting' 2014-01-14 14:59:42.107 INFO 15210 --- [ost-startStop-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.2.Final} 2014-01-14 14:59:42.124 INFO 15210 --- [ost-startStop-1] org.hibernate.Version : HHH000412: Hibernate Core {4.2.8.Final} 2014-01-14 14:59:42.131 INFO 15210 --- [ost-startStop-1] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2014-01-14 14:59:42.134 INFO 15210 --- [ost-startStop-1] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2014-01-14 14:59:42.179 INFO 15210 --- [ost-startStop-1] org.hibernate.ejb.Ejb3Configuration : HHH000204: Processing PersistenceUnitInfo [ name: reporting ...] 2014-01-14 14:59:42.421 INFO 15210 --- [ost-startStop-1] ohsjciConnectionProviderInitiator : HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider 2014-01-14 14:59:42.731 INFO 15210 --- [ost-startStop-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2014-01-14 14:59:43.016 INFO 15210 --- [ost-startStop-1] ohetiTransactionFactoryInitiator : HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory 2014-01-14 14:59:43.025 INFO 15210 --- [ost-startStop-1] ohhiast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory 2014-01-14 14:59:43.415 INFO 15210 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export Hibernate: alter table report drop constraint FK_5ld65a9c14kdtwywxr6262vdl 2014-01-14 14:59:43.421 ERROR 15210 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table report drop constraint FK_5ld65a9c14kdtwywxr6262vdl 2014-01-14 14:59:43.422 ERROR 15210 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Tabelle "REPORT" nicht gefunden Table "REPORT" not found; SQL statement: alter table report drop constraint FK_5ld65a9c14kdtwywxr6262vdl [42102-174] Hibernate: alter table task drop constraint FK_o2by8kw6mmcb95r8eq3jx074e 2014-01-14 14:59:43.422 ERROR 15210 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table task drop constraint FK_o2by8kw6mmcb95r8eq3jx074e 2014-01-14 14:59:43.422 ERROR 15210 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Tabelle "TASK" nicht gefunden Table "TASK" not found; SQL statement: alter table task drop constraint FK_o2by8kw6mmcb95r8eq3jx074e [42102-174] Hibernate: drop table customer if exists Hibernate: drop table report if exists Hibernate: drop table task if exists Hibernate: create table customer (id bigint generated by default as identity, identifier varchar(255) not null, primary key (id)) Hibernate: create table report (id bigint generated by default as identity, description varchar(255), occurred bigint not null, resolved bigint not null, status integer not null, customer_id bigint not null, primary key (id)) Hibernate: create table task (id bigint generated by default as identity, description varchar(255), finished bigint, started bigint, status integer not null, customer_id bigint not null, primary key (id)) Hibernate: alter table customer add constraint UK_nonbx33y5nkpeeohhjs6r18c0 unique (identifier) Hibernate: alter table report add constraint FK_5ld65a9c14kdtwywxr6262vdl foreign key (customer_id) references customer Hibernate: alter table task add constraint FK_o2by8kw6mmcb95r8eq3jx074e foreign key (customer_id) references customer 2014-01-14 14:59:43.863 INFO 15210 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete 2014-01-14 14:59:44.141 INFO 15210 --- [ost-startStop-1] oswshandler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2014-01-14 14:59:44.141 INFO 15210 --- [ost-startStop-1] oswshandler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2014-01-14 14:59:44.344 INFO 15210 --- [ost-startStop-1] osweb.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 2967 ms 2014-01-14 14:59:44.858 INFO 15210 --- [ main] osjeaAnnotationMBeanExporter : Registering beans for JMX exposure on startup 2014-01-14 14:59:44.949 INFO 15210 --- [ main] sbcetTomcatEmbeddedServletContainer : Tomcat started on port: 9001 2014-01-14 14:59:44.950 INFO 15210 --- [ main] my.pack.Example : Started Example in 15.343 seconds (JVM running for 15.914) 

谢谢您的帮助

更新 :我实际使用的代码就像魅力一样,你可以在这里查看: https : //github.com/Zarathustra616/spring-boot-ws-rest-example

Spring WS不需要MessageDispatcherServlet吗? 因此,您需要将其中一个替换为默认的DispatcherServlet ,例如

 @Bean public MessageDispatcherServlet dispatcherServlet() { return new MessageDispatcherServlet(); }