XMethods - 免費 Web Service 收集站

XMethods - 免費 Web Service 收集站

Emerging web services standards such as SOAP, WSDL and UDDI will enable system-to-system integration that is easier than ever before. This site lists publicly available web services.

http://www.xmethods.net/ve2/Directory.po

XMethod 是一個 UDDI (Universal Description, Discovery and Integration ) Server,收集了許多免費的 Web Service 可以使用。其中,又以 M$.Net 平台撰寫的 XML Web Serive 居多。在 .Net 平台上,加入 Web 參考,網址輸入WSDL (Web Service Definition Language),就能建立類別,輕鬆使用別人撰寫好的功能。

舉例來說,網站上常常需要使用者輸入 email,程式設計師通常只會實作兩種功能,一是判斷是否有輸入,二是判斷是否符合 email 格式。最常遺漏的功能也是最重要的功能是,檢查該 email 是否是有效的 email 網址。(test@tes.com 可以符合 email regular expression,卻不是一個合法且有效的 email。)

範例:

  1. protected void emailValidator_ServerValidate( object source, ServerValidateEventArgs args)
  2. {
  3. ValidateEmail ws = new ValidateEmail( );
  4. args.IsValid = ws.IsValidEmail (txtEmail.Text ) ? true : false;
  5. }

 

現在,在 .Net 平台中加入 Web 參考,輸入 【http://www.webservicex.com/ValidateEmail.asmx?WSDL】。在程式中 using 該 namespace 後,建立 ValidateEmail 類別物件,使用 IsValidEmail 方法並傳入使用者 email,如果該 email 是合法且有效的就回傳 true,否則就回傳 false。以上幾個簡單的步驟,就可以寫出檢查 email 有效性的功能,真是輕鬆愉快。