0

I looked through the samples in gSOAP and the rest example defines a WSDL and then generates code for the client and server applications. Is there a way to implement a RESTful service using gSOAP without defining a WSDL?

When i try to compile the example below i get the following error

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

because it is looking for the generated code using 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

Michael
  • 546
  • 1
  • 7
  • 19
  • What are you even including? from my experience with gSoap you have to run wsdl2h. on a wsdl then stdsoap2 on the file that generates to end up with files to include/user – AngryDuck May 19 '15 at 12:31
  • RESTful style does not require a WSDL. However, it appears that gSOAP's implementation of REST requires a WSDL. Is it true that gSOAP requires the generated code from a WSDL? – Michael May 19 '15 at 17:07
  • from anything uv ever done with it it does – AngryDuck May 19 '15 at 17:09
  • Is it possible to use gSOAP RESTful implementation without a WSDL? – Michael May 19 '15 at 18:45
  • why would you not have a WSDL if you have a web service? dont think you can use this without one – AngryDuck May 20 '15 at 13:26
  • RESTful web services do not require a WSDL. http://stackoverflow.com/questions/15907114/why-rest-does-not-have-a-wsdl-unlike-soapI think you are right with gSOAP. I have not found a way around the WSDL requirement. – Michael May 20 '15 at 14:47

1 Answers1

1

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.

According to the gSOAP manual 1.2, the gSOAP soapcpp2 compiler can generate the required client and server applications just on the basis of the header files. This means that then you would then have to write the header files all by yourself and feed it to the soapcpp2 compiler which will not only generate the service/ client applications but also generate the missing wsdl file for you if you include it in the option! In this case you do not need the wsdl2h tool.

Regards

Sam
  • 36
  • 3
  • I'm not clear why this is downvoted? We use this mechanism and I think it is the right answer. The interface can be defined in the form of a very C-like structure definitions, and function prototypes taking those structures as arguments. soapcpp2 then generates everything you need from this definition (which includes a WSDL, although that can be discarded if using the REST options instead). – asc99c Apr 10 '18 at 19:14