Xfire在客户端验证WSS签名后的Web Service出错问题的解决

OpenDRIVE车道计算避坑指南:为什么你的poly3曲线总对不齐? 本文深入解析OpenDRIVE标准中车道几何计算的三大核心难题:参数化三次多项式(ParamPoly3)的坐标系转换与参数映射、车道偏移与宽度的优先级判定,以及螺旋线(Spiral)接续的平滑性保障。通过实战案例与代码示例,提供了一套避免车道线错位与曲率不连续的精确计算与验证方法,是高精地图开发与仿真场景构建的实用避坑指南。 阅读详情
在我们AEP开放API接口(Axis2+WSS4J)的时候,考虑了很多和其他平台的互通问题,比如和.Net、PHP的,结果后院差点起火,Java客户端用Xfire验证签名时居然出错,但只是一个提示出错信息,并不影响正常的签名验证和接口返回值,所以前面的工程师就没有当一回事;
客户端InHandler部分代码:
client.addInHandler( new  DOMInHandler());
Properties properties1 
=   new  Properties();
properties1.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
properties1.setProperty(WSHandlerConstants.SIG_PROP_FILE, 
" client.properties " );
properties1.setProperty(WSHandlerConstants.USER, 
" alisoft " );
    client.addInHandler(new WSS4JInHandler(properties1));


调用产生异常为:org.apache.ws.security.WSSecurityException: WSHandler: Check Signature confirmation: stored SV vector not empty
问题解决过程:
1、跟踪代码发现该异常的原因是:客户端默认开启了enableSignatureConfirmation标识,这样客户端就需要验证ws返回的xml里面的wsse:SignatureConfirmation信息,而服务端却在axis2.xml中设置了<parameter name="enableSignatureConfirmation">false</parameter>,服务端若设置为true,则要求请求的接收方确认响应中包括了来自请求的所有签名,否则验证不通过;所以不会在返回的xml中有wsse:SignatureConfirmation信息,故而出错!
2、添加设置properties1.setProperty(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "false");后再测,刚才的异常是没有了,但是却出现了新的异常,而且已经不能正常返回接口值了!
异常为:org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: WSS4JInHandler: security processing failed (actions mismatch)
导致上面的原因是在WSS4J里面,客户端在验证服务端返回的xml有效性的时候要求:验证的顺序一定要和服务端设置一致;比如我们服务端对返回xml设置了Timestamp和Signature,那么客户端设置的InHandler中对应的action也必须是Timestamp和Signature,并且顺序要一致,否则就会验证不通过(这个在wss4j的mail list中有很多人认为这是一个bug,这个要求太强制了,wss4j也承诺后续将这个实现也改掉);
3、修改设置properties1.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.SIGNATURE);之后问题解决;

在查上面这个问题的时候,顺便还check了下关于signatureKeyIdentifier的问题,因为前面的工程师有段注释:

properties.setProperty(WSHandlerConstants.SIG_KEY_ID,  " IssuerSerial " ); // "DirectReference","IssuerSerial"绝对不可以使用"SKIKeyIdentifier"


总结起来,signatureKeyIdentifier的取值范围可以为:IssuerSerial, Thumbprint, SKIKeyIdentifier, X509KeyIdentifier, DirectReference;其中X509KeyIdentifier, DirectReference两者是将证书信息直接暴露在请求的soap xml中;而其他三者只保存对证书的标识性信息,接收端可以根据这些信息到证书库中取出具体的证书来进行相应的操作;各种情况在soap xml中的具体标识见备注,至于选择哪种参数这个要看自己的需求了,是否需要将证书暴露这是一个可参考原则;
经测试,各种signatureKeyIdentifier取值在java环境下基于wss的web service调用均不存在任何问题,只是对应soap请求xml有所区别而已;在对其他平台是否有影响我还不确认,可能会有问题,因为我的同事在调试WSE3.0时提到过这个问题,具体可以参见这篇文章《Web Service 、WS-Security、Java和.net的互通(在路上-基于SCA规范的应用服务框架成长记之四)》,后续我会再确认一把;
另外,该标识只需要请求发起方设置即可,接收方并不需要和发起方做相同配置(这点和验证action操作不同);

备注:
signatureKeyIdentifier = IssuerSerial时soap xml为:

< wsse:SecurityTokenReference  wsu:Id ="STRId-16359413"
                        xmlns:wsse
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                        xmlns:wsu
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
                        
< ds:X509Data
                            
