java - SpringWS service doesn't response for any requests via SOAP UI -
springws service doesn't response requests via soap ui?
collegues, beginner in spring , need help. created web service , can receive wsdl description in soap ui, problem service not respond requests. web srvice config:
package com.mayacomp.app; 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 extends wsconfigureradapter { @bean public servletregistrationbean dispatcherservlet(applicationcontext applicationcontext) { messagedispatcherservlet servlet = new messagedispatcherservlet(); servlet.setapplicationcontext(applicationcontext); return new servletregistrationbean(servlet, "/services/*"); } @bean(name = "appservice") public defaultwsdl11definition defaultwsdl11definition(xsdschema appserviceschema) { defaultwsdl11definition wsdl11definition = new defaultwsdl11definition(); wsdl11definition.setporttypename("applicationws"); wsdl11definition.setlocationuri("/appservice/"); wsdl11definition.settargetnamespace("http://mayaapp.com/application"); wsdl11definition.setschema(appserviceschema); return wsdl11definition; } @bean public xsdschema appserviceschema() { return new simplexsdschema(new classpathresource("meta-inf/schemas/application.xsd")); } }
my endpoint class:
package com.mayacomp.endpoint; import java.util.logging.logger; import org.springframework.beans.factory.annotation.autowired; import org.springframework.ws.server.endpoint.annotation.endpoint; import org.springframework.ws.server.endpoint.annotation.payloadroot; import org.springframework.ws.server.endpoint.annotation.requestpayload; import org.springframework.ws.server.endpoint.annotation.responsepayload; import com.mayacomp.app.internalhistrequest; import com.mayacomp.app.internalhistresponse; import com.mayacomp.app.internalcredithistflagstype; import com.mayacomp.app.internalcredithistindicatorstype; import com.mayacomp.app.responseheadertype; import com.mayacomp.service.appservice; @endpoint public class wsendpoint { private static final logger log = logger.getlogger(wsendpoint.class.getname()); private static final string target_namespace = "http://mayaapp.com/application"; @autowired public appservice appservice_i; @payloadroot(localpart = "internalhistrequest", namespace = target_namespace) public @responsepayload internalhistresponse getinternalcredhist(@requestpayload internalhistrequest request) { log.info("test"); internalhistresponse _return = new internalhistresponse(); _return.setclientid(new java.math.biginteger("42823928316076042522945935239155481381")); try { responseheadertype _returnresponseheader = new responseheadertype(); _returnresponseheader.setrequestuid("requestuid-207722529"); _returnresponseheader.setrequesttimestamp(javax.xml.datatype.datatypefactory.newinstance().newxmlgregoriancalendar("2015-05-06t10:28:37.616+03:00")); _returnresponseheader.setresponseuid("responseuid2066314058"); _returnresponseheader.setresponsetimestamp(javax.xml.datatype.datatypefactory.newinstance().newxmlgregoriancalendar("2015-05-06t10:28:37.616+03:00")); _returnresponseheader.setresponsecode(1883325675); _returnresponseheader.setresponsedescription("responsedescription-1084371447"); _return.setresponseheader(_returnresponseheader); /* call spring injected service implementation retrieve credit history data */ internalcredithistflagstype _returninternalcredithistflags = appservice_i.getinternalcredithistflagstype(request); _return.setinternalcredithistflags(_returninternalcredithistflags); /* call spring injected service implementation retrieve credit history data */ internalcredithistindicatorstype _returninternalcredithisindicators = appservice_i.getinternalcredhist(request); _return.setinternalcredithisindicators(_returninternalcredithisindicators); return _return; } catch (java.lang.exception ex) { ex.printstacktrace(); throw new runtimeexception(ex); } } public void setappservice(appservice appservice_p) { this.appservice_i = appservice_p; } }
my pom file (may dependencies)
http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.mayacomp.pco appservice
<version>0.0.1-snapshot</version> <name>appservice spring-ws application</name> <url>http://www.springframework.org/spring-ws</url> <inceptionyear>2015</inceptionyear> <packaging>jar</packaging> <build> <finalname>pcoservice</finalname> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>tomcat-maven-plugin</artifactid> <version>1.1</version> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <version>1.4</version> <executions> <execution> <goals> <goal>xjc</goal> </goals> <phase>generate-sources</phase> </execution> </executions> <configuration> <clearoutputdir>false</clearoutputdir> <outputdirectory>src/main/java</outputdirectory> <schemadirectory>src/main/resources/meta-inf/schemas</schemadirectory> <includeschema>**/*.xsd</includeschema> <bindingdirectory>src/main/java/com/mayacomp/app</bindingdirectory> <enableintrospection>false</enableintrospection> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupid>wsdl4j</groupid> <artifactid>wsdl4j</artifactid> <version>1.6.3</version> </dependency> <!-- spring dependencies --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>4.1.7.release</version> <scope>compile</scope> <exclusions> <exclusion> <artifactid>commons-logging</artifactid> <groupid>commons-logging</groupid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter</artifactid> <version>1.2.5.release</version> <exclusions> <exclusion> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-logging</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-log4j</artifactid> <version>1.2.5.release</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-log4j</artifactid> <version>1.2.5.release</version> </dependency> <dependency> <groupid>org.springframework.ws</groupid> <artifactid>spring-ws-core</artifactid> <version>2.2.1.release</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-ws</artifactid> <version>1.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> <version>4.1.7.release</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-ws</artifactid> <version>1.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>4.1.7.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-expression</artifactid> <version>4.1.7.release</version> </dependency> </dependencies>
as said have available wsdl after
mvn -u spring-boot:run
via url http://localhost:8080/services/appservice/appservice.wsdl operations not working. please, help.
update spring boot log trace:
debug: [авг-03 13:08:33,082] boot.logging.classpathloggingapplicationlistener - application started classpath: [file:/c:/users/maya/workspace/appservice/src/main/resources/, file:/c:/users/maya/workspace/appservice/target/classes/, file:/c:/users/maya/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/c:/users/maya/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.5.release/spring-boot-starter-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/c:/users/maya/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-beans/4.1.7.release/spring-beans-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-jms/4.1.7.release/spring-jms-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/ws/spring-ws-support/2.2.1.release/spring-ws-support-2.2.1.release.jar, file:/c:/users/maya/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.0/jackson-annotations-2.4.0.jar, file:/c:/users/maya/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.2.5.release/spring-boot-starter-web-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.jar, file:/c:/users/maya/.m2/repository/org/springframework/ws/spring-xml/2.2.1.release/spring-xml-2.2.1.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-aop/4.0.9.release/spring-aop-4.0.9.release.jar, file:/c:/users/maya/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.6/jackson-databind-2.4.6.jar, file:/c:/users/maya/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.ga/jboss-logging-3.1.3.ga.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot-starter-log4j/1.2.5.release/spring-boot-starter-log4j-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/wsdl4j/wsdl4j/1.6.3/wsdl4j-1.6.3.jar, file:/c:/users/maya/.m2/repository/org/hibernate/hibernate-validator/5.1.3.final/hibernate-validator-5.1.3.final.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-context/4.1.7.release/spring-context-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/ws/spring-ws-core/2.2.1.release/spring-ws-core-2.2.1.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-webmvc/4.0.9.release/spring-webmvc-4.0.9.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.5.release/spring-boot-autoconfigure-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.23/tomcat-embed-websocket-8.0.23.jar, file:/c:/users/maya/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.23/tomcat-embed-el-8.0.23.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.2.5.release/spring-boot-starter-tomcat-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-web/4.1.7.release/spring-web-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.23/tomcat-embed-logging-juli-8.0.23.jar, file:/c:/users/maya/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-messaging/4.1.7.release/spring-messaging-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-oxm/4.0.9.release/spring-oxm-4.0.9.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot-starter-ws/1.2.5.release/spring-boot-starter-ws-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/javax/validation/validation-api/1.1.0.final/validation-api-1.1.0.final.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-tx/4.1.7.release/spring-tx-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/slf4j/slf4j-log4j12/1.7.12/slf4j-log4j12-1.7.12.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-expression/4.1.7.release/spring-expression-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/springframework/boot/spring-boot/1.2.5.release/spring-boot-1.2.5.release.jar, file:/c:/users/maya/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.6/jackson-core-2.4.6.jar, file:/c:/users/maya/.m2/repository/org/springframework/spring-core/4.1.7.release/spring-core-4.1.7.release.jar, file:/c:/users/maya/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.23/tomcat-embed-core-8.0.23.jar] debug: [авг-03 13:08:33,572] springframework.boot.springapplication - loading source class com.mayacomp.app.wsapplication debug: [авг-03 13:08:33,627] context.config.configfileapplicationlistener - skipped config file 'file:./config/application.xml' resource not found debug: [авг-03 13:08:33,627] context.config.configfileapplicationlistener - skipped config file 'file:./config/application.yml' resource not found debug: [авг-03 13:08:33,628] context.config.configfileapplicationlistener - skipped config file 'file:./config/application.properties' resource not found debug: [авг-03 13:08:33,628] context.config.configfileapplicationlistener - skipped config file 'file:./config/application.yaml' resource not found debug: [авг-03 13:08:33,629] context.config.configfileapplicationlistener - skipped config file 'file:./application.xml' resource not found debug: [авг-03 13:08:33,629] context.config.configfileapplicationlistener - skipped config file 'file:./application.yml' resource not found debug: [авг-03 13:08:33,630] context.config.configfileapplicationlistener - skipped config file 'file:./application.properties' resource not found debug: [авг-03 13:08:33,630] context.config.configfileapplicationlistener - skipped config file 'file:./application.yaml' resource not found debug: [авг-03 13:08:33,631] context.config.configfileapplicationlistener - skipped config file 'classpath:/config/application.xml' resource not found debug: [авг-03 13:08:33,631] context.config.configfileapplicationlistener - skipped config file 'classpath:/config/application.yml' resource not found debug: [авг-03 13:08:33,632] context.config.configfileapplicationlistener - skipped config file 'classpath:/config/application.properties' resource not found debug: [авг-03 13:08:33,632] context.config.configfileapplicationlistener - skipped config file 'classpath:/config/application.yaml' resource not found debug: [авг-03 13:08:33,633] context.config.configfileapplicationlistener - skipped config file 'classpath:/application.xml' resource not found debug: [авг-03 13:08:33,633] context.config.configfileapplicationlistener - skipped config file 'classpath:/application.yml' resource not found debug: [авг-03 13:08:33,634] context.config.configfileapplicationlistener - skipped config file 'classpath:/application.properties' resource not found debug: [авг-03 13:08:33,634] context.config.configfileapplicationlistener - skipped config file 'classpath:/application.yaml' resource not found info : [авг-03 13:08:33,642] context.embedded.annotationconfigembeddedwebapplicationcontext - refreshing org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext@731b45a8: startup date [mon aug 03 13:08:33 msk 2015]; root of context hierarchy debug: [aug-03 13:08:33,649] context.embedded.annotationconfigembeddedwebapplicationcontext - bean factory org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext@731b45a8: org.springframework.beans.factory.support.defaultlistablebeanfactory@5ff5d9af: defining beans [org.springframework.context.annotation.internalconfigurationannotationprocessor,org.springframework.context.annotation.internalautowiredannotationprocessor,org.springframework.context.annotation.internalrequiredannotationprocessor,org.springframework.context.annotation.internalcommonannotationprocessor,wsapplication]; root of factory hierarchy debug: [aug-03 13:08:35,233] context.embedded.annotationconfigembeddedwebapplicationcontext - unable locate messagesource name 'messagesource': using default [org.springframework.context.support.delegatingmessagesource@2fffdd6a] debug: [aug-03 13:08:35,233] context.embedded.annotationconfigembeddedwebapplicationcontext - using applicationeventmulticaster [org.springframework.context.event.simpleapplicationeventmulticaster@4cc2be65] debug: [aug-03 13:08:35,658] embedded.tomcat.tomcatembeddedservletcontainerfactory - code archive: c:\users\maya\.m2\repository\org\springframework\boot\spring-boot\1.2.5.release\spring-boot-1.2.5.release.jar debug: [aug-03 13:08:35,659] embedded.tomcat.tomcatembeddedservletcontainerfactory - code archive: c:\users\maya\.m2\repository\org\springframework\boot\spring-boot\1.2.5.release\spring-boot-1.2.5.release.jar debug: [aug-03 13:08:35,660] embedded.tomcat.tomcatembeddedservletcontainerfactory - document root: c:\users\maya\workspace\appservice\src\main\webapp info : [aug-03 13:08:35,705] embedded.tomcat.tomcatembeddedservletcontainer - tomcat initialized port(s): 8080 (http) debug: [aug-03 13:08:36,156] context.embedded.servletcontextinitializerbeans - added existing servlet initializer bean 'dispatcherservlet'; order=2147483647, resource=class path resource [com/mayacomp/app/webserviceconfig.class] debug: [aug-03 13:08:36,271] context.embedded.servletcontextinitializerbeans - created filter initializer bean 'characterencodingfilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/httpencodingautoconfiguration.class] debug: [aug-03 13:08:36,272] context.embedded.servletcontextinitializerbeans - created filter initializer bean 'hiddenhttpmethodfilter'; order=-2147483638, resource=class path resource [org/springframework/boot/autoconfigure/web/webmvcautoconfiguration.class] debug: [aug-03 13:08:36,827] context.embedded.servletcontextinitializerbeans - created eventlistener initializer bean 'requestcontextlistener'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/webmvcautoconfiguration$webmvcautoconfigurationadapter.class] info : [aug-03 13:08:36,830] context.embedded.servletregistrationbean - mapping servlet: 'messagedispatcherservlet' [/services/*] info : [aug-03 13:08:36,837] context.embedded.filterregistrationbean - mapping filter: 'characterencodingfilter' to: [/*] info : [aug-03 13:08:36,838] context.embedded.filterregistrationbean - mapping filter: 'hiddenhttpmethodfilter' to: [/*] debug: [aug-03 13:08:36,987] context.web.orderedhiddenhttpmethodfilter - initializing filter 'hiddenhttpmethodfilter' debug: [aug-03 13:08:36,989] context.web.orderedhiddenhttpmethodfilter - filter 'hiddenhttpmethodfilter' configured debug: [aug-03 13:08:36,990] context.web.orderedcharacterencodingfilter - initializing filter 'characterencodingfilter' debug: [aug-03 13:08:36,990] context.web.orderedcharacterencodingfilter - filter 'characterencodingfilter' configured debug: [aug-03 13:08:37,676] context.embedded.annotationconfigembeddedwebapplicationcontext - unable locate lifecycleprocessor name 'lifecycleprocessor': using default [org.springframework.context.support.defaultlifecycleprocessor@5579e98a] debug: [aug-03 13:08:37,682] autoconfigure.logging.autoconfigurationreportlogginginitializer - ========================= auto-configuration report ========================= positive matches: ----------------- bla bla negative matches: bla bla info : [aug-03 13:08:37,877] embedded.tomcat.tomcatembeddedservletcontainer - tomcat started on port(s): 8080 (http)
please delete double entries in pom:
- spring-boot-starter-log4j
- spring-boot-starter-ws
in webserviceconfig please add:
servlet.settransformwsdllocations(true);
you have generate domain classes based on xml schema automatically during build time. please add pom , modify schemadir , outputdir requirements:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <version>1.6</version> <executions> <execution> <id>xjc</id> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <schemadirectory>${project.basedir}/src/main/resources/</schemadirectory> <outputdirectory>${project.basedir}/src/main/java</outputdirectory> <clearoutputdir>false</clearoutputdir> </configuration>
see main application in package com.mayacomp.app , have annotated class @springbootapplication. important have ws components located under package com.mayacomp.app, otherwise component scan cant find them. aware have targetnamespace identical in depending components , in soapenvelop element of xml-request. can give try on endpoint /services , test file test.xml example curl:
curl --header "content-type: text/xml" -d @test.xml http://localhost:8080/services/
Comments
Post a Comment