易截截图软件、单文件、免安装、纯绿色、仅160KB

ACE+gSOAP实现高性能WebService Server(C/C++)

1、开发环境请参考《搭建ACE-5.7.4+VS2008开发环境》一文
2、gSOAP库,下载地址:http://gsoap2.sourceforge.net/,本文使用的版本是:gsoap_2.7.15,gSOAP的编程可以参考doc目录下的soapdoc2.pdf,官方文档写的非常详细。
让我们开始gSOAP编码旅程:
1、创建gsoap_server.h:
//gsoap ns2 service namespace: http://localhost:9908/ccm_mimport/services.wsdl
//gsoap ns2 service location: http://localhost:9908/ccm_mimport/services
typedef char * xsd__string; // encode char * value as the xsd:string schema type
typedef int xsd__int; // encode xsd__int value as the xsd:int schema typ
struct ns2__makeCardNotifyReqBean
{
xsd__string id_makecard_order;
xsd__int card_type;
xsd__string file_name;
xsd__string start_card_serial;
xsd__string end_card_serial;
xsd__int card_count;
};
struct ns2__makeCardNotifyRspBean
{
xsd__int result; //结果
xsd__string error_desc; //错误描述
};
//卡数据生成结果通知接口
int ns2__makeCardNotify(struct ns2__makeCardNotifyReqBean req, struct ns2__makeCardNotifyRspBean *rsp);

注:头文件上面的注释用于配置服务访问地址,而非单纯的注释;详细配置说明可以参考官方文档
2、把%GSOAP_HOME%\gsoap\bin\win32目录配置到系统%Path%里,或者将目录下的soapcpp2.exe和wsdl2h.exe两个文件直接拷贝到gsoap_server.h所在目录;
3、编写批处理文件:
echo off
del *.c *.h *.xml *.nsmap *.cpp
soapcpp2 -c -S gsoap_server.h
copy soapC.c ..\soapC.cpp
copy soapServer.c ..\soapServer.cpp
copy soapH.h ..\soapH.h
copy soapStub.h ..\soapStub.h
copy ns2.nsmap ..\gsoap_server.nsmap
echo .
echo /******************************/
echo .
echo 生成的ns2.wsdl必须删除schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"属性
echo .
echo /******************************/
echo .
pause

4、编写业务实现代码:
#include <ctype.h>
#include <string>
#include <ace/OS.h>
#include <ace/OS_NS_ctype.h>
#include <ace/OS_NS_string.h>
#include "Global_Define.h"
#include "ffcs_logger.h"
#include "stdsoap2.h"
#include "soapH.h"
#include "gsoap_se


相关文档:

如何使C,C++编译器都可以调用C写的DLL

    由于C++编译器需要支持函数的重载,会改变函数的名称,与标准C中函数名称不同。然而dll的导出函数通常是标准C定义的,让标准C编写的dll函数定义在C和C++编译器下都能编译通过,通常会使用以下的格式:(这个格式在很多成熟的代码中很常见)
#ifdef __cplusplus extern "C" 

#endif
// ......

《C专家编程》2.3C语言中的符号重载

C语言中许多符号是被“重载”的,有些关键字也被重载而具有好几种意义,值得注意的几个符号如下:
符号      意义
static   在函数内部,表示该变量的值在各个调用间一直保持延续性
            在函数这一级,表示该函数只对本文件可见
extern 用于 ......

选C的概率真的是最高的!

从小老师就教导我们,不会做的题就选C,因为选择题选C的概率是最高的。事实上真是如此吗?今天我突发奇想,利用Google做了一个小实验。统计显示,答案选C的题果然是最多的! Results 1 - 10 of about 364,000 for "这道题选A".
Results 1 - 10 of about 352,000 for "这道题选B".
Results 1 - 10 of about 521,000 for ......

C指针深入与内存泄漏

指针是一个特殊的变量,它里面存储的数值被解释成为内存里的一个地址。   要搞清一个指针需要搞清指针的四方面的内容:指针的类型,指针所指向的   类型,指针的值或者叫指针所指向的内存区,还有指针本身所占据的内存区。让我们分别说明。  
  先声明几个指针放着做例子:   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号