.net访问有ws security的java开发的CXF的webservice

问题描述

1、首先PFX已经生成了,.NET调用时相关数据已经加入2、但是报这个错误:org.apache.ws.security.WSSecurityException:Anerrorwasdiscoveredprocessingthe<wsse:Security>header了

解决方案

解决方案二:
该回复于2012-07-16 10:26:31被版主删除
解决方案三:
需要自己加Header.objectIClientMessageInspector.BeforeSendRequest(refSystem.ServiceModel.Channels.Messagerequest,System.ServiceModel.IClientChannelchannel){UsernameTokenut=newUsernameToken("USERNAME","PASSWORD",PasswordOption.SendHashed);XmlElementsecurityElement=ut.GetXml(newXmlDocument());MessageHeadermyHeader=MessageHeader.CreateHeader("Security","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",securityElement,false);request.Headers.Add(myHeader);returnConvert.DBNull;}

具体内容参考下面的讨论:ErrorinWCFclientconsumingAxis2webservicewithWS-SecurityUsernameTokenPasswordDigestauthenticationscheme
解决方案四:
我是用数字证书的,不是用用户名和密码的。
解决方案五:
数字证书也成功加载了。
解决方案六:
以下是.net生成的配置文件:<?xmlversion="1.0"encoding="utf-8"?><policyDocumentxmlns="http://schemas.microsoft.com/wse/2003/06/Policy"><mappingsxmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy"><!--Thefollowingpolicydescribesthepolicyrequirementsforallserviceswhodonothaveamappinginthisfile.--><defaultEndpoint><defaultOperation><requestpolicy="#Sign-X.509"/><responsepolicy="#Encrypt-X.509"/><faultpolicy=""/></defaultOperation></defaultEndpoint></mappings><policiesxmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy"xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"><wsp:Policywsu:Id="Sign-X.509"><!--MessagePredicateisusedtorequireheaders.ThisassertionshouldbeusedalongwiththeIntegrityassertionwhenthepresenceofthesignedelementisrequired.NOTE:thisassertiondoesnotdoanythingforenforcement(send-side)policy.--><wsp:MessagePredicatewsp:Usage="wsp:Required"Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()wsp:Header(wsa:To)wsp:Header(wsa:Action)wsp:Header(wsa:MessageID)wse:Timestamp()</wsp:MessagePredicate><!--TheIntegrityassertionisusedtoensurethatthemessageissignedwithX.509.ManyWebserviceswillalsousethetokenforauthorization,suchasbyusingthe<wse:Role>claimorspecificX.509claims.--><wssp:Integritywsp:Usage="wsp:Required"><wssp:TokenInfo><!--TheSecurityTokenelementwithintheTokenInfoelementdescribeswhichtokentypemustbeusedforSigning.--><wssp:SecurityToken><wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3</wssp:TokenType><wssp:TokenIssuer>CN=tzyyyyghclient</wssp:TokenIssuer><wssp:Claims><!--ByspecifyingtheSubjectNameclaim,thepolicysystemcanlookforacertificatewiththissubjectnameinthecertificatestoreindicatedintheapplication'sconfiguration,suchasLocalMachineorCurrentUser.TheWSEX.509CertificateToolisusefulforfindingthecorrectvaluesforthisfield.--><wssp:SubjectNameMatchType="wssp:Exact">CN=tzyyyyghclient</wssp:SubjectName><wssp:X509ExtensionOID="2.5.29.14"MatchType="wssp:Exact">K+EfdvTR8l0bnajaGZpR7tu4a7U=</wssp:X509Extension></wssp:Claims></wssp:SecurityToken></wssp:TokenInfo><wssp:MessagePartsDialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()wsp:Header(wsa:Action)wsp:Header(wsa:FaultTo)wsp:Header(wsa:From)wsp:Header(wsa:MessageID)wsp:Header(wsa:RelatesTo)wsp:Header(wsa:ReplyTo)wsp:Header(wsa:To)wse:Timestamp()</wssp:MessageParts></wssp:Integrity></wsp:Policy><wsp:Policywsu:Id="Encrypt-X.509"><!--TheConfidentialityassertionisusedtoensurethattheSOAPBodyisencrypted.--><wssp:Confidentialitywsp:Usage="wsp:Required"><wssp:KeyInfo><!--TheSecurityTokenelementwithintheKeyInfoelementdescribeswhichtokentypemustbeusedforEncryption.--><wssp:SecurityToken><wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3</wssp:TokenType><wssp:TokenIssuer>CN=tzyyyyghclient</wssp:TokenIssuer><wssp:Claims><!--ByspecifyingtheSubjectNameclaim,thepolicysystemcanlookforacertificatewiththissubjectnameinthecertificatestoreindicatedintheapplication'sconfiguration,suchasLocalMachineorCurrentUser.TheWSEX.509CertificateToolisusefulforfindingthecorrectvaluesforthisfield.--><wssp:SubjectNameMatchType="wssp:Exact">CN=tzyyyyghclient</wssp:SubjectName><wssp:X509ExtensionOID="2.5.29.14"MatchType="wssp:Exact">K+EfdvTR8l0bnajaGZpR7tu4a7U=</wssp:X509Extension></wssp:Claims></wssp:SecurityToken></wssp:KeyInfo><wssp:MessagePartsDialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()</wssp:MessageParts></wssp:Confidentiality></wsp:Policy></policies></policyDocument>
解决方案七:
大侠你解决了吗我也遇到了同样的问题谢谢

