gsoap:如何使其可配置?

发布于 2024-10-06 10:09:36 字数 287 浏览 0 评论 0原文

我已经为我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘦怹 2024-10-13 10:09:36

gSoap 编译器生成的函数如下所示:

soap_call_ns1__foo(struct soap* soap, char *URL, char *action, char *symbol, resultType &Result);

参数 URL 是端点地址。如果传递 NULL,则使用 WSDL 文件中的端点。但是您的客户端可以使用任何其他端点调用此函数 - 例如,它是在您的客户端配置文件中定义的。

如果您的客户端使用由 gSoap 编译器生成的代理类,则还可以设置端点。代理类有一个名为端点的成员,您可以在调用服务方法之前设置该成员。

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.

赢得她心 2024-10-13 10:09:36

在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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文