我收到了给定端点类的错误:
Cannot map endpoint [public org.iaws.data.model.Theaters iaws.ws.soap.resources.TheaterEndpoint.getTheaters(java.lang.String,java.lang.String) throws java.sql.SQLException] on registration key [{http://iaws/ws/contractfirst/example}data]: there's already endpoint [public org.iaws.data.model.Theaters iaws.ws.soap.resources.TheaterEndpoint.getTheaters(java.lang.String,java.lang.String) throws java.sql.SQLException] mapped
为什么端点被映射两次?
@Endpoint
public class TheaterEndpoint {
private final static String NAMESPACE = "http://soap/ws/contractfirst/example";
@PayloadRoot(namespace = NAMESPACE, localPart = "data")
@Namespace(prefix="dt", uri = NAMESPACE)
@ResponsePayload
public Theaters getTheaters(
@XPathParam("/dt:data/dt:movieId") final String movieId,
@XPathParam("/dt:data/dt:location") final String location)
throws SQLException {
TheaterSearch data = new TheaterSearch(movieId, location);
if (data.getMovieId() == null && data.getLocation() == null) {
throw new IllegalArgumentException();
} else {
if (data.getMovieId() == null) {
return db.getTheaters(data.getLocation());
} else {
if (data.getLocation() == null) {
return db.getTheatersForMovie(data.getMovieId());
} else {
Theaters theaters = db.getTheatersForMovie(
data.getMovieId(), data.getLocation());
return theaters;
}
}
}
}
}
答案 0 :(得分:1)
我一直试图解决类似的问题,然后继续工作。
在MessageDispatcherServlet(在我的例子中是spring-ws-servlet.xml)中,我有一个为端点类创建的bean以及一个组件扫描。 删除bean 。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sws="http://www.springframework.org/schema/web-services"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!--
enables support for endpoint annotation, as per spring docs.
Forums ask to use this along with component scan. See SWS Bug 702
<link>http://stackoverflow.com/questions/6198644/spring-3-sws2-difference-between-contextcomponent-scan-and-swsannotation</link>
-->
<sws:annotation-driven />
<context:component-scan base-package="com.pkg.endpoint" />
<sws:dynamic-wsdl id="holiday"
portTypeName="HumanResource"
locationUri="/holidayService/"
targetNamespace="http://mycompany.com/hr/definitions">
<sws:xsd location="/WEB-INF/schema/holiday.xsd"/>
</sws:dynamic-wsdl>
<!-- REMOVE THIS BEAN -->
<bean id="holidayEndpoint" class="com.pkg.endpint.HolidayEndpoint" />
</beans>