客户端配置:
<!-- 输入流模型处理类 -->
<bean name="domInHandler" class="org.codehaus.xfire.util.dom.DOMInHandler"/>
<!-- 输入流操作处理类 -->
<bean name="wss4jInHandler" class="org.codehaus.xfire.security.wss4j.WSS4JInHandler">
<property name="properties">
<props>
<prop key="action">Signature Encrypt Timestamp</prop><!-- 认证类型 组合操作,空格分隔 Encrypt(解密), Signature(验证签名)-->
<prop key="decryptionPropFile">insecurity_enc.properties</prop><!-- 验证签名使用的密钥库数字证书配置 -->
<prop key="signaturePropFile">insecurity_sign.properties</prop><!-- 解密使用的私钥相关配置 -->
<prop key="passwordCallbackClass">密码回调类</prop><!-- 密码回调实现类 -->
<prop key="enableSignatureConfirmation">false</prop><!-- 如果设置, 与输出(请求)端一致 -->
</props>
</property>
</bean>
<!-- 输出流模型处理类 -->
<bean id="domOutHandler" class="org.codehaus.xfire.util.dom.DOMOutHandler"/>
<!-- 加密方式处理类 -->
<bean id="wss4jOutHandler" class="org.codehaus.xfire.security.wss4j.WSS4JOutHandler">
<property name="properties">
<props>
<prop key="action">Signature Encrypt Timestamp</prop>
<!-- 请求加密用户名 -->
<prop key="encryptionUser">test</prop><!-- 输入(响应)端, 用此用户名对应的密码, 解密 -->
<prop key="encryptionPropFile">outsecurity_enc.properties</prop><!-- 签名 -->
<prop key="signaturePropFile">outsecurity_sign.properties</prop><!-- 加密 -->
<prop key="user">agent</prop><!-- 用此用户名对应的密码,加密 -->
<prop key="passwordCallbackClass">密码回调类</prop>
</props>
</property>
</bean>
<!-- WebService 服务端配置 -->
<bean id="client" class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
<property name="serviceClass">
<value>org.lei.Interface</value><!-- 服务接口 -->
</property>
<property name="wsdlDocumentUrl"><value>http://xx.xxx.xx.xx/services/xxx?wsdl</value><!-- WebService 服务地址 -->
</property>
<!-- 对输入流的操作 -->
<property name="inHandlers">
<list>
<ref bean="domInHandler"/><!-- 负责将STAX流模型的SOAP转换为DOM模型类 -->
<ref bean="wss4jInHandler"/><!-- 对用户名和密码进行检查 -->
</list>
</property>
<!-- 对输入流的操作 -->
<property name="outHandlers">
<list>
<ref bean="domOutHandler"/>
<ref bean="wss4jOutHandler"/>
</list>
</property>
</bean>
客户端的操作其实和服务端的操作基本一致, 也是要对输入和输出流分别按要求进行操作. 如设置认证类型及其顺序, 密码回调类的作用, 加密、签名属性文件的设置。
outsecurity_enc.properties……的属性文件与服务端使用的属性文件格式一致。
密码回调类:用法与服务端一致。
配置完成后, 便可使用 Spring 上下文内容对象 getBean(ID)的方法获取对象, 请求服务。
在使用过程中, 会遇到各种各样的异常情况. 这里就不详细说明了, 基本都是配置出错或缺少 Jar 包的问题导致。
-------
需要用的 Jar:
stax-api-1.0.1, jaxen-1.1-beta-9, jaxb-api-2.0, jaxb-impl-2.0.1, jaxb-xjc-2.0.1, wsdl4j-1.6.1, xfire-all-1.2.6, XmlSchema-1.4.2, wss4j-1.5.1, commons-lang-2.3, xmlsec-1.3.0, wstx-asl-3.9.2, xfire-jsr181-api-1.0-M1
分享到:
相关推荐
eclipse下spring+xfire实现ws-...数字签名和报文加密的安全认证,唯一不足的是没有实现数字签名和报文加密的混合模式(可能是密匙文件的问题,正在努力中),如果有疑问或更好的建议,请联系我,邮箱: windjie8@163.com
XFire中实现WS-SecurityXFire中实现WS-SecurityXFire中实现WS-Security
xfire+spring+安全认证,包含服务端和客户端,xfire jar包可以从我的资源下面下或网上很多。
xfire+spring+webservice+client xfire+spring+webservice+client xfire+spring+webservice+client
xfire+spring开发webservice 很不错的文档
基于XFire实施WS-Security,学习web service的材料
1 支持一系列Web Service的新标准--JSR181、WSDL2.0 、JAXB2、WS-Security等; 2 使用Stax解释XML,性能有了质的提高。XFire采用Woodstox 作Stax实现; 3 容易上手,可以方便快速地从pojo发布服务; 4 支持...
NULL 博文链接:https://zhaoshijie.iteye.com/blog/839050
xfire1.2.6 ws-security示例,也就是让里面的例子跑起来,网上都没这个教程,所以我就花了点点时间做了一下
xfire+spring+webservice xfire+spring+webservice xfire+spring+webservice xfire+spring+webservice
xfire-spring-1.2.6-sources.jarxfire-spring-1.2.6-sources.jar
使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service
XFire中实现WS-Security完整编 Spring+xFire+wss4j配置Helloworld实例 完整说明文档 Myeclipse项目 服务端工程 客户端工程
webservice教程(xfire+spring)webservice教程(xfire+spring)webservice教程(xfire+spring)webservice教程(xfire+spring)
使用XFire+Spring构建Web Service步骤以及源代码.rar
xfire+spring webservice
xfire+Spring整合发布webservice,详细解释配置过程,及是替代码,帮助一部分需要这方面开发的人员。
使用XFire+Spring使用XFire+Spring构建Web Service(二).doc构建使用XFire+Spring构建Web Service(二).docWeb Service(二).doc
xfire 实施ws-security代码,多线程发送邮件工具类代码
spring+xfire( 编写webservice完整配置+案例)