xmlns:ds ="http://www.w3.org/2000/09/xmldsig#" >
                            
< ds:X509IssuerSerial
                                
xmlns:ds ="http://www.w3.org/2000/09/xmldsig#" >
                                
< ds:X509IssuerName
                                    
xmlns:ds ="http://www.w3.org/2000/09/xmldsig#" >
                                    CN=91
                                
</ ds:X509IssuerName >

                                
< ds:X509SerialNumber
                                    
xmlns:ds ="http://www.w3.org/2000/09/xmldsig#" >
                                    1204512340
                                
</ ds:X509SerialNumber >
                            
</ ds:X509IssuerSerial >
                        
</ ds:X509Data >
                    
</ wsse:SecurityTokenReference >

signatureKeyIdentifier = Thumbprint时soap xml为:
< wsse:SecurityTokenReference  wsu:Id ="STRId-16359413"
                        xmlns:wsse
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                        xmlns:wsu
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
                        
< wsse:KeyIdentifier
                            
EncodingType ="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
                            ValueType
="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1" >
                            RsCeOP3DA3MfR51+G8+hpvkLrRU=
                        
</ wsse:KeyIdentifier >
                    
</ wsse:SecurityTokenReference >

signatureKeyIdentifier = SKIKeyIdentifier时soap xml为:
< wsse:SecurityTokenReference  wsu:Id ="STRId-16359413"
                        xmlns:wsse
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                        xmlns:wsu
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
                        
< wsse:KeyIdentifier
                            
EncodingType ="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
                            ValueType
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier" >
                            7oaMmmGLcq4rfBmkp7Vq07KsT8g=
                        
</ wsse:KeyIdentifier >
                    
</ wsse:SecurityTokenReference >

signatureKeyIdentifier = X509KeyIdentifier时soap xml为:
< wsse:SecurityTokenReference  wsu:Id ="STRId-16359413"
                        xmlns:wsse
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                        xmlns:wsu
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
                        
< wsse:KeyIdentifier
                            
EncodingType ="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
                            ValueType
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" >
                            MIIBjTCB9wIER8tmVDANBgkqhkiG9w0BAQQFADANMQswCQYDVQQDEwI5MTAgFw0wODAzMDMwMjQ1NDBaGA8yMTA4MDIwODAyNDU0MFowDTELMAkGA1UEAxMCOTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAI0humTmiooUa1uVW4u3JqRal2XKp9pIezQVdAw3ePUbqMr8R0mb25xUsQY4skZlG9+lo+SrKneIS+ZXgicDQZcrcq3tDvvFJ6ww/o9gaH4faaqrw6VuXwAECUbZEI9qNo15I1KufVKtugEIXQdf0bwcT/y+a4jSbC2n2Mdwa/8NAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAS6bExnc/UO83dtHooaOn0c8ny2GbJTe2GR10aJ1A3Yq3cqdXZmFTchm4iwYW6MKUwJmQDrMf88XA0RKbFLbVwV9PiFvRTB/AaJQMO2NJ+2iuC8vtGf3Bpihwc4XoBTFu67CQhZeoHNa2+c/FaW/ojDdDd/dcuAWu5jlVqfUezBA=
                        
</ wsse:KeyIdentifier >
                    
</ wsse:SecurityTokenReference >

signatureKeyIdentifier = DirectReference时soap xml为:
<wsse:BinarySecurityToken
    EncodingType=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
    ValueType=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
    wsu:Id="CertId--138494"
    xmlns:wsse=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    MIIBjTCB9wIER8tmVDANBgkqhkiG9w0BAQQFADANMQswCQYDVQQDEwI5MTAgFw0wODAzMDMwMjQ1NDBaGA8yMTA4MDIwODAyNDU0MFowDTELMAkGA1UEAxMCOTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAI0humTmiooUa1uVW4u3JqRal2XKp9pIezQVdAw3ePUbqMr8R0mb25xUsQY4skZlG9+lo+SrKneIS+ZXgicDQZcrcq3tDvvFJ6ww/o9gaH4faaqrw6VuXwAECUbZEI9qNo15I1KufVKtugEIXQdf0bwcT/y+a4jSbC2n2Mdwa/8NAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAS6bExnc/UO83dtHooaOn0c8ny2GbJTe2GR10aJ1A3Yq3cqdXZmFTchm4iwYW6MKUwJmQDrMf88XA0RKbFLbVwV9PiFvRTB/AaJQMO2NJ+2iuC8vtGf3Bpihwc4XoBTFu67CQhZeoHNa2+c/FaW/ojDdDd/dcuAWu5jlVqfUezBA=
