10.10.3 JAX-WS機能固有のプロパティを利用しない場合
JAX-WS機能固有のプロパティは簡易的なプロパティです。そのため,細かな制御をしたい場合,WebサービスクライアントでJ2SE 6.0標準のjava.net.Authenticatorクラスを利用した実装をすることをお勧めします。詳細についてはJ2SE 6のドキュメントを参照してください。java.net.Authenticatorクラスを利用した実装例を次に示します。
java.net.Authenticator.setDefault( new java.net.Authenticator(){ // getPasswordAuthenticationメソッドをオーバーライドする public java.net.PasswordAuthentication getPasswordAuthentication() { // ユーザ名を設定する String userName = ... // パスワードを設定する char[] password = ... // PasswordAuthenticationを生成する。 java.net.PasswordAuthentication auth = new java.net.PasswordAuthentication( userName, password ); return auth; } } );