1、
@WebService(serviceName="test",targetNamespace=" http://tttt.com/")
public class TestController{
@WebMethod(operationName="getUserById")
@WebResult(name = "result")
public User getUserById(@WebParam(name="userid") String userid){
User user = new User();
user.setUserid(userid);
user.setName("姓名");
user.setAge(12);
return user;
}
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8081/ffshportal/ws/" />
</bean>
2、
@WebService(serviceName="test",targetNamespace="http://tttt.com/")
public class TestController{
@WebMethod(operationName="getUserById")
@WebResult(name = "result")
public User getUserById(@WebParam(name="userid") String userid){
User user = new User();
user.setUserid(userid);
user.setName("姓名");
user.setAge(12);
return user;
}
public static void main(String[] args) {
// 访问方式:http://localhost:7777/tudou?wsdl
String address = "http://localhost:8081/ws";
Endpoint.publish(address, new TestController());
}
3、WSSpringServlet CXFServlet