</wsse:BinarySecurityToken>
< wsse:SecurityTokenReference  wsu:Id ="STRId-16359413"
                        xmlns:wsse
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                        xmlns:wsu
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
                        
< wsse:Reference  URI ="#CertId--138494"
                            ValueType
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
                            xmlns:wsse
="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" >
                        
</ wsse:Reference >
                    
</ wsse:SecurityTokenReference >
SAP S/4HANA Public Cloud 配置全景实践 本文提供SAP S/4HANA Public Cloud配置的实用指南,重点介绍三大核心工具:CBC(范围界定与配置)、SAP Activate(方法论与路线图)和Cloud ALM(项目执行与运维)。文章详解了不同系统架构(2SL/3SL)的配置路径,并以制造企业案例说明端到端实施流程。同时提供了工具协同操作方法、初始访问安全建议和常见问题的专家意见,帮助项目团队高效完成实施工作。 阅读详情

相关推荐

ERA5数据批量下载

ERA5再分析数据的IDM接管下载

qq_38734327的博客 3045

org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehau

log4j:WARN No appenders could be found for logger (org.codehaus.xfire.transport.DefaultTransportManager). log4j:WARN Please initialize the log4j system properly. org.codehaus.xfire.XFireRuntimeExcep

世間所有的相遇,都是久別重逢 7598

海量Embedding进行相似度查询和比较的方法

这个是在科研中的现实需求。例如每一个源代码文件,我们可以生成一个embedding,如果有超过5000万个embedding(例如用BERT生成5000万个embedding),怎么样有效地计算相似性呢(例如有5000个positive的embedding,想在5000万个中找到类似的)。 简单介绍一下我尝试的结果:如果直接用torch.cosine_similarity,我手里的数据估计至少要处理两个月。这时候就想到了用LSH -- Locality Sensitive Hashing,但是我之前并没怎

qysh123的专栏 4569

Exception:org.codehaus.xfire.XFireRuntimeException: Could not invoke service..

Exception: org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.原因:两边配置url不一致解决方法:检查url是否一致:客户端url以及两端的端口...

karali的专栏 4754

7.7 数据分析助手:用AI洞察业务数据价值

摘要:AI数据分析助手构建指南 本文介绍了如何构建AI数据分析助手,帮助企业从业务数据中提取价值。系统包含四大核心模块:自然语言理解模块解析用户查询意图,查询规划模块转换为SQL语句,数据可视化模块生成图表,以及洞察生成模块提供深度分析。文章通过销售数据分析助手案例,展示了从数据库准备到自然语言处理的完整实现流程,包括示例代码和系统架构图。该解决方案可降低数据分析门槛,让业务人员直接参与数据探索,提升决策效率。

yonggeit的博客 4101

Pyradiomics 医学影像提取放射组学特征(下)

Pyradiomics 医学影像提取放射组学特征(下)

LetsonH的博客 1337

webservice客户端调用报错org.codehaus.xfire.fault.XFireFault: java.lang.NullPointerException的解决办法

webservice调用异常Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: java.lang.NullPointerException

锋林华的博客 1843

【Qualcomm高通音频】音效调试_录音文件播放有杂音,如何定位原因?

一、录音播放数据处理过程介绍 (1)TX方向 麦克风(硅麦克风或者主机体麦克风)采集模拟音频信号,经过内部CODEC芯片中的adc转换为数字信号,在经过高通音频DSP处理音效后编码为wav/aac/amr/mp3等格式文件。 (2)RX方向 音频文件经过解码、重采样还原为pcm数据,经过DSP处理音效后送到内部CODEC,然后经过DAC转换为模拟信号,送到喇叭。 二、分析步骤 1...

crow_ch的博客 5982

XFire实现webservice的相关错误记录

1.客户端通过调用服务端的窄接口实现类方法时出现,如下错误信息: org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException

楠 1万+

从零到一:R与RStudio的安装与配置全攻略

本文提供了R与RStudio的完整安装与配置指南,涵盖Windows、Mac和Linux三大操作系统。从基础环境搭建到高级性能优化,详细介绍了R语言安装、RStudio配置、项目管理和实用技巧,帮助数据科学初学者快速搭建高效的分析工作环境。

weixin_29062671的博客 429

一文整理深度学习【深度学习linux的docker+pytorch+cuda+nvidia-docker+vscode配置】

