axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dies Koper <d...@jp.fujitsu.com>
Subject Re: How to do basic http authentication with axis 1.3 client?
Date Fri, 12 May 2006 00:22:50 GMT
Hello James, Joshua,

Just in case, I'll quote the example from the JAX-RPC 1.1 spec that 
explains the way to do this.

StockQuoteProvider_Stub sqp = // ... get to the stub;
sqp._setProperty(Stub.USERNAME_PROPERTY, "<username>");
sqp._setProperty(Stub.PASSWORD_PROPERTY, "<password>");
float quote = sqp.getLastTradePrice("ACME");

This will make your client also work with any other (JAX-RPC1.1 
compatible) SOAP engine.

Regards,
Dies


James Gough wrote:
> 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:password@localhost:7001/webservice/MyService?WSDL");
> 
> Jim
> 
> 
> Joshua.White@hartfordlife.com 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?
>>
>>
>>
>>
>>
>>
>>     *Joshua.White@hartfordlife.com*
>>
>> 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.
>> *************************************************************************
> 
> 
> 

-- 
Dies KOPER <dies@jp.fujitsu.com>
Fujitsu Ltd - Middleware Platform Div. (MWPF1)
Tech Bldg., Shin-Yokohama, Japan
Tel. +81(45)-473-9392  (internal 7124-3023)


Mime
View raw message