c# - Migrating WSE Client to WCF - how to replace SecurityPolicyAssertion and UsernameToken? -
i have web service implemented in java being invoked wse 3.0 client, , migrate wse wcf. using standard tools, have created client can invoke web service, returns soapexception message of "required parameter value missing". web service uses https , requires username & password provided. in existing wse client code, credentials area supported subclassing securitypolicyassertion , sendsecurityfilter, follows:
public class utclientassertion : securitypolicyassertion { public utclientassertion() { } public override soapfilter createclientoutputfilter(filtercreationcontext context) { return new clientoutputfilter(this, context); } public override soapfilter createclientinputfilter(filtercreationcontext context) { // don't provide clientinputfilter return null; } public override soapfilter createserviceinputfilter(filtercreationcontext context) { // don't provide processing web service side return null; } public override soapfilter createserviceoutputfilter(filtercreationcontext context) { // don't provide processing web service side return null; } #region clientoutputfilter class clientoutputfilter : sendsecurityfilter { public clientoutputfilter(utclientassertion parentassertion, filtercreationcontext context) : base(parentassertion.serviceactor, false, parentassertion.clientactor) { } public override void securemessage(soapenvelope envelope, security security) { usernametoken token = new usernametoken("username", "password", passwordoption.sendplaintext); security.tokens.add(token); security.mustunderstand = false; } } #endregion
these classes applied generated proxy class in client follows:
// create web service client listservice objlistsvc = new listservice(); //code set security policy , user assertion utclientassertion objassertion = new utclientassertion(); // create policy, add assertion, , set on web service policy objpolicy = new policy(); objpolicy.assertions.add(objassertion); objlistsvc.setpolicy(objpolicy);
what i've found if edit wse client code remove line objlistsvc.setpolicy(objpolicy), same error message of "required parameter value missing".
what equivalent wcf configuration/code match wse code above configures username , password web service? wcf configuration being used default generated:
<basichttpbinding> <binding name="listbinding" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="65536" maxbufferpoolsize="524288" maxreceivedmessagesize="65536" messageencoding="text" textencoding="utf-8" transfermode="buffered" usedefaultwebproxy="true"> <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384" /> <security mode="transport"> <transport clientcredentialtype="none" proxycredentialtype="none" realm="" /> <message clientcredentialtype="username" algorithmsuite="default" /> </security> </binding> </basichttpbinding>
thanks in advance
it hard tell without sample of how soap message wse3 looks on wire. try 1 via fiddler , publish here.
generally if use ssl try this:
<bindings> <basichttpbinding> <binding name="newbinding0"> <security mode="transportwithmessagecredential " /> </binding> </basichttpbinding> </bindings>
if not use ssl try cub.
Comments
Post a Comment