gsoap: how to make it configurable?
I've implemented client for my Web Service. Auto-generated files for each web method contain hardcoded bindings to web service end point:
soap_endpoint = "http://localhost/MyService.asmx";
It is fine for development purposes, b开发者_如何学Pythonut before pushing that to PROD I will need to replace those string with PROD web service address.
Is it possible to manage gSOAP in order it generated this string to be putted in some 'external' variable?
Or I should replace those end-point value each time before deployment?
Thanks.
The functions generated from the gSoap Compiler are looking like:
soap_call_ns1__foo(struct soap* soap, char *URL, char *action, char *symbol, resultType &Result);
The argument URL is the endpoint adress. If you pass NULL, the endpoint from the WSDL file is used. But your client can call this function with any other endpoint -- which for example is defined within your clients configuration file.
If your client is using the -- from the gSoap compiler generated -- proxy class, it is also possible to set the endpoint. The proxy class has a member called endpoint which you can set before calling the service methods.
In the gSoap compiler generated ***proxy.h header file you will find
"endpoint = "http://localhost/MyService" in the class constructor.
Replace "localhost" with the "IP-address" of your web-service before pushing it to PROD.
精彩评论