-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lothar Nieswandt wrote:
> Hello all,
> 
> I am trying to write a *simple* web service client with axis2. The server
> side requires http basic authentication. I can't find out how this is done
> *easily* with axis2. Somebody on the list advised to do
> 
> call.setProperty(Call.USERNAME_PROPERTY, "user");
> call.setProperty(Call.PASSWORD_PROPERTY, "pass");
> 
> but this seems to be deprecated. What is the proper way of doing this?
> 
> I took a look at the security example and read something about password
> callbacks but that seemed too complicated.
> 
> Any hints?
> 
> Thanks in advance,
> Lothar
> 

Hi Lothar,

Axis2 does transport level basic authentication as follows.
///// code snipet

OMElement payload = TestingUtils.createDummyOMElement();
        /**
         * Proxy setting in runtime
         */
        HttpTransportProperties.ProxyProperties proxyproperties = new
  HttpTransportProperties().new ProxyProperties();
        proxyproperties.setProxyName("localhost");
        proxyproperties.setProxyPort(5555);
        proxyproperties.setDomain("domain");
        proxyproperties.setPassWord("password");
        proxyproperties.setUserName("userName");

        Options options = new Options();
        options.setProperty(HTTPConstants.PROXY, proxyproperties);
        options.setTo(targetEPR);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        ConfigurationContext configContext =

ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                       null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        OMElement result = sender.sendReceive(payload);

        TestingUtils.campareWithCreatedOMElement(result);

For more information please see the test case,
http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markup

documentation,
http://ws.apache.org/axis2/1_0/http-transport.html

Thank you

Saminda


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEXyYYYmklbLuW6wYRAiZPAJ9ufhjx/tv7GH4SkWjpS8cYm7UVBQCfVLTQ
b93pEsP8BryC1/sE5ZZZHVE=
=UNFg
-----END PGP SIGNATURE-----

Reply via email to