当前位置: > Linux服务器 > apache >

在apche20上配置mod_gsoap的操作步骤

时间:2015-05-02 22:11来源:linux.it.net.cn 作者:IT

在Ubuntu上配置的操作步骤:

 

1. 检查apache是否至此后mod_so模块:

  $   apache2ctl -l 

结果显示应包含:

Compiled in modules:
  mod_so.c

 

2. 编译 mod_gsoap:

sudo apxs -a -i -c  mod_gsoap.c

 

sudo cp apache_gsoap.h /usr/include/apache2/

 

3. 编译测试样本

 

luo@acs:~/gsoap-2.8/gsoap/samples$ cp -R calc calc_server

luo@acs:~/gsoap-2.8/gsoap/samples$ cd calc_server/
luo@acs:~/gsoap-2.8/gsoap/samples/calc_server$ ls

 

vi calcserver.c

#include "apache_gsoap.h"
IMPLEMENT_GSOAP_SERVER()


Then compile and build:


$ soapcpp2 -c -SL -wx calc.h
$ apxs2 -a -c calcserver.c soapC.c soapServer.c stdsoap2.c

 

$ll

drwxr-xr-x  2 luo root   4096 Apr 12 14:28 .libs/

luo@acs:~/gsoap-2.8/gsoap/samples/calc_server$ cd .libs/

 

luo@acs:~/gsoap-2.8/gsoap/samples/calc_server/.libs$ pwd
/home/luo/gsoap-2.8/gsoap/samples/calc_server/.libs

 

luo@acs:~/gsoap-2.8/gsoap/samples/calc_server/.libs

$ ll

-rwxr-xr-x 1 luo root 280667 Apr 12 14:28 calcserver.so*

 

4.编辑 httpd.conf文件

$sudo vi /etc/apache/httpd.conf

<IfModule mod_gsoap.c>
 <Location /soap>
  SetHandler gsoap_handler
  SOAPLibrary /home/luo/gsoap-2.8/gsoap/samples/calc_server/.libs/calcserver.so
  Order allow,deny
  Allow from all
 </Location>
</IfModule>

 

5. 重启apache服务器

luo@acs:~$ sudo /etc/init.d/apache2 restart

 

6. 编译测试的客户端

luo@acs:~/gsoap-2.8/gsoap/samples/calc_server$ gcc -o calcclient calcclient.c soapC.c soapClient.c stdsoap2.c

 

7. 测试

luo@acs:~/gsoap-2.8/gsoap/samples/calc_server$ ./calcclient add 1 2
result = 3

 

OK!



(责任编辑:IT)
------分隔线----------------------------