Publishing wsdl with a standalone gSOAP server?

Now I have developed a standalone gSOAP server on port 8080 and it works for SOAP RPC.

But I want to return wsdl contents of the wsdl file on my file system when clients request to receive wsdl on port 8080.

What can I do to return wsdl to clients?

+4
source share
1 answer

I used the xd tool to create an embedded version of my wsdl and saved the wsdl.h file with this command line (I do this in my CMakeList.txt):

${GSOAP_ROOT_DIR}/bin/win32/xd -dwsdl ${CMAKE_CURRENT_BINARY_DIR}/${SOAP_NAME_SERVICE}.wsdl > ${CMAKE_CURRENT_BINARY_DIR}/wsdl.h 

After that, I implemented this function, which might be better done with parameters in the GET request:

 int http_get(struct soap *soap) { soap_response(soap, SOAP_HTML); // HTTP response header with text/html soap_send(soap, (const char*)wsdl); soap_end_send(soap); return SOAP_OK; } 

So, I am setting up this function to execute all the GET commands received by gSoap:

 . . . struct soap soap; soap_init(&soap); soap.fget = http_get; . . . 

Then, when your server receives an HTTP / GET request, your function will be called and send the wsdl file. If you want, you can read the WSDL file at runtime and send to soap_send () instead, to use WSDL in your code, like me.

+1
source

Source: https://habr.com/ru/post/1396921/


All Articles