Ana içeriğe atla

web service basic Authorization (authentication)

We have a web service which has a basic auth. policy on it. I can call it with soap but while invoking java client which generated with weblogic ant tools, I can not achieve to call it with success. it gave me 401 http code all the time. then I made a call with soap and realized that it is sending Authorization http header while invoking. then made I small change with my code like
BindingProvider bp = (BindingProvider) oloPortalTHKEndPoint;
Map context = bp.getRequestContext();
Map> headers = new HashMap>();
headers.put("Authorization",  Collections.singletonList("Basic " + new String(Base64.encode(newString("username"+":"+"password").getBytes()))));
and Bob's your uncle here the detailed information about basic auth. http://en.wikipedia.org/wiki/Basic_access_authentication

Yorumlar