Now, I developed a gSOAP stand-alone server on 8080 port and it's working for SOAP RPC.
But I want to return wsdl content of a wsdl file in my file system when clients request for getting wsdl on the 8080 port.
what I can do to return wsdl to clients?
I used xd tool to generate a embbed version of my wsdl and store it a wsdl.h file with this command line (I`m doing 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, that can be better to lead with parameters in 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 configure this function to lead with all GET commands received by gSoap:
.
.
.
struct soap soap;
soap_init(&soap);
soap.fget = http_get;
.
.
.
Then, when your server receive a HTTP/GET request, your function will be called and send the wsdl file. If you want, you can read WSDL file at runtime and send in soap_send() instead to embbed WSDL in your code like I did.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.