xfire客户端访问wse3的.net webservice报错:无法理解 SOAP 头 Security。(分不够我再加)

onekey 2007-12-07 11:36:47
我在Client端这么设置的:
public static void setConfig(ServiceSoap var) {
WSS4JOutHandler config = new WSS4JOutHandler();

config.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE );

config.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"outsecurity_sign.properties");
config.setProperty(WSHandlerConstants.ENC_PROP_FILE,
"outsecurity_sign.properties");
config.setProperty(WSHandlerConstants.SIG_KEY_ID, "SKIKeyIdentifier");
config.setProperty(WSHandlerConstants.ENC_KEY_ID, "SKIKeyIdentifier");
config.setProperty(WSHandlerConstants.USER, "tomcat-cl");
config.setProperty(WSHandlerConstants.ENCRYPTION_USER, "localhost");
config.setProperty(WSHandlerConstants.ENC_SYM_ALGO, "http://www.w3.org/2001/04/xmlenc#aes128-cbc");
config.setProperty(WSHandlerConstants.ENC_KEY_TRANSPORT, "http://www.w3.org/2001/04/xmlenc#rsa-1_5");

config.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, UtPasswordHandler.class.getName());

org.codehaus.xfire.client.Client.getInstance(var).addOutHandler(new DOMOutHandler());
org.codehaus.xfire.client.Client.getInstance(var).addOutHandler(config);

}

我在webservice端获取到的请求soap如下:

<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
\n<soap:Header>
\n<wsse:Security soap:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">
<ds:Signature Id=\"Signature-10580099\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">
\n<ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">
\n<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:Reference URI=\"#id-22676229\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">
\n<ds:Transforms xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">
\n<ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n
</ds:Transforms>\n<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:DigestValue xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">x8jxMor8V5pIWiWSnj8ePqKPoxU=</ds:DigestValue>\n
</ds:Reference>\n
</ds:SignedInfo>\n<ds:SignatureValue xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\nUJtl+4hePRm/LEPqj88XOGEl1BPop7FKvSK5LQHThm18OG/C8a1wKHNF3RHunEXvlgERh2V9FMM+\nINvsFtUamoYTyr2itFiL3IsSSCZMUHEtFqzeAwfM80OMh+yyIxlSJCOXNs8nvey5reER281v45we\nvUa28P50Zl0K/m9RB7M=\n</ds:SignatureValue>\n<ds:KeyInfo Id=\"KeyId-10690075\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">
\n<wsse:SecurityTokenReference wsu:Id=\"STRId-17308974\" 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\">/XtQaHLKr0UL3K/LRFDq+/6a6zE=</wsse:KeyIdentifier>
</wsse:SecurityTokenReference>\n
</ds:KeyInfo>\n
</ds:Signature>
</wsse:Security>
</soap:Header><soap:Body wsu:Id=\"id-22676229\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">
<HelloWorld xmlns=\"http://tempuri.org/\" />
</soap:Body>
</soap:Envelope>

处理时报如下异常: System.Web.Services.Protocols.SoapHeaderException: 无法理解 SOAP 头 Security。

我怀疑是不是"\n"的问题,怎么才能去掉"\n"?
...全文
318 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
onekey 2007-12-10
  • 打赏
  • 举报
回复
服务期是.net的webservice
nanjg 2007-12-09
  • 打赏
  • 举报
回复
我也遇见过这样的问题,你试试把CLIENT和SERVER的javabean的包名写成一样的,看看能不能得到值.
nanjg 2007-12-08
  • 打赏
  • 举报
回复
replace ("\n","")

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