이클립스
HTTP 를 이용한 웹서비스 클라이언트 프로그램 작성 및 설정
JAX-WS  API 활용 문서

JAX-WS 를 이용한 HTTP-Basic 기본인증
 참조:https://jax-ws.dev.java.net/faq/index.html#auth

Q. How do I do basic authentication in JAX-WS ?

You can do the following:
HelloService service = new HelloService();
Hello proxy = (service.getHelloPort());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "userfoo");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "passbar");

USERNAME_PROPERTY, PASSWORD_PROPERTY are used primarily for service requests. I think when you instantiate Service, it fetches WSDL and the server is returning 401. You could try any one of the following solutions.

  • 1. Use java.net.Authenticator class in your client application.
  • 2. Provide a local access to the WSDL using catalog. There is a catalog sample in the jax-ws distribution.
  • 3. Configure web.xml to allow GET requests without authentication

JEUS6 에서 JAX-WS 를 사용하는 기본인증을 지원하는 클라이언트
 -온라인 메뉴얼

사용자 삽입 이미지