Hi,

I have a client application that connects to a web service through https
using axis2c 1.6.0. If I try to connect through a proxy that requires
authentication, I can¹t connect to the service. If I use a proxy that
doesn¹t require authentication, it works. I used
axis2_svc_client_set_proxy_with_auth to set the proxy.

I set up a squid proxy server and used basic authentication through a custom
written authenticator so I could print what the input was, but nothing gets
printed. I tested the proxy using both Safari and Firefox and everything
works correctly. I also tried to connect to the service via the proxy ( with
authentication ) using the curl command line tool and that also worked
correctly.

I generated client code from the service wsdl file using WSDL2C.

This is the code I use to connect to the service:

...

axutil_error* theError = NULL;
axutil_env_t* theEnvironment = NULL;
axis2_stub_t* theStub = NULL;
axis2_status_t theSetProxyStatus = AXIS2_SUCCESS;

theError = axutil_error_create( axutil_allocator_init( NULL ) );
theEnvironment = axutil_env_create_with_error( axutil_allocator_init( NULL
), theError );

if ( theEnvironment )
{
        theStub = axis2_stub_create_MyService( theEnvironment,
                                           inAxis2cFolder.c_str(),
                                           inMyServiceAddress.c_str() );

    if ( theStub  )
    {
        if ( ! inHost.empty() )
        {
            std::ostringstream thePortStringStream;
            thePortStringStream << inPortNumber;

            theSetProxyStatus = axis2_svc_client_set_proxy_with_auth(
axis2_stub_get_svc_client( theStub, theEnvironment ),
                   
theEnvironment,
                   
const_cast<char*>( inHost.c_str() ),
                   
const_cast<char*>( thePortStringStream.str().c_str() ),
                                                                      (
inUserName.empty() ? NULL : const_cast<char*>( inUserName.c_str() ) ),
                                                                      (
inPassword.empty() ? NULL : const_cast<char*>( inPassword.c_str() ) ) );

        }

        if ( AXIS2_SUCCESS == theSetProxyStatus )
        {
            adb_MyServiceCall_t* theDoServiceCallRequest =
adb_MyServiceCall_create( theEnvironment );

            if ( theMyServiceCallRequest )
            {
                axis2_status_t theSetRequestXMLStatus =
adb_MyServiceCall_set_RequestXML( theMyServiceCallRequest,
                   
theEnvironment,
                   
inRequestString.c_str() );

                if ( AXIS2_SUCCESS == theSetRequestXMLStatus )
                {
                    adb_MyServiceCallResponse_t* theMyServiceCallResponse =
                   
axis2_stub_op_MyService_MyServiceCall( theStub,
                   
theEnvironment,
                   
theMyServiceCallRequest );
                    if ( theMyServiceCallResponse  )
                    {
                        axis2_char_t* theMyServiceCallResultValue =
                   
adb_MyServiceCallResponse_get_MyServiceCallResult( theMyServiceCallResponse,
                   
theEnvironment );

                            if ( theMyServiceCallResultValue )
                            {
                                outResponseString.assign(
theMyServiceCallResultValue );
                   
...

If I build axis2c with curl, then connecting through a proxy doesn¹t work at
all, even without authentication.

Is my code wrong or is this a bug in the axis2c library?

Kr
Halewijn

Reply via email to