时间: 2024-09-19 09:44:29

.net访问有ws security的java开发的CXF的webservice的相关文章

面向 Java 开发人员的 Ajax: 探索 Google Web Toolkit

ajax|google|web GWT(请参阅 参考资料)采用了一种不寻常的方式进行 Web 应用程序开发.它没有采用客户端和服务器端代码库的普通隔离,而是提供了一个 Java API,该 API 允许创建基于组件的 GUI,然后编译它们,从而在用户的 Web 浏览器上显示它们. 与一般的 Web 应用程序开发体验相比,使用 GWT 更接近于使用 Swing 或 SWT 进行开发,它还试图将 HTTP 协议和 HTML DOM 模型抽象出去.实际上,应用程序最终几乎总是会呈现在 Web 浏览器中

服务器-关于用java开发微信公众平台开发 token验证失败的问题

问题描述 关于用java开发微信公众平台开发 token验证失败的问题 大家好,最近在学习用java开发微信公众平台,第一次写的代码token验证通过了,用的是阿里云的服务器换系统(server2008->2003)后就怎么也通过不过验证.直接输入域名www.zhenggufang.com/aip/longin网页显示404.域名也已经备过案.服务器上的tomcat也启动正常tomcat/conf/server也修改了.多谢提交还是token验证失败.请各位帮忙看看代码如下: package s

Centos6.5搭建java开发环境配置详解_Linux

一.安装jdk 1.查看Linux自带的JDK是否已安装 java –version 如果出现openjdk,最好还是先卸载掉openjdk,在安装sun公司的jdk. 2.查看jdk信息 rpm -qa|grep java 3.卸载OpenJDK,执行以下操作: rpm -e --nodeps tzdata-java-2012c-1.el6.noarch rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64 4.新

在Centos6.5系统下安装java开发环境详细步骤

Centos6.5系统下安装java开发环境的步骤如下 一.安装jdk 1.查看Linux自带的JDK是否已安装 java ?version 如果出现openjdk,最好还是先卸载掉openjdk,在安装sun公司的jdk. 2.查看jdk信息 rpm -qa|grep java 3.卸载OpenJDK,执行以下操作: rpm -e --nodeps tzdata-java-2012c-1.el6.noarchrpm -e --nodeps java-1.7.0-openjdk-1.7.0.45

详解java开发webservice的几种方式_java

webservice的应用已经越来越广泛了,下面介绍几种在Java体系中开发webservice的方式,相当于做个记录. 1.Axis2 Axis是apache下一个开源的webservice开发组件,出现的算是比较早了,也比较成熟.这里主要介绍Axis+eclipse开发webservice,当然不用eclipse也可以开发和发布webservice,只是用eclipse会比较方便. (1)下载eclipse的Java EE版本http://www.jb51.net/softs/239903.

java开发微信分享到朋友圈功能_java

微信分享功能开发 用了一天时间,把微信发送给朋友和分享到朋友圈功能开发出来,在这里给大家分享一下,避免大家走弯路. 一.服务器端程序 package com.wiimedia.controller; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.ParseException; import

Java 开发 2.0: 您也可以租用 EC2--以灵活且低成本的方式创建高效、可伸缩的租借的基础设施

在本期 Java 开发 2.0 中,Andrew Glover 介绍如何针对 Amazon Elastic Compute Cloud (EC2) 进行开发和部署.了解 EC2 与 Google App Engine 的差异,以及如何使用 Eclipse 插件和简洁的 Groovy 语言在 EC2 上快速地建立和运行简单的 Web 应用程序. 您可能听说过 Standish Chaos Report,这份每年一次的报告研究成功和失败的 IT 项目.这份报告常常包含大量坏消息.(如果都是好消息,它

Thrift 0.2.0 Java 开发环境安装

Thrift是一个跨语言的RPC实现. 是由Facebook公司开源出来的.非常好用.对于C++开发环境的安装相对简单,只要在安装包解压以后,按照README文件的说明安装即可.但是对于Java开发环境的安装,却没有什么说明.本文仅对Java开发环境的安装,做一些说明,供大家参考(本文假设您的JDK已经安装好了). Thrift Java的编译需要Ant.而且使用了一个特殊的包slf4j.并且在使用ant编译thrit的过程中,还需要下载一些依赖的Java库.所以最好,安装的机器上是可以访问In

用JAVA开发CORBA应用实例

应用实例 文章摘要: 通用对象代理体系结构CORBA(Common Object Request Broker Architecture)是对象管理组织所定义的用来实现现今大量硬件.软件之间互操作的解决方案,CORBA也是迈向面向对象标准化和互操作的重要一步. -------------------------------------------------------------------------------- 正文: 用JAVA开发CORBA应用实例 通用对象代理体系结构CORBA(C