[英]a command line java client to consume SOAP - WSLD
我必須編寫一個命令行Java程序來使用SOAP(wsdl)Web服務。 我沒有奢侈地安裝我想要的任何Java庫。 因此,我將不得不自己編寫大部分內容。 有什么用? 或從哪里開始? 先感謝您。
客戶端的可執行代碼應從Web服務的WSDL文件生成:
wsimport http://localhost:8080/someservice/YourService?WSDL
然后,您將獲得客戶端類以訪問Web服務。 然后,您需要編寫一個簡單的客戶端。
public class YourServiceClient {
@WebServiceRef(wsdlLocation="http://localhost:8080/someservice/YourService?WSDL")
private static YourService yourService;
public void doSomething() {
// get service port and perform some logic
}
public static void main() {
new YourServiceClient().doSomething();
}
}
要提供與獨立客戶端(未部署在應用程序服務器上)一起使用的資源,可以使用:
appclient -client yourserviceclient.jar
也可以看看:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.