springboot解析webservice.xml

客户端

1、项目右键选择webservice

 2、

3、客户端解析wsdl文件

@Service
public class GwrzService {
	public boolean addList(List<GetPositonInfoVO> list){
		boolean result=false;
		// 创建WebService客户端代理工厂
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		// 注册webservice接口
		factory.setServiceClass(KeyPositon.class);
		// 配置webservice地址
		factory.setAddress("https://dmstesth.1111.com/dms.web/services/KeyPositonSOAP?wsdl");
		factory.setUsername("admin");
		factory.setPassword("123");
		// 获得接口对象
		KeyPositon service = (KeyPositon) factory.create();
		int res=service.getPositonInfo(list);
		if(res>0){
			result=true;
		}
		return result;
	}
}

 

服务端

1、服务端配置文件代码如下

import com.joydo.gfk.dms.dmsInterface.DCSToElearningSoap;
import com.joydo.gfk.dms.dmsInterface.ThirdToELearningSoap;
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.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;
/**
 * @creater  yfc
 * @date  2019/12/04 16:05:05
 * @describle 配置文件,webservice的接口文件
 */
@Configuration
public class CxfConfig {
	@Autowired
	private DCSToElearningSoap dcsToElearningSoap;
	@Autowired
	private ThirdToELearningSoap thirdToELearningSoap;
	@Bean
	public ServletRegistrationBean wsServlet(){
		return new ServletRegistrationBean(new CXFServlet(), "/webservice/*");
	}

	@Autowired
	@Qualifier(Bus.DEFAULT_BUS_ID)
	private SpringBus bus;

	@Bean
	public Endpoint endpoint3(){
		EndpointImpl endpoint = new EndpointImpl(bus, dcsToElearningSoap);
		endpoint.publish("/DCSToElearningSoap");
		return endpoint;
	}
	@Bean
	public Endpoint endpoint4(){
		EndpointImpl endpoint = new EndpointImpl(bus, thirdToELearningSoap);
		endpoint.publish("/ThirdToELearningSoap");
		return endpoint;
	}
}

2、服务端接口代码


/**
 * @创建人 yfc
 * @创建时间 2019-12-02 9:44
 * @描述 创建服务端接口
 */
//暴露服务名称;命名空间,包名接口倒排
//@WebService(name="ThirdToELearning",targetNamespace = "http://dmsInterface.dms.gfk.joydo.com")
@WebService(name = "ThirdToELearningSoap", targetNamespace = "NvSetWebService")
public interface ThirdToELearningSoap  {
	@WebMethod(operationName = "SetUserInfo", action = "NvSetWebService/SetUserInfo")
	@WebResult(name = "SetUserInfoResult", targetNamespace = "NvSetWebService")
	@RequestWrapper(localName = "SetUserInfo", targetNamespace = "NvSetWebService", className = "com.joydo.gfk.dms.dmsInterface.SetUserInfo")
	@ResponseWrapper(localName = "SetUserInfoResponse", targetNamespace = "NvSetWebService", className = "com.joydo.gfk.dms.dmsInterface.SetUserInfoResponse")
	public String setUserInfo( @WebParam(name = "userName", targetNamespace = "NvSetWebService")
			                               String userName,
	                           @WebParam(name = "Password", targetNamespace = "NvSetWebService")
			                               String password,
	                           @WebParam(name = "userList", targetNamespace = "NvSetWebService")
			                           ArrayOfNvUser userList);
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值