gpt4 book ai didi

web-services - 带有 SimpleJaxWsServiceExporter 的 Spring Webservice

转载 作者:行者123 更新时间:2023-12-04 05:00:59 25 4
gpt4 key购买 nike

基于http://www.subshell.com/en/subshell/blog/article-Publishing-Webservices-with-Java-6-and-Spring-WS100.html我尝试在 Tomcat 7 上使用 SimpleJaxWsServiceExporter 运行 Webservice。

localhost:8081/WSTest/TourWS?wsdl 在浏览器中导致错误 404。

TourWS.java

@WebService
@SOAPBinding(style=Style.DOCUMENT)
public interface TourWS {
@WebMethod
public void declareTours(ArrayList<TourWSEntity> tours);
@WebMethod
public void declareTour(TourWSEntity tour);
@WebMethod
public String whoAmI();

TourWSImpl.java

@WebService(serviceName="TourWS")
public class TourWSImpl implements TourWS {
public TourWSImpl(){}

@Override
public void declareTours(ArrayList<TourWSEntity> tours) {
// impl
}

@Override
public void declareTour(TourWSEntity tour) {
// impl
}

@Override
public String whoAmI(){
return "JAX-WS Web Service - TourWS";
}

spring-ws-servlet.xml

<beans ...>
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8081/" />
</bean>
<bean id="tourWSImpl" class="tour.spring.ws.impl.TourWSImpl" />
</beans>

网络.xml

<web-app ...>
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>spring-ws</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>

pom.xml

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>

控制台输出:

2012-06-17 22:29:52 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk\bin;.;...
2012-06-17 22:29:52 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:WSSpring' did not find a matching property.
2012-06-17 22:29:52 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
2012-06-17 22:29:52 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
2012-06-17 22:29:52 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 572 ms
2012-06-17 22:29:52 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
2012-06-17 22:29:52 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.6
2012-06-17 22:29:53 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
2012-06-17 22:29:53 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
2012-06-17 22:29:53 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
2012-06-17 22:29:53 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
2012-06-17 22:29:53 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
2012-06-17 22:29:53 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
2012-06-17 22:29:53 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
2012-06-17 22:29:53 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
2012-06-17 22:29:53 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
2012-06-17 22:29:53 org.apache.catalina.startup.Catalina start
INFO: Server startup in 799 ms
2012-06-17 22:29:54 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'spring-ws'
2012-06-17 22:29:54 org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring-ws': initialization started
2012-06-17 22:29:54 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'spring-ws-servlet': startup date [Sun Jun 17 22:29:54 CEST 2012]; root of context hierarchy
2012-06-17 22:29:54 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-ws-servlet.xml]
2012-06-17 22:29:55 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3ca754: defining beans [org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter#0,tourWSImpl]; root of factory hierarchy
2012-06-17 22:29:55 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
INFO: Dynamically creating request wrapper Class tour.spring.ws.impl.jaxws.DeclareTours
2012-06-17 22:29:55 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
INFO: Dynamically creating response wrapper bean Class tour.spring.ws.impl.jaxws.DeclareToursResponse
2012-06-17 22:29:55 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
INFO: Dynamically creating request wrapper Class tour.spring.ws.impl.jaxws.DeclareTour
2012-06-17 22:29:55 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
INFO: Dynamically creating response wrapper bean Class tour.spring.ws.impl.jaxws.DeclareTourResponse
2012-06-17 22:29:55 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
INFO: Dynamically creating request wrapper Class tour.spring.ws.impl.jaxws.WhoAmI
2012-06-17 22:29:55 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
INFO: Dynamically creating response wrapper bean Class tour.spring.ws.impl.jaxws.WhoAmIResponse
2012-06-17 22:29:55 org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet
INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
2012-06-17 22:29:55 org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring-ws': initialization completed in 1125 ms

请告诉我可能有什么问题。

最佳答案

试试这个:localhost:8081/TourWS?wsdl因此从地址中删除 WSTest

关于web-services - 带有 SimpleJaxWsServiceExporter 的 Spring Webservice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11074853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com