Java tutorial
//package com.java2s; import java.util.Map; import javax.xml.ws.BindingProvider; public class Main { public static void setBasicHttpAuth(Object wsProxy, String username, String password) { javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) wsProxy /*port*/; Map<String, Object> context = bp.getRequestContext(); context.put(BindingProvider.USERNAME_PROPERTY, username); context.put(BindingProvider.PASSWORD_PROPERTY, password); } }