Qt 开发WEB Services客户端代码(使用gSoap)

   1.   首先下载gSoap开发包 http://sourceforge.net/projects/gsoap2  目录包含 wsdl2h.exe( 由wsdl生成接口头文件C/C++格式的头文件 )和soapcpp2.exe(用来根据接口头文件生成应用程序客户端和服务端的框架文件)
    2.  wsdl2h.exe  -o interface.h http://127.0.0.1:8080/axis2/services/HelloWorld?wsdl
    3.  soapcpp2.exe -C interface.h  则生成客户端相关文件
    4. 加入#include "soapH.h"、  #include "calc.nsmap" 两个文件
    5.
const char server[] = "http://websrv.cs.fsu.edu/~engelen/calcserver.cgi";
int main(int argc, char **argv)
{
      string qsStr;// 调用生成参数的函数
    struct soap clientObj;
   soap_init(&clientObj);
   _ns1__sendSourceFrameByRtuAddress sendSourceFrameByRtuAddress;
    sendSourceFrameByRtuAddress.strCommand = &qsStr;

    _ns1__sendSourceFrameByRtuAddressResponse sendSourceFrameByRtuAddressResponse;
    soap_call___ns1__sendSourceFrameByRtuAddress(&clientObj,m_qsHttpHost.toStdString().c_str(),"",&sendSourceFrameByRtuAddress,sendSourceFrameByRtuAddressResponse);
    if (clientObj.error)
    {  
   soap_destroy(&clientObj);
    soap_end(&clientObj);
   soap_done(&clientObj);
          continue;
    }
   return 0;

}

http://www.qtcn.org/bbs/apps.php?q=diary&a=detail&did=2338&uid=144527

原文地址:https://www.cnblogs.com/findumars/p/6392359.html