gsoap:如何使其可配置?
我已经为我的 Web 服务实现了客户端。为每个 Web 方法自动生成的文件包含与 Web 服务端点的硬编码绑定:
soap_endpoint = "http://localhost/MyService.asmx";
这对于开发目的来说很好,但在将其推送到 PROD 之前,我需要将这些字符串替换为 PROD Web 服务地址。
是否可以管理 gSOAP 以生成要放入某些“外部”变量中的字符串?
或者我应该每次在部署之前替换这些端点值?
谢谢。
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, but 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gSoap 编译器生成的函数如下所示:
参数 URL 是端点地址。如果传递 NULL,则使用 WSDL 文件中的端点。但是您的客户端可以使用任何其他端点调用此函数 - 例如,它是在您的客户端配置文件中定义的。
如果您的客户端使用由 gSoap 编译器生成的代理类,则还可以设置端点。代理类有一个名为端点的成员,您可以在调用服务方法之前设置该成员。
The functions generated from the gSoap Compiler are looking like:
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.
在gSoap编译器生成的***proxy.h头文件中你会发现
“endpoint =”http://localhost/MyService”在类构造函数中。
将“localhost”替换为 Web 服务的“IP 地址”,然后再将其推送到 PROD。
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.