gsoap使用示例

  1. download gsoap_2.8.33.zip https://sourceforge.net/projects/gsoap2/files/gSOAP/
    Looking for the latest version? Download gSOAP 2.8.33 stable (24.1 MB)
  2. unzip gsoap_2.8.33.zip // 解压gsoap_2.8.33.zip
  3. cd gsoap-2.8
  4. 编译生成 soapcpp2和wsdl2h这2个工具。
    打开 INSTALL.sh
    本机编译(参考35~44行):
    To do so, use the command line to run ‘make’ with generic makefiles:

         $ cd gsoap/src
         $ make -f MakefileManual
         $ cd gsoap/wsdl
         $ make -f MakefileManual
    
     This builds 'soapcpp' with 'gcc' and 'wsdl2h' with 'g++' and installs the
     binaries in gsoap/bin. Move them to a bin directory or include them in your
     executalbe path.
    

    交叉编译(参考51~56行):
    To compile with a different compiler instead of GCC, for example ‘clang’, use:

         $ cd gsoap/src
         $ make CC=clang -f MakefileManual
         $ cd gsoap/wsdl
         $ make CC=clang CPP=clang++ -f MakefileManual secure
     注:secure选项为HTTPS使能。 不需要HTTPS时不需要 secure 选项。
    
  5. 将gsoap/bin目录下的 soapcpp2和wsdl2h拷贝到$PATH目录下。
  6. 测试gsoap.(主机可以访问互联网)

       $ cd gsoap/samples/calc
       $ cp ../../stdsoap2.c .
       $ cp ../../stdsoap2.h .
       $ soapcpp2 -c calc.h
       $ cc -o calcclient calcclient.c stdsoap2.c soapC.c soapClient.c
    

    编译生成calcclient, 并执行
    $ ./calcclient add 3 4
    result = 7
    测试成功。

你可能感兴趣的:(linux)