I am new to this, so by all means this may not be the way to do it, but perhaps you can try:

URL serviceUrl = new URL("http://username:[EMAIL PROTECTED]:7001/webservice/MyService?WSDL");

Jim


[EMAIL PROTECTED] wrote:

I tried the following and I still get a 401 error:

MyService myService = new MyServiceLocator(); URL serviceUrl = new URL("http://localhost:7001/webservice/MyService?WSDL";); MyServicePortType mspt = myService.getMyServicePortTypeSoapPort(serviceUrl);
       * Stub stub = (Stub)mspt;*
*        stub.setUsername("someusername");*
*        stub.setPassword("somepassword");*
result = mspt.getSomeResult(79744);

Is there something else I need to do?






        [EMAIL PROTECTED]

05/11/2006 02:08 PM
Please respond to axis-user

To: axis-user@ws.apache.org cc: Subject: How to do basic http authentication with axis 1.3 client?





I generated my stubs using the axis-wsdl2java ant task specifying a username/password. When the service was unsecured, I used to be able to call it like this:

MyService myService = new MyServiceLocator(); URL serviceUrl = new URL("http://localhost:7001/webservice/MyService?WSDL";); MyServicePortType mspt = myService.getMyServicePortTypeSoapPort(serviceUrl);

       result = mspt.getSomeResult(79744);

Now that the service has been secured using basic authentication (username/password), how do I specify my username/password when connecting to the service?

Regards,

Joshua

*************************************************************************
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information. If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited. If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************

Reply via email to