jax-ws方式创建的webservice, 怎么添加handler验证?
如题,我采用下面这种 handler验证方式,发现这个验证根本就没起作用,客户端还是可以直接调用。
Java webservice security(安全)jax-ws 教程[2]
http://www.fengfly.com/plus/view-210098-1.html
俺的开发环境:MyEclipse 10.
webservice是myEclipse按jax-ws方式自动生成的;
现在IOS客户端,Android客户端,website 都有调用到webservice.
有谁知道怎么弄?
事先声明,我不需要您不经过大脑的粘贴。谢谢!
我现在是真心怕了JEE里那些anotation,那些各种乱七八糟的anotation实现了。弄得JAVA语言已经不是原来的JAVA语言了
[解决办法]
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
...
</globalConfiguration>
<handler name="LocalResponder"
type="java:org.apache.axis.transport.local.LocalResponder" />
<handler name="URLMapper"
type="java:org.apache.axis.handlers.http.URLMapper" />
<handler name="Authenticate"
type="java:org.apache.axis.handlers.SimpleAuthenticationHandler" />
<!-- 头鉴权类定义 -->
<handler name="HeaderCheck"
type="java:com.connectcheck.HeaderCheck" />
<service name="AdminService" provider="java:MSG">
<parameter name="allowedMethods" value="AdminService" />
<parameter name="enableRemoteAdmin" value="false" />
<parameter name="className" value="org.apache.axis.utils.Admin" />
<namespace>http://xml.apache.org/axis/wsdd/</namespace>
</service>
<service name="Version" provider="java:RPC">
<parameter name="allowedMethods" value="getVersion" />
<parameter name="className" value="org.apache.axis.Version" />
</service>
<!-- Services from MyService WSDL service -->
<service name="MyService" provider="java:RPC" style="wrapped"
use="literal">
<!-- 请求流校验 -->
<requestFlow>
<handler type="HeaderCheck" />
</requestFlow>
<!-- 响应流校验,可以不要 -->
<responseFlow>
<handler type="HeaderCheck" />
</responseFlow>
...
<parameter name="typeMappingVersion" value="1.2" />
<!-- 某某功能接口定义 -->
<operation name="someInterface"...
...
import org.apache.axis.handlers.BasicHandler;
import org.apache.axis.Message;
import org.apache.axis.message.SOAPHeader;
public class HeaderCheck
extends BasicHandler
{
public void invoke(MessageContext mc)
throws AxisFault
{
Message msg = mc.getRequestMessage();
SOAPHeader header = (SOAPHeader) msg.getSOAPHeader();
//对Header做校验...
List<?> list = header.getChildren();
}
}