我使用 WSDL2C 创建了客户端存根 c 代码以访问axis2 Web 服务。我的服务在 http 和 https 地址中都可用。当我编译客户端代码(使用 Visual Studio)以使用 http 端点地址时,它工作正常,但是我想使用 https 地址,我不能调用任何服务操作(我已经为 https 协议启用了 transportSender 和 transportReceiver在客户端的axis2.xml中)。
似乎 WSDL2C 中没有用于生成启用 SSL 的 C 代码的选项,那么我应该怎么做才能通过 https 协议调用服务操作?
我应该传递任何编译器标志或设置任何环境变量来执行此操作吗?
1 回答
0
没有额外的选项来构建 SSL 客户端。您只需像往常一样构建客户端,但要调用 HTTPS 服务而不是 HTTP,您必须设置 HTTPS 端点而不是 HTTP。
例子:
const axis2_char_t* address = NULL;
if (doing_https) {
/* using HTTPS endpoint */
address = "https://localhost:9090/axis2/services/echo";
} else {
/* using HTTP endpoint */
address = "http://localhost:9090/axis2/services/echo";
}
/* Create EPR with given address */
endpoint_ref = axis2_endpoint_ref_create(env, address);
/* Setup options */
options = axis2_options_create(env);
axis2_options_set_to(options, env, endpoint_ref);
/* Create client */
svc_client = axis2_svc_client_create(env, client_home);
/* Set service client options */
axis2_svc_client_set_options(svc_client, env, options);
.....
于 2014-03-13T07:18:13.497 回答