ÓÃC/gsoapʵÏÖWebService
תÌù×Ô£ºhttp://blog.sina.com.cn/s/blog_629562fe0100gs2l.html
ÉÔ×÷ÐÞ¸Ä
gSOAPÊÇÒ»¸ö¿äƽ̨µÄ£¬ÓÃÓÚ¿ª·¢Web Service·þÎñ¶ËºÍ¿Í»§¶ËµÄ¹¤¾ß£¬ÔÚWindows¡¢Linux¡¢MAC OSºÍUNIXÏÂʹÓÃCºÍC++ÓïÑÔ±àÂ룬¼¯³ÉÁËSSL¹¦ÄÜ¡£
ÏÂÔصØÖ·£ºhttp://sourceforge.net/projects/gsoap2
¹Ù·½ÍøÕ¾£ºhttp://genivia.com/Products/gsoap/index.html
Ò»¡¢·þÎñÆ÷¶Ë
1¡¢Ê×Ïȱàд add.hÎļþ£º£¨ÎÒÊÔ¹ý°ÑÕâЩעÊÍÈ«²¿É¾³ýҲûÓÐÎÊÌ⣩
//gsoap ns service name: add
//gsoap ns service namespace: http://mail.263.net/add.wsdl
//gsoap ns service location: http://mail.263.net
//gsoap ns service executable: add.cgi
//gsoap ns service encoding: encoded
//gsoap ns schema namespace: urn:add
int ns__add( int num1, int num2, int* sum );
2¡¢ÓÃgsoap/binĿ¼ÏµÄsoapcpp2.exe³ÌÐò£¬Éú³ÉһЩÎļþ¡£
·½·¨£ºÓÃcmdÖ´ÐÐsoapcpp2.exe add.h¡£
soapcpp2.exe¿ÉÒÔ´ø²ÎÊýÖ´ÐУ¬¾ßÌåÖ´ÐÐsoapcpp2.exe -h²é¿´¡£(ʾÀý£ºhttp://www.cppprog.com/2009/0723/138_2.html)
ÔÚÕâ¸öĿ¼Ï»á×Ô¶¯Éú³ÉÐí¶à½«À´ÓÐÓõÄÎļþ£¬Èçadd.namap,soapH.h,soapC.cpp,soapClient.cpp,soapServer.cppµÈÎļþ¡£
3¡¢Ð½¨Ò»¸öwin32¿ØÖÆ̨¹¤³Ì£¬¼ÓÈëwsock32.lib¿â£¬½«¸Õ²ÅÉú³ÉµÄÄÇЩÎļþÌí¼Óµ½¹¤³ÌÖС£
È»ºó±àдaddserver.cppÖ÷³ÌÐò£º
#include "soapH.h" //ÔÎÄÊÇ#include "addH.h"¡£
#include "add.nsmap"
int main(int argc, char **argv)
{
int m, s;
struct soap add_soap;
soap_init(&add_soap);
//soap_set_namespaces(&add_soap); //ÔÎÄÕâ¸öÊÇ´ò¿ªµÄ¡£
if (argc < 2)
{
printf("usage: %s <server_port> \n", argv[0]);
exit(1);
}
else
{
m = soap_bind(&add_soap, NULL, atoi(argv[1]), 100);
if (m < 0)
{
soap_print_fault(&add_soap, stderr);
exit(-1);
}
fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
for ( ; ; )
{
s = soap_accept(&add_soap);
if (s < 0)
{
soap_print_fault(&add_soap, stderr);
exit(-1);
}
fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);
soap_serve(&add_soap);//¸Ã¾ä˵Ã÷¸ÃserverµÄ·þÎñ //ÔÎÄÊÇadd_serve(&add_soap);
soap_end(&add_soap);
}
}
ret
Ïà¹ØÎĵµ£º
×î½üά»¤Logger¹²Ïí¿âµÄʱºòÐÂÔöÁ˸üÈËÐÔ»¯µÄ×Ô¶¯´´½¨¸÷¼¶Ä¿Â¼µÄ¹¦ÄÜ£¬ÏÂÃæÊÇÎÒʵÏÖ´´½¨ÖîÈç "c:\a\b\c\d\yeah.log"Öеĸ÷¼¶Îļþ¼ÐµÄ¹ý³Ì£¬Çë´ó¼ÒÖ¸½Ì£¡
BOOL CreateDirectoryInPathW(const wchar_t *sLogPath)
{
static BOOL bRet = 0;
CString csFullDir(_T(""));//Ôʼȫ·¾¶
int nLen = 0;//ÔÊ ......
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <getopt.h>
#define MAX_READFILE 24
#define MAX_INPUTFILE 10240
char *file ;
void time_out(){
syslog(LOG_INFO,"read inp ......
Ïê½âCÅÌWindowsÎļþ¼ÐÀïÖØÒªÎļþµÄ×÷ÓÃ
ÔÚÕû¸öWindows²Ù×÷ϵͳÖУ¬×îÖØÒªµÄĪ¹ýÓÚ“Windows”Îļþ¼Ð£¬¶ÔµçÄÔ½øÐÐÈκβÙ×÷¼¸ºõ¶¼Óйء£Á˽âÕâÀï¶ÔÓÚÕÆÎÕÕû¸öϵͳµÄÔË×÷ÓкܴóµÄ×÷Óã¬Èç¹ûÓÐÐËȤ²»·ÁÍùÏ¿´¿´¡£
Ò»¡¢Ó¡ÏóÖеÄWindowsÎļþ¼Ð
“Windows”Îļþ¼Ð¸øÈ˵ĵÚÒ»Ó¡Ïó¾ÍÊÇ´ó¶øÂÒ£¬¸Ð¾õÀïÃæ ......
¹ØÓÚCµÄ˼¿¼
Cong Wang
May, 2006
Network Engineering Department
Institute of Post and Telecommunications, Xi'an, P.R.China
ÒýÑÔ
CÓïÑÔ½áºÏÁË»ã±àµÄËùÓÐÍþÁ¦£¬ËüµÄ³éÏó³Ì¶ÈÅöÇɼÈÂú×ãÁ˳ÌÐòÔ±µÄÒªÇó, ÓÖÈÝÒ×ʵÏÖ¡£ÒòÆä¶ÀÌصÄÁé»îÐÔºÍÇ¿´óµÄ¿ÉÒÆÖ²ÐÔ£¬ÏµÍ³³ÌÐòÔ±ºÍºÚ¿ÍÃǸüÊǶÔËüÖÓ°® ......