WCF Web Services 基本使用方法 (SOAP Client Side)
建立 Service Reference (與 SOAP Server 既連線)
係 Solution 上 Right Click -> 選擇 Add Service Reference ->
係 Address: 上輸入 <WCF Web Service 服務合約 Address> 例如: http://192.168.1.190:8080/ws/Service1.svc ->
係 namespace 上輸入 <Namespace 名稱> 例如: ServiceReference1 -> 完成
Default.aspx |
using WebApplication1.ServiceReference1; private void WCFGetData(int input) { Service1Client WCFObj = new Service1Client(); Label1.Text = WCFObj.GetData(input); WCFObj.Close(); } |