Question

I'v created client stub c code using WSDL2C for accessing an axis2 web service. My service is available in both http & https addresses. When I compile client code (with visual studio) to use http endpoint address, it works fine, but then I want to use https address, I can't call none of service operations (I've already enabled transportSender & transportReceiver for https protocol in axis2.xml at client side).
Seems there is no option in WSDL2C for generating SSL-enabled C code, so what should I do to call service operations via https protocol ?
Should I pass any compiler flag or set any environment variable to do this?

Was it helpful?

Solution

There is no additional option to build SSL client. You just have to build client as usual but to invoke HTTPS service instead of HTTP you must set HTTPS endpoint instead of HTTP.

Example:

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);

.....
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top