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 "Jonathan J. Vargas R." <jo...@gmail.com> on 2005/08/08 20:16:39 UTC

Webservice over Basic Authentication

Hi,

I am having difficulties to access an axis webservices using an axis
client through basic authentication. the server returns no
authentication supplied message, as i should do since i am not giving
auth info yet.

I see MessageContext allows to indicate password and username, would
be this the point? The fact is that i can't find where to place
authentication info in the stubs generated by wsdl2axis.

Any example online? hint ? so i could supply an username and password
for the server?


-- 
Jonathan J. Vargas Rodriguez
jonathan.j.vargas@gmail.com
"Conservar el silencio interior cuando vuelo en la tormenta me es
mejor, porque asi ya no soy otra gota de la tempestad"

Re: Webservice over Basic Authentication

Posted by James Wilson <wi...@ociweb.com>.
Quoting "Jonathan J. Vargas R." <jo...@gmail.com>:

> Hi,
>
> I did this:
>
> public class Main {
>     public static void main (String[] args) {
> 	try {
> 	    EchoImpServiceLocator sl = new EchoImpServiceLocator ();
> 	    EchoImp service = sl.getEcho ();
>
> ->	    ((org.apache.axis.client.Stub) service).setUsername ("anyuser");
> ->	    ((org.apache.axis.client.Stub) service).setPassword ("anypassword");
>
> 	    System.out.println (service.echo ("Hola amigo!"));
> 	} catch (Exception e) {
> 	    System.err.println ("Error: " + e.getMessage ());
> 	}
>     }
> }
>
>
> It works, just hope it's safe to do this, and it is compliant with ur
> customs? otherwise how would u do it from here, the class Main? :)
One other way to inject client authentication into an HTTP connection is to
imbed it at the beginning of the URL.  This is a standard outside of Axis. 
Following your variables used above, the command would be something like this:
  sl.setEchoImpEndpointAddress("
      http://sdsuser:password@localhost:8080/axis/services/EchoImp");
  EchoImp service = sl.getEcho();
  service.echo ("Hola amigo!")
>
> thanks man.
>
>
> On 8/8/05, Kr <ba...@gmail.com> wrote:
> > < proxy object>.setUsername("dfdafasdf");
> > < proxy object>.setPassword("dfdfdfdf");
> >
>
>
> --
> Jonathan J. Vargas Rodriguez
> jonathan.j.vargas@gmail.com
> "Conservar el silencio interior cuando vuelo en la tormenta me es
> mejor, porque asi ya no soy otra gota de la tempestad"
>

Re: Webservice over Basic Authentication

Posted by "Jonathan J. Vargas R." <jo...@gmail.com>.
Hi,

I did this:

public class Main {    
    public static void main (String[] args) {
	try {
	    EchoImpServiceLocator sl = new EchoImpServiceLocator ();
	    EchoImp service = sl.getEcho ();

->	    ((org.apache.axis.client.Stub) service).setUsername ("anyuser");
->	    ((org.apache.axis.client.Stub) service).setPassword ("anypassword");
	    
	    System.out.println (service.echo ("Hola amigo!"));
	} catch (Exception e) {
	    System.err.println ("Error: " + e.getMessage ());
	}
    }
}


It works, just hope it's safe to do this, and it is compliant with ur
customs? otherwise how would u do it from here, the class Main? :)

thanks man.


On 8/8/05, Kr <ba...@gmail.com> wrote:
> < proxy object>.setUsername("dfdafasdf");
> < proxy object>.setPassword("dfdfdfdf");
> 


-- 
Jonathan J. Vargas Rodriguez
jonathan.j.vargas@gmail.com
"Conservar el silencio interior cuando vuelo en la tormenta me es
mejor, porque asi ya no soy otra gota de la tempestad"

Re: Webservice over Basic Authentication

Posted by Kr <ba...@gmail.com>.
< proxy object>.setUsername("dfdafasdf");
< proxy object>.setPassword("dfdfdfdf");