【文章內(nèi)容簡(jiǎn)介】
um, null, null)。 // 等待異步調(diào)用完成 ()。 // Get 完成結(jié)果。 long[ ] results = (ar)。 4. 使用 生成 XML Web services ? 創(chuàng)建 Web 服務(wù)項(xiàng)目 1. 在 “ 文件 ” 菜單上,選擇 “ 新建網(wǎng)站 ” 。 2. 在 “ 新建網(wǎng)站 ” 對(duì)話框中,選擇 “ Web 服務(wù) ”圖標(biāo)。 3. 輸入要在其中開發(fā) XML Web services 的 Web 服務(wù)器地址,并指定 Web服務(wù)名,如 “ 默認(rèn)情況下,項(xiàng)目使用本地計(jì)算機(jī) “ 實(shí)現(xiàn) XML Web services ? 例 : [( Namespace = Description=A temperature conversion service.)] public class TempConvert1 : { …… //在 Service 類中,添加以下代碼以聲明 ConvertTemperature 函數(shù): [WebMethod(Description=This method converts a temperature in + degrees Fahrenheit to a temperature in degrees Celsius.)] public double ConvertTemperature(double dFahrenheit) { return ((dFahrenheit 32) * 5) / 9。 } } 調(diào)試 XML Web services 1. 添加一個(gè)斷點(diǎn)。 2. 在 “ 調(diào)試 ” 菜單上單擊 “ 啟動(dòng) ” ,將在 IE中打開 .asmx 文件時(shí), XML Web services 會(huì)返回一個(gè)服務(wù)幫助頁 . 3. 點(diǎn)擊你的服務(wù) ,輸入?yún)?shù) ,執(zhí)行 4. 停止在斷點(diǎn) . 執(zhí)行結(jié)果顯示 xml頁 ,如類似 ?xml version= encoding=utf8 ? double xmlns= 部署 XML Web services ? 使用 Web 安裝項(xiàng)目部署 XML Web services ? 通過復(fù)制項(xiàng)目來部署 XML Web services XML Web services 的代碼 ? 在 中 XML Web services 由兩部分組成 1。 . C代碼源文件 2. .asmx 文件 示例:一個(gè) XML Web services: Service1, . ,含一個(gè)方法: HelloWorld namespace WebService1 { [WebService(Namespace = public class Service1 : { [WebMethod] public strin