我正在尝试找出独立于 wsdl 的 c++ soap 客户端的最佳方式。
我需要的是只知道函数的名称和参数列表来发送和发送它并接收 soap 响应或类似的东西(我知道这并不那么简单)。
我的想法是做这样的事情: SOAP Request and Response Read from and to file using libcurl - C 或者 http://www.cplusplus.com/forum/general/16225/
你能告诉我最好的方法吗,或者最好的方法是使用像 gSoap 这样的库并在 c++ 代码中执行 gSoap 生成的类的 c++ 方法?
谢谢
最佳答案
请注意,gSOAP 是 GPL 许可的。一个限制较少的选择是 Axis2/C++ .
使用 Axis2/C++,您可以从 WSDL 生成 stub ,并使用生成的类在您的代码中调用 Web 服务
生成 stub (是 Java,但这是一次性操作):
java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws Calculator.wsdl -lc++ -sclient
然后使用:
#include "Calculator.h"
#include <stdio.h>
int main()
{
Calculator c;
int intOut;
c.add(20, 40, intOut);
printf("result is = %d\n", intOut);
return 0;
}
关于c++ - 如何在 C++ 中进行 soap 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13936430/