前提:
安裝了apache /mod_perl/perl (我這裏的版本分別爲 2.0/2.0/5.8)
之後就要配置httpd.conf,分配一個單獨的目錄給web service。用於存perl 模塊以及代碼
PerlRequire /絕對路徑(或者相對)/startup.pl ## 參考http://www.fayland.org/journal/mod_perl_configuring.html
<Location /world>
SetHandler perl-script
PerlHandler CLASS::World
</Location>
其中startup.pl 代碼如下:
之後在/xxx/xxx/xx 目錄下建立 CLASS/World.pm perl模塊文件,其內容如下:
到此,服務器端就算簡單的完成了。
寫一個簡單的client,調用server:
結果:
Hello, Joe
Goodbye, Joe
當然我這個還不完美。起碼頁面上還看不到wsdl說明。需要進一步研究:)