diff --git a/src/main/java/com/xtt/zls/controller/TestController.java b/src/main/java/com/xtt/zls/controller/TestController.java new file mode 100644 index 0000000..0d974d9 --- /dev/null +++ b/src/main/java/com/xtt/zls/controller/TestController.java @@ -0,0 +1,38 @@ +package com.xtt.zls.controller; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 测试控制器 + */ +@RestController +@RequestMapping("/api/v1/test") +public class TestController { + @GetMapping("/help") + public String greet(){ + return "help"; + } + /** + * getusers + * @return + */ + @RequestMapping("/") + public String thome(){ + // + String wsdlurl ="http://120.234.15.170:4000/FeeService.dll/wsdl/IFeeService"; + + JaxWsDynamicClientFactory dynamicClientFactory = JaxWsDynamicClientFactory.newInstance(); + Client client = dynamicClientFactory.createClient(wsdlurl); + // + try { + client.invoke("GetUsers"); + }catch (Exception ex){ + ex.printStackTrace(); + } + return "jok"; + } +} diff --git a/src/main/java/com/xtt/zls/utils/GeneralSoapClient.java b/src/main/java/com/xtt/zls/utils/GeneralSoapClient.java new file mode 100644 index 0000000..d7afd04 --- /dev/null +++ b/src/main/java/com/xtt/zls/utils/GeneralSoapClient.java @@ -0,0 +1,45 @@ +package com.xtt.zls.utils; + +/** + * WSDL 请求客户端 + */ +public class GeneralSoapClient { + private String WSDL;// + // + private String namespaceURI; + // + private String localPart; + + public GeneralSoapClient() { + } + + public GeneralSoapClient(String WSDL, String namespaceURI, String localPart) { + this.WSDL = WSDL; + this.namespaceURI = namespaceURI; + this.localPart = localPart; + } + + public String getWSDL() { + return WSDL; + } + + public void setWSDL(String WSDL) { + this.WSDL = WSDL; + } + + public String getNamespaceURI() { + return namespaceURI; + } + + public void setNamespaceURI(String namespaceURI) { + this.namespaceURI = namespaceURI; + } + + public String getLocalPart() { + return localPart; + } + + public void setLocalPart(String localPart) { + this.localPart = localPart; + } +}