5 changed files with 120 additions and 0 deletions
@ -0,0 +1,44 @@ |
|||
package com.xtt.zls.config; |
|||
|
|||
|
|||
import com.xtt.zls.service.AppService; |
|||
import org.apache.cxf.Bus; |
|||
import org.apache.cxf.bus.spring.SpringBus; |
|||
import org.apache.cxf.jaxws.EndpointImpl; |
|||
import org.apache.cxf.transport.servlet.CXFServlet; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.web.servlet.ServletRegistrationBean; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
import javax.xml.ws.Endpoint; |
|||
|
|||
@Configuration |
|||
public class WSConfig { |
|||
|
|||
@Autowired |
|||
private AppService appService; |
|||
|
|||
|
|||
//默认servlet路径/*,如果覆写则按照自己定义的来
|
|||
@Bean |
|||
public ServletRegistrationBean cxfServlet() { |
|||
return new ServletRegistrationBean(new CXFServlet(), |
|||
"/webservice/*"); |
|||
} |
|||
|
|||
|
|||
@Bean(name = Bus.DEFAULT_BUS_ID) |
|||
public SpringBus springBus() { |
|||
return new SpringBus(); |
|||
} |
|||
|
|||
|
|||
//终端路径
|
|||
@Bean |
|||
public Endpoint endpoint() { |
|||
EndpointImpl endpoint = new EndpointImpl(springBus(), appService); |
|||
endpoint.publish("/test"); |
|||
return endpoint; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.xtt.zls.service; |
|||
|
|||
import javax.jws.WebMethod; |
|||
import javax.jws.WebParam; |
|||
import javax.jws.WebService; |
|||
|
|||
@WebService(name = "AppService", // 暴露服务名称
|
|||
targetNamespace = "http://tongtong.com"// 命名空间,一般是接口的包名倒序
|
|||
) |
|||
public interface AppService { |
|||
|
|||
@WebMethod |
|||
String casePaces(@WebParam(name = "map") String maps); |
|||
|
|||
@WebMethod |
|||
String getPlKt(@WebParam(name = "map") String map); |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.xtt.zls.service.impl; |
|||
|
|||
import com.xtt.zls.service.AppService; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import javax.jws.WebService; |
|||
|
|||
|
|||
@WebService(serviceName = "AppService", // 与接口中指定的name一致
|
|||
targetNamespace = "http://tongtong.com", // 与接口中的命名空间一致,一般是接口的包名倒
|
|||
endpointInterface = "com.xtt.zls.service.AppService"// 接口地址
|
|||
) |
|||
@Component |
|||
public class AppServiceImpl implements AppService { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(AppServiceImpl.class); |
|||
|
|||
@PostConstruct |
|||
private void init() { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public String casePaces(String maps) { |
|||
//
|
|||
return ""; |
|||
} |
|||
|
|||
@Override |
|||
public String getPlKt(String maps) { |
|||
return ""; |
|||
} |
|||
} |
|||
@ -1,3 +1,4 @@ |
|||
# 应用服务 WEB 访问端口 |
|||
server.port=8080 |
|||
|
|||
cxf.path=/soap |
|||
Loading…
Reference in new issue