You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Xinjun Chen <xj...@gmail.com> on 2006/06/08 09:54:02 UTC

Re: [Axis2] Http Basic Authentication

Hi Saminda,

I am trying to set proxy for an Axis2 client. The code snippet is as
follows:

   HttpTransportProperties htp = new HttpTransportProperties();
   httpProxyProperties = htp.new ProxyProperties();
   httpProxyProperties.setProxyName(httpProxyHost);
   httpProxyProperties.setProxyPort(Integer.parseInt(httpProxyPort));
   httpProxyProperties.setUserName(httpProxyUsername);
   httpProxyProperties.setPassWord(httpProxyPassword);
   httpProxyProperties.setDomain(httpProxyDomain);

   MessageContext mc = new MessageContext();
   mc.setServiceContext(serviceContext);
   mc.setEnvelope(request);
   mc.setTo(toEPR);
   mc.setSoapAction(soapAction);

   OperationClient mepClient = outOnlyOperation.createClient(
     serviceContext, options);
   mepClient.addMessageContext(mc);

   // TODO: Add the call back handler
   mepClient.execute(true);
Where the httpProxyUsername, httpProxyPassword, and httpProxyDomain are
"anonymous".

When i ran the client, I get the following exception.

*

java.rmi.RemoteException*: EJB Exception:; nested exception is:

*java.rmi.RemoteException*: Axis2 transport error : Not Implemented; nested
exception is:

org.apache.axis2.AxisFault: Axis2 *transport* error : Not Implemented;
nested exception is:

org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested
exception is:

Caused by: *java.rmi.RemoteException*: Axis2 transport error : Not
Implemented; nested exception is:

org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested
exception is:

org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested
exception is:
I have tried to find other log messages but there is no other error message.

Could you give me some idea why this error happens and what I have missed
out?

Regards,
Xinjun

On 5/8/06, Saminda Abeyruwan <sa...@opensource.lk> wrote:
>
> -----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-----
>