如何在 C++ 中进行肥皂调用

Nun*_*uno 2 c++ xml client soap

我试图找出制作独立于 wsdl 的 C++ Soap 客户端的最佳方法是什么。

我需要的是只知道函数的名称以及要发送和发送它的参数列表以及接收肥皂响应或类似的东西(我知道这并不那么简单)。

我的想法是做类似的事情: SOAP Request and Response Read from and to file using libcurl - Chttp://www.cplusplus.com/forum/general/16225/

您能否指出执行此操作的最佳方法,或者最好的方法是使用像 gSoap 这样的库并在 c++ 代码中执行 gSoap 生成的类的 c++ 方法?

谢谢

rus*_*tyx 5

请注意,gSOAP 是 GPL 许可的。限制较少的替代方案是Axis2/C++

使用 Axis2/C++,您可以从 WSDL 生成存根,并使用生成的类在代码中调用 Web 服务

生成存根(是 Java,但这是一次性操作):

java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws Calculator.wsdl -lc++ -sclient
Run Code Online (Sandbox Code Playgroud)

然后使用:

#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; 
}
Run Code Online (Sandbox Code Playgroud)

更多详情请点击这里