spring和springboot都可实现
WebServiceApi.java
WebServiceApiImpl.java
package com.thy.custom.wsdl;
import org.json.simple.JSONObject;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface WebServiceApi {
@WebMethod
public String receiveSelfResultCallback(@WebParam(name = "file_num")String file_num,@WebParam(name = "dept_code") String dept_code,@WebParam(name = "result") String result);
@WebMethod
public String receiveArchiveResultCallback(@WebParam(name = "file_num")String file_num,@WebParam(name = "dept_code")String dept_code,@WebParam(name = "result")String result);
}
package com.thy.custom.wsdl;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public class WebServiceApiImpl implements WebServiceApi{
@WebMethod
public String receiveSelfResultCallback(@WebParam(name = "file_num")String file_num, @WebParam(name = "dept_code")String dept_code, @WebParam(name = "result")String result) {
System.out.println("file_num:===========>"+file_num);
System.out.println("dept_code:===========>"+dept_code);
System.out.println("result:===========>"+result);
return "1";
}
@WebMethod
public String receiveArchiveResultCallback(@WebParam(name = "file_num")String file_num, @WebParam(name = "dept_code")String dept_code, @WebParam(name = "result")String result) {
System.out.println("file_num:===========>"+file_num);
System.out.println("dept_code:===========>"+dept_code);
System.out.println("result:===========>"+result);
return "1";
}
}
设置为启动项目时启动webservice服务
//启动时加载webservice服务
public void webServiceT(){
WebServiceApi ws = new WebServiceApiImpl();
Endpoint.publish("http://0.0.0.0:8088/thy",ws);
System.out.println("Webservice已发布");
}
所需jar包
compile group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: '3.4.4'
compile group: 'org.apache.cxf', name: 'cxf-rt-transports-http-jetty', version: '3.4.4'
compile group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: '3.4.4'