必須先將以 Boo 寫的 Web Service 編譯為 Assembly,然後再製作一個以 c# 或 vb.net 寫的 asmx 繼承該 Web Service 類別才行。
否則會遇到 “The invoked member is not supported in a dynamic module.” 的錯誤。
我是在遇到錯誤的時候,去參考 boo 源碼 examples/asp.net 下的 Math.asmx 與 Math.asmx.boo 才知道這件事情的。
本來我還在納悶,為甚麼 examples/asp.net 下會有一個用 c# 寫的 asmx,還以為是搞錯了呢~
// Math.asmx.boo // 要先編譯好,放在 bin 目錄下:booc -t:library -out:bin/Math.dll Math.asmx.boo import System.Web.Services [WebService] class Math: [WebMethod] def Add(a as int, b as int): return a+b [WebMethod] def Multiply(a as int, b as int): return a*b
<%@WebService Class="MathService" Language="C#" %> // Math.asmx public class MathService : Math // 繼承用 Boo 寫的 Math 類別 { }