docker+pytorch+cuda+nvidia-docker+vscode

LetsonH的博客 1339

org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Server returned error code = 40...

严重: Servlet.service() for servlet jsp threw exceptionorg.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Server returned ...

weixin_30314631的博客 424

【知识分享】IBIS 建模指南 04

文章详细阐述了将缓冲器数据转换为IBIS模型格式的核心步骤与规范要求。主要内容包括:1)IBIS文件三大结构(文件头信息、组件引脚映射、缓冲器行为描述)及其关键词定义;2)四种关键I-V表(上下拉、电源/地钳位)的数据处理规则,强调需避免重复计算效应;3)切换特性描述方法,指出V-T波形表优于Ramp数据的三大优势;4)差分缓冲器通过[DiffPin]关键词实现建模的特殊流程。文中特别强调数据外推校验、参考电压基准转换、工艺角数据排序等易错环节的处理技巧,为创建符合IBIS 4.0规范的精确模型提供指导。

一只豌豆象的博客 2059

ws security java,JAVA-CXF WS-security“验证消息时遇到安全错误”

Sorry for this question, it can appear recurrent by I'm completely blocked.I'm trying to implement a Web Service Server on top of CXF framework. Jax-ws is very helpful to handle a web service, it's ea...

weixin_34518190的博客 708

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

xfire客户端调用服务端报错 XFireRuntimeException: Could not invoke service.. Server returned error code = 4ji

     xfire客户端调用xfire服务端报错     org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Server returned error code = 40      遇到这种问题,一般不是服务器端的配置问题就是客户端的URL的问题。后来发现,是因为端口写错了。

liufangbaishi2014的博客 3701

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

wsse:InvalidSecurity Error When Testing FND_PROFILE Web Service in Oracle Applications R 12.1.2 from...

wsse:InvalidSecurity Error When Testing FND_PROFILE Web Service in Oracle Applications R 12.1.2 from SOAP UI (Doc ID 1314946.1) Modified: 10-Nov-2013 Type: PROBLEM   ...

weixin_33709609的博客 388

使用 MyEclipse 中的XFire 生成客户端后,调用出现的错误(Could not marshall type.)...

使用 MyEclipse的XFire1.2.06 生成客户端后,对其进行测试时,出现错误:      Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFau...

liyuandong的博客 628

解析WSDL 文件 PI 传数据给SAP 关于Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFir

首先接到SAP PI给提供的WSDL 解析WSDL 图片看不清没时间弄 找我wx18681014349解析方法 有两种 (利用eclipse解析 和利用myeclipse解析,注意利用myeclipse解析需要xfire jar包)1利用eclipse 解析首先将wsdl 文件复制到SRC后面如下然后创建 web service client 选择wsdl 文件解析形成如下文件利用这些接口...

weixin_41839503的博客 6811

Xfire Nested exception is org.codehaus.xfire.fault.XFireFault:Couldn't send message.

org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message. org.codehaus.xfire.fault.XFireFault: Couldn't send

CSDN专栏 9886

把自己坑的Could not invoke service..

最近第一次使用xfire写了一个Webservice类,之前在项目上已经有了其他webservice方法,由于需要自己又写了一个方法,用IDE的Web Service Client自动生成了客户端代码,然后就把自己坑死了。。。。,也是醉了,只是为了给自己警醒,以后规范代码,没什么特殊情况方法名首字母小写。 具体错误: org.codehaus.xfire.XFireRuntimeExcepti...

king1701007的专栏 7344

xfire 404

org.codehaus.xfire.fault.XFireFault: Server returned error code = 404 for URI : http://…………. Check server logs for details 地址错误 查询一下对应的wsdl: location对应的请求地址是否正确

站在技术的边缘,遥望你 1597

在tomcat下运行jax-ws 异常

注意事项:1.出现异常 Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 10 counts of IllegalAnnotationExceptionsTwo classes have the same XML type nam...

做最好的自己 322

关于在java6中使用XFire时碰到的一个问题Could not initialize Service

在一个采用了XFire作为WebService框架Web项目中,添加由JDK1.6 wsimport命令生成的一个WebService客户端调用,在客户端调用时出现了如下问题 log4j:WARN No appenders could be found for logger (org.codehaus.xfire.jaxws.Provider). log4j:WARN Please i

Loong 8128
上一篇: 关于专利申请
下一篇: .Net调用Java端带有WS-Security支持的Web Service各方案实战
sfdev
博客等级 码龄22年 468粉丝 134原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址