这个属于J2EE 的基础知识吧。
在你发布Web Service的 web.xml 种的最后结束标签前加入下面一段即可
<security-constraint>
<web-resource-collection>
<web-resource-name>Web service </web-resource-name>
<url-pattern>/services/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint><login-config>
<auth-method>BASIC</auth-method>
<realm-name>Axis Basic Authentication Area</realm-name>
</login-config>
<security-role>
<role-name>tomcat</role-name>
</security-role>其中角色名tomcat是在/conf/tomcat-user.xml中定义的,你可以去那里更改成你想要的名字和角色名
设好后先验证一下:
重启tomcat然后再从浏览器进入查看wsdl时,它会弹出常见的要求认证的对话框。
tomcat的角色控制本质上是HTTP协议中定义的Basic Authentication,由于是标准的认证协议,
因此Delphi端的相关控件估计应该也支持,估计在HTTPRIO之类的控件里有这样的属性(用户名和密码)
在你发布Web Service的 web.xml 种的最后结束标签前加入下面一段即可
<security-constraint>
<web-resource-collection>
<web-resource-name>Web service </web-resource-name>
<url-pattern>/services/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint><login-config>
<auth-method>BASIC</auth-method>
<realm-name>Axis Basic Authentication Area</realm-name>
</login-config>
<security-role>
<role-name>tomcat</role-name>
</security-role>其中角色名tomcat是在/conf/tomcat-user.xml中定义的,你可以去那里更改成你想要的名字和角色名
设好后先验证一下:
重启tomcat然后再从浏览器进入查看wsdl时,它会弹出常见的要求认证的对话框。
tomcat的角色控制本质上是HTTP协议中定义的Basic Authentication,由于是标准的认证协议,
因此Delphi端的相关控件估计应该也支持,估计在HTTPRIO之类的控件里有这样的属性(用户名和密码)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货