Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

±ê×¼C/C++³ÌÐòͨ¹ýgSOAPµ÷ÓÃWebService

ת×Ô£ºhttp://commandos.blog.51cto.com/154976/130652
Ò»¡¢ »·¾³×¼±¸
ÔÚ±¾ÎÄÖУ¬ËùÓгÌÐò¾ùÔÚLinuxÏ¿ª·¢Íê³É£¬¾­²âÊÔÄܹ»Õý³£ÔËÐС£
ÔÚ¿ª·¢¹ý³ÌÖУ¬ÎÒÃÇÐèÒªÓõ½gSOAP£¬¿ÉÒÔ´ÓÒÔÏÂÍøÖ·ÏÂÔØ»ñµÃ£º[url]http://www.cs.fsu.edu/~engelen/soap.html[/url]
ÎÒÏÂÔصÄÊÇgsoap_2.7.12.tar.gz
ÏÂÔØÏÂÀ´½âѹËõ£¬°´Õý³£°²×°¹ý³Ì½øÐбàÒë¡¢°²×°¡£
# tar zxvf gsozp_2.7.12.tar.gz
# cd gsoap_2.7.12
# ./configure –-prefix=/usr/local/gSOAP£¨Ö¸¶¨°²×°Â·¾¶£©
# make
# make install
¶þ¡¢ Éú³ÉÏà¹ØÎļþ
1¡¢Í¨¹ýWSDLÎĵµ£¬Éú³ÉC/C++Í·Îļþ
# /usr/local/gSOAP/bin/wsdl2h –c –o TestHeader.h [url]http://192.168.0.151:8080/services/TestWS?wsdl[/url]
2¡¢¿½±´gSOAPÔ´´úÂëÖÐimportÎļþ¼ÐϵÄstlvector.hÎļþµ½TestHeader.hͬһĿ¼£¬Èç¹ûÔÚ½âÎöWSDLÎĵµÊ±Ê¹ÓÃÁË-s²ÎÊý£¬¼´²»Ê¹ÓÃSTL£¬Ôò²»ÐèÒª¿½±´ÕâÒ»Îļþ¡£
3¡¢½âÎöTestHeader.hÎļþ£¬Éú³É´æ¸ù³ÌÐò
# /usr/local/gSOAP/bin/soapcpp2 –c –C TestHeader.h
ÃüÁîÖвÎÊý-c´ú±íÉú³É±ê×¼C³ÌÐò£¬ÈôûÓÐÕâ¸ö²ÎÊý£¬ÔòÉú³ÉC++³ÌÐò¡£
ÃüÁîÖвÎÊý-C´ú±í½öÉú³É¿Í»§¶Ë³ÌÐò£¬ÈôûÓÐÕâ¸ö²ÎÊý£¬ÔòĬÈÏÉú³É¿Í»§¶ËºÍ·þÎñ¶Ë³ÌÐò¡£
Èý¡¢ ½øÐÐÏà¹Ø¿ª·¢
1¡¢Ð½¨¹¤³Ì
н¨Ò»¸öCµÄ¹¤³Ì£¬²¢½«¸Õ¸ÕÉú³ÉµÄÎļþ¿½±´µ½¹¤³ÌÖУ¬ÉèÖù¤³ÌÊôÐÔ£¬°üº¬gSOAPÔ´´úÂëĿ¼£¬Á´½ÓÊôÐÔ´¦£¬ÐèÒª°üº¬Îļþlibgsoap.a£¨Ê¹ÓÃCÓïÑÔ¿ª·¢£©»òÕßlibgsoap++.a£¨Ê¹ÓÃC++¿ª·¢£©¡£
2¡¢´úÂ뿪·¢
WebServiceµÄ¾ßÌåµ÷Ó÷½Ê½¿ÉÒԲμûÉú³ÉµÄsoapStub.hÎļþ¡£
Demo´úÂ루µ÷ÓÃWebServiceµÄaddUser£©£º
#include “soapH.h”
#include “TestHeaderHttpBinding.nsmap”
int main()
{
        struct soap clientSOAP;
        struct _ns1__addUser addUserMsg;
        struct _ns1__addUserResponse addUserResponse;
        soap_init(&clientSOAP);
        addUserMsg.in0 = “test”;
        addUserMsg.in1 = “test”;
        add


Ïà¹ØÎĵµ£º

ÓÃC++µ÷ÓÃCµÄ¿âº¯Êý(ת)

 ÓÃC++µ÷ÓÃCµÄ¿âº¯Êý
  C++µ÷ÓÃCµÄ¿âº¯Êýʱ£¬Èç¹ûÍ·Îļþ¶¨ÒåµÃ²»Ç¡µ±£¬¿ÉÄÜ»á³öÏÖÃ÷Ã÷ijº¯ÊýÔÚobjÎļþÖдæÔÚ£¬µ«ÊÇÈ´·¢ÉúÁ´½Óʧ°ÜµÄÇé¿ö£¬³öÏÖÈçÏ´íÎó:
  
  undefined reference to 'xxx'
  ³öÏÖÎÊÌâµÄÔ­ÒòÊÇc¿âº¯Êý±àÒë³ÉobjÎļþʱ¶Ôº¯Êý·ûºÅµÄ´¦ÀíºÍC++²»Í¬¡£ÒòΪC++º¯ÊýÖ§³ÖÖØÔØ£¬Ë ......

[ASM/C/C++]cÓïÑÔÖÐstatic Ó÷¨×ܽá

¼ÙÉèÔÚtest.hÖж¨ÒåÁËÒ»¸östatic bool g_test=false;
Èôtest1.cºÍtest2.c¶¼°üº¬test.h£¬Ôòtest1.cºÍtest2.c·Ö±ðÉú³ÉÁ½·Ýg_test£¬ÔÚtest1.c ÖÐÖÃg_test=true,¶øtest2.cÖÐÈÔȻΪfalse²¢Î´¸Ä±ä£¡shit£¡£¡
Ò»¡¢c³ÌÐò´æ´¢¿Õ¼ä²¼¾Ö
C³ÌÐòÒ»Ö±ÓÉÏÂÁв¿·Ö×é³É£º
      1£©ÕýÎĶΗ—CPUÖ´ÐÐ ......

¶Á¡¶CºÍÖ¸Õë¡·±Ê¼ÇÕªÒª¡¾1¡¿

2010-03-16
1£¬×Ö·û´®³£Á¿£º¾ÍÊÇÔÚÔ´³ÌÐòÖб»Ë«ÒýºÅÀ¨ÆðÀ´µÄÒ»´®×Ö·û£¬ÀýÈç“hello”¡£ÔÚÄÚ´æÖдæ6¸ö×Ö½Ú£¬°üÀ¨×îºóÒ»¸öNUL×Ö½Ú£¨¼´‘\0’£©.
2£¬NULÊÇASCii×Ö·û¼¯ÖБ\0’×Ö·ûµÄÃû×Ö£¬ËüµÄ×Ö½ÚģʽΪȫ0. NULLÖ¸Ò»¸öÆäֵΪ0µÄÖ¸Õ룬ËûÃǶ¼ÊÇÕûÐÍÖµ£¬ÇÒÖµ¶¼Ïàͬ£¬ËùÒÔËûÃÇ¿ÉÒÔ»¥»»Ê¹Ó㬵« ......

extern¼°extern ¡°C¡±Ó÷¨

externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×ÖËü¸æËß±àÒëÆ÷£¬ÆäÉùÃ÷µÄº¯ÊýºÍ±äÁ¿¿ÉÒÔÔÚ±¾Ä£¿é»òÆäËüÄ£¿éÖÐʹÓá£
1¡£¶ÔÓÚextern±äÁ¿À´Ëµ£¬½ö½öÊÇÒ»¸ö±äÁ¿µÄÉùÃ÷£¬Æä²¢²»ÊÇÔÚ¶¨Òå·ÖÅäÄÚ´æ¿Õ¼ä¡£Èç¹û¸Ã±äÁ¿¶¨Òå¶à´Î£¬»áÓÐÁ¬½Ó´íÎó
2¡£Í¨³££¬ÔÚÄ£¿éµÄÍ·ÎļþÖжԱ¾Ä£¿éÌṩ¸øÆäËüÄ£¿éÒýÓõĺ¯ÊýºÍÈ«¾Ö±äÁ ......

Cµ÷ÓöԻ°¿ò

#include "windows.h"
void main()
{
MessageBox(NULL, "ÄãºÃ°¡£¡", "Ìáʾ", MB_OK);
return 0;

}

ͨ¹ýwindows.hÎļþµ÷ÓÃwindows×Ô´øµÄapiº¯ÊýMessageBox£¬À´Íê³ÉÌáʾ¿ò£¬Ð§¹û°ô
null±íʾ¸½ÊôµÄ´°ÌåΪ¿Õ
MB_OK±íʾ¶Ô»°¿òµÄÀàÐÍ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