Hi Suzy,

This is possible and shouldn't require any code change to your client if you 
are already using Basic auth.

I have modified the StockQuote sample to use Basic authentication and SSL and 
included the sample code at the end. You can ignore the SSL stuff if you aren't 
using that.

You also need to set up your web.xml to secure the web service with Basic 
authentication. You then need to configure your app server to use a database 
realm.

I'm not sure what app server you are using so may not be able to help. I got 
this running using JBoss 3.2.5 so I can help you more if that's what you are 
using.

Hope this helps,

Patrick

package com.ibm.w3.services.stockquote;

public class StockQuoteClient
{
        public static void main(String args[]) {
                try 
                { 
                        //set the certificate store
                        //just comment this out if you don't want to use SSL
                        System.setProperty("javax.net.ssl.trustStore", 
                                                   
"C:\\jboss-3.2.5\\server\\default\\conf\\ws-castor-test.keystore" );
        
                        
                        StockQuoteService service = new 
StockQuoteServiceLocator();
                        
                        String endpoint = 
"https://localhost:8443/axis/services/StockQuoteSOAPPort";;
                        StockQuotePortType port = 
service.getStockQuoteSOAPPort( new java.net.URL( endpoint ) );
                        
                        org.apache.axis.client.Stub stub = ( 
org.apache.axis.client.Stub )port;
                        
                        //get the underlying Stub so that we can authorise
                        stub.setUsername( "test" );
                        
                        stub.setPassword( "test" );

                Quote quote = port.getStockQuote("IBM");

                        System.out.println( "Quote: " + quote);
                        
                System.out.println( "Volume" + quote.getVolume());
                        
                } 
                catch (Exception e) 
                {
                        System.out.println("Exception caught " + e);
                        e.printStackTrace();
                }
        }
}




-----Original Message-----
From: Suzy Fynes [mailto:[EMAIL PROTECTED]
Sent: Wed 23/02/2005 12:40
To: [email protected]
Subject: basic authenication
 
 
Hey,
 
I'm looking to use basic authentication with axis through a mysql
database as opposed to the user.lst and perm.lst, can anyone give me
some pointers on doing this and does using a database change the client
code? With a java client the username and password comes in as
parameters of the main method.
 
Thanks
Suzy

<<winmail.dat>>

Reply via email to