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
Ïà¹ØÎĵµ£º
µ÷Óú¯Êýʱ£¬¼ÆËã»ú³£ÓÃÕ»À´´æ´¢´«µÝ¸øº¯ÊýµÄ²ÎÊý¡£
Õ»ÊÇÒ»ÖÖÏȽøºó³öµÄÊý¾Ý½á¹¹£¬Õ»ÓÐÒ»¸ö´æ´¢Çø¡¢Ò»¸öÕ»¶¥Ö¸Õë¡£Õ»¶¥Ö¸ÕëÖ¸Ïò¶ÑÕ»ÖеÚÒ»¸ö¿ÉÓõÄÊý¾ÝÏ±»³ÆΪջ¶¥£©¡£Óû§¿ÉÒÔÔÚÕ»¶¥ÉÏ·½ÏòÕ»ÖмÓÈëÊý¾Ý£¬Õâ¸ö²Ù×÷±»³ÆΪѹջ(Push)£¬Ñ¹Õ»ÒÔºó£¬Õ»¶¥×Ô¶¯±ä³ÉмÓÈëÊý¾ÝÏîµÄλÖã¬Õ»¶¥Ö¸ÕëÒ²ËæÖ®Ð޸ġ£Óû§Ò²¿ÉÒÔ´Ó¶ÑÕ»ÖÐ ......
Ç°ÑÔ
ÔÚ±àд³ÌÐòµÄʱºò,ÎÒÃǾ³£ÒªÓõ½ºê¶¨Òå,ºê¶¨ÒåµÄÒýÈëȷʵ´ó´óÌá¸ßÁ˳ÌÐòµÄ¿É¶ÁÐÔ,¿ÉÒÆÖ²ÐÔ,·½±ãά»¤.......Òò´ËƯÁÁµÄºê¶¨ÒåºÜÖØÒª.....ʹÓú궨ÒåÒ²ÊÇÓÐÒ»¶¨¼¼ÇɵÄ,ÏÂÃæÊǹØÓں궨ÒåµÄһЩºÃµÄ³£Óõķ½·¨,¾Ý˵ÊÇһЩ³ÉÊìµÄÈí¼þÖг£ÓõÄ....ÎÒÌôÁËһЩÎÒÃÇÄܹ»Àí½â¶øÇÒʵÓõãµÄ.... µ«ÊÇ,ʹÓú궨ÒåʱҲҪʮ·ÖСÐÄ,Ó ......
CÓïÑÔÎļþ²Ù×÷½Ó´¥ºÜ¾ÃÁË£¬Ò»Ö±Ã»ÓÐ×ܽáÏà¹ØÄÚÈÝ£¬½ñÌìÓõ½Á˾ÍÈ¥ÕÒÁËÕÒÏà¹ØÄÚÈÝ¡£
ÔÚANSI CÖУ¬¶ÔÎļþµÄ²Ù×÷·ÖΪÁ½ÖÖ·½Ê½£¬¼´Á÷ʽÎļþ²Ù×÷ºÍI/OÎļþ²Ù×÷
typedef struct {
int level; /* fill/empty level of buffer */
unsigned flags; /* File status flags */
char fd; /* File descriptor */
unsigned char hold ......
ÔÚÕâ¸öÀý×ÓÀ»Øµ÷º¯Êý±È½ÏÁ½¸öÖµ¡£²éÕÒº¯ÊýÏò±È½Ïº¯Êý´«µÝÁ½¸öÖ¸ÏòÐèÒª½øÐбȽϵÄÖµµÄÖ¸Õ룬²¢¼ì²é±È½Ïº¯ÊýµÄ·µ»ØÖµ¡£ÀýÈ磺Áã±íʾÏàµÈµÄÖµ£¬ÏÖÔÚ²éÕÒº¯
Êý¾ÍÓëÀàÐÍÎ޹أ¬ÒòΪËü±¾Éí²¢²»Ö´ÐÐʵ¼ÊµÄ±È½Ï¡£È·Êµ£¬µ÷ÓÃÕß±ØÐë±àд±ØÐèµÄ±È½Ïº¯Êý£¬µ«ÕâÑù×öÊǺÜÈÝÒ׵ģ¬ÒòΪµ÷ÓÃÕßÖªµÀÁ´±íÖÐËù°üº¬µÄÖµµÄÀàÐÍ ......