gSOAP RESTful 实现是否需要定义 WSDL

Does gSOAP RESTful implementation require the definition of a WSDL

我查看了 gSOAP 中的示例,其余示例定义了 WSDL,然后为客户端和服务器应用程序生成代码。有没有办法在不定义 WSDL 的情况下使用 gSOAP 实现 RESTful 服务?

当我尝试编译下面的示例时,出现以下错误

"/usr/local/lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o): 在函数中soap_set_error': /home/mtwells/Downloads/gsoap-2.8/gsoap/stdsoap2_cpp.cpp:17314: undefined reference tosoap_faultcode'"

因为它正在寻找使用 wsdl2h 生成的代码。

1 #include "plugin/httpget.h"
2 
3
4 int main(int argc, char **argv)
5 {
6     struct soap *soap = soap_new();
7
8     soap_destroy(soap);
9     soap_end(soap);
10     soap_free(soap);
11     return 0;
12 }

https://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sEc19.38.2

The gSOAP soapcpp2 compiler can also generate WSDL definitions for implementing a service from scratch, i.e. "without defining a WSDL first." This "closes the loop" in that it enables Web services development directly from a set op C/C++ operations in a header file without the need for users to analyze Web service details.

根据gSOAP手册1.2,gSOAP soapcpp2编译器可以根据头文件生成所需的客户端和服务器应用程序。这意味着 然后你必须自己编写头文件并将其提供给 soapcpp2 编译器 这不仅会生成服务/客户端应用程序,还会生成丢失的 wsdl 文件如果您将其包含在选项中,对您来说!在这种情况下,您不需要 wsdl2h 工具。

此致