2 changed files with 83 additions and 0 deletions
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue