目录
软件说明
安装Apahce
安装Axis2
发布axis.so
编译Axis2 Sample
编译测试Axis2 hello demo
参考资料
备注 错误说明
软件说明
1. httpd-2.2.22.tar.gz
2. axis2c-src-1.6.0.tar.gz
安装Apahce
解压:tar zxvf httpd-2.2.22.tar.gz cd httpd-2.2.22 配置:./configure --prefix=/apache/httpd #把HTTP服务安装到/apache/httpd目录下 编译:make 安装:make install 定制:编辑/apache/httpd/conf/httpd.conf中的ServerRoot值为”/apache/httpd” 去掉ServerName的注释,并设置值为 localhost:80 启动:/apache/httpd/bin/apachectl start 检验:使用浏览器打开网址 http://localhost 看是否出现Apache的欢迎页面。
修改位置如图所示:
安装Axis2
1. 设置环境变量
vim /etc/profile
到最后一行增加以下内容
AXISCPP_HOME=/apache/axis2c-src-1.6.0
AXIS2C_HOME=/apache/axiscpp
AXISCPP_DEPLOY=/apache/axiscpp
LD_LIBRARY_PATH=/usr/lib:$AXISCPP_DEPLOY/lib:$LD_LIBRARY_PATH
export AXIS2C_HOME AXISCPP_HOME AXISCPP_DEPLOY LD_LIBRARY_PATH
注销用户重新登录
2. 安装
解压:tar zxvf axis2c-src-1.6.0.tar.gz --directory=/apache 将axis c++源码解压到/apache/axis-c-src-1-3-linux目录下。 cd $AXISCPP_HOME 配置:./configure --prefix=$AXISCPP_DEPLOY --with-apache2=/apache/httpd/include 编译:make (需要几分钟时间) 安装:make install 检验:检查/apache/axiscpp目录下是否生成了Axis C++的目录。
发布axis.so
cp $AXIS2C_HOME/lib/libmod_axis2.so.0.6.0 /apache/httpd/modules/mod_axis2.so
vim /apache/httpd/conf/http.conf增加以下内容
LoadModule axis2_module modules/mod_axis2.so Axis2RepoPath /apache/axiscpp Axis2LogFile /usr/tmp/AxisLog Axis2MaxLogFileSize 200 Axis2LogLevel LOG_LEVEL <Location /axis2> SetHandler axis2_module </Location>
如图所示:
编译Axis2 Sample
cd /apache/axis2c-src-1.6.0/samples/ ./configure --prefix=${AXIS2C_HOME} --with-axis2=${AXIS2C_HOME}/include/axis2-1.6.0 make m cannot set language to "en_us"ake install
编译测试Axis2 hello demo
//编译服务端 cd /apache/axiscpp/docs/docs/hello/service gcc -shared -olibhello.so -I$AXIS2C_HOME/include/axis2-1.6.0/ -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver hello_svc.c cp hello/services.html services.xml mkdir /apache/axiscpp/services/hello mv services.xml libhello.so /apache/axiscpp/services/hello //编译客户端 cd /apache/axiscpp/docs/docs/hello/client gcc -o hello -I$AXIS2C_HOME/include/axis2-1.6.0/ -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver hello.c -ldl -Wl,--rpath -Wl,$AXIS2C_HOME/lib //测试 开启两个终端,一个运行服务端,一个运行客户端 服务端: 重启httpd /apache/httpd/bin/apachectl stop /apache/httpd/bin/apachectl start /apache/axiscpp/bin/axis2_http_server 客户端: cd /apache/axiscpp/docs/docs/hello/client ./hello 可以看到在服务端返回的信息 在服务端可以看到客户端发送的信息
如图所示:
客户端:
服务端:
参考资料
http://axis.apache.org/axis2/c/core/docs/axis2c_manual.html
备注 错误说明
1. 运行客户端后没有提示内容,可以从log中看到错误信息
Vim /usr/tmp/AsixLog
124 [Wed Jun 20 19:06:31 2012] [error] class_loader.c(162) Loading shared library /apache/axiscpp/services/hello/libhello.so Failed. DLERROR IS /apache/axiscpp/services/hello/libhello.so: cannot restore segment prot after reloc: Permission denied
这是因为SELINUX的问题,需要关闭SELINX,执行:/usr/sbin/setenforce 0
在重启apache服务,在运行服务端程序.运行客户端程序就可以看到内容
文档下载: