WebLogic 上WebServices 总是提示 401 Unauthorized 异常的一种情况!
来源:互联网 发布:淘宝图片专业拍摄 编辑:程序博客网 时间:2024/04/30 01:38
异常信息:
AxisFaultfaultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (401)Unauthorized
faultActor:
faultNode:
faultDetail:
{}:return code: 401
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 401--Unauthorized</TITLE>
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 401--Unauthorized</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.2 401 Unauthorized</H4>
</FONT><P><FONT FACE="Courier New">The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.</FONT></P>
</FONT></TD></TR>
</TABLE>
</BODY>
</HTML>
{http://xml.apache.org/axis/}HttpErrorCode:401
(401)Unauthorized
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at cn.test.WSClient.callLocalhost(WSClient.java:43)
at cn.test.WSClient.main(WSClient.java:18)
操作步骤:
1、检查WebLogic控制台标记,搜索 Security ,检查当前WLS的Realm名字 例如:myrealm;
<20XX-12-5 下午03时14分25秒 CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
2、以上异常提示表示WebServices请求身份认证没有通过,不允许访问服务器资源,此时调用方式必须设置访问账号、以及密码,服务器将拒绝请求;
String endpoint = "http://localhost:7001/MyServicesWeb/services/SayHello";
Service service = new Service();
Call call = (Call) service.createCall();
//设置Security Realm方式一
// //远程调用用户名设置(HTTP统一认证账号)
// call.setUsername("weblogic");//wstest/hb_hsxf
// //远程调用密码设置,黄石公众诉求(HTTP统一认证密码)
// call.setPassword("passw0rd");
//设置Security Realm方式二
call.setProperty(org.apache.axis.client.Call.USERNAME_PROPERTY, "weblogic"); //账号
call.setProperty(org.apache.axis.client.Call.PASSWORD_PROPERTY,"passw0rd1");//密码
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//设置远程调用方法路径及方法名称
call.setOperationName(new QName("urn:SayHello", "getHello"));
//传入xml文档字符串,返回数据校验错误字符串
//String d = (String) call.invoke(new Object[] {Document.asXML()});
String d = (String) call.invoke(new Object[]{"本地调用"});
System.out.println("Debug-Info: WSClient.callLocalhost Response $d>> "+d);
- WebLogic 上WebServices 总是提示 401 Unauthorized 异常的一种情况!
- InvocationTargetException异常的一种情况
- weblogic 访问返回401-Unauthorized
- 关于weblogic平台和axis上开发webservices的比较
- iis不提示错误信息的一种情况
- 产生异常ORA-12516的一种情况
- VS2010总是提示“此项目已过期”的一种原因
- 上不了网的一种情况
- 引发堆栈异常的一种情况:无界递归
- 引发堆栈异常的一种情况:无界递归 (续)
- 导致java.lang.NullPointerException异常的一种情况
- android.view.WindowManager$BadTokenException这个异常的一种情况
- 数据库获取值抛空指针异常的一种情况
- 解决org.springframework.beans.factory.BeanCreationException 异常的一种情况
- 为什么总是最坏的情况
- weblogic部署的一种方式
- 人总是要死的,死在自己选择的道路上,这或许就是一种幸福。
- adb devices连接提示 Android offline或unauthorized的解决办法
- poj 2184 Cow Exhibition
- 深入浅出比特币:比特币系统是如何运行的?
- Android.mk添加第三方jar包
- Linux下后台运行程序
- 黑马程序员面试题 JavaScript数字和字符串转换小结(转)
- WebLogic 上WebServices 总是提示 401 Unauthorized 异常的一种情况!
- VTK6.0.0编译 vs2010 win7 32位系统
- linux ftrace原理
- Java内存分配与管理
- nginx ubuntu安装(1)
- 【初学】iOS学习笔记-图片旋转
- 24.3 性能分析
- C#导出泛型IList到Excel
- Quartz学习笔记(一)转自 xiaoyuqi00