c# - WCF - Setting Policy for UsernameToken -


i received updated wsdl service i'm consuming has below policy added

    <wsp:policy wssutil:id="usernametoken"> <ns0:supportingtokens xmlns:ns0="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512">  <wsp:policy>  <ns0:usernametoken ns0:includetoken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512/includetoken/alwaystorecipient">  <wsp:policy>   <ns0:wssusernametoken10 />    </wsp:policy>   </ns0:usernametoken>   </wsp:policy>   </ns0:supportingtokens>   </wsp:policy> 

i have updated reference right clicking service reference --> configure service option inside visual studio. generated custombinding replacing previous basichttpbinding

<custombinding>             <binding name="mybindingname">                 <!--    wsdlimporter encountered unrecognized policy assertions in servicedescription 'http://ouaf.oracle.com/webservices/cm/cm-custconnacctdetailextract':    -->                 <!--    <wsdl:binding name='cm-custconnacctdetailextractsoapbinding'>    -->                 <!--        <ns0:supportingtokens xmlns:ns0="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512">..</ns0:supportingtokens>    -->                 <textmessageencoding messageversion="soap11" />                 <httptransport />             </binding>         </custombinding> 

do need use custombinding only? or there option in basicbinding makes work?

if use basicbinding transportwithmessagecredential, below error:

the provided uri invalid; https expected

i ran using soapui. in addition username , passwrod, had supply wss-passwordtype passwordtext. without supplying parameter, error in soapui

error on verifying message against security policy error code:1000

i'm not sure how supply wss-passwordtype in basichttpbinding.

my basichttpbinding below

protected basichttpbinding getbinding()     {         return new basichttpbinding()                    {                        name = "basichttpbinding",                        receivetimeout = new timespan(0, 0, 2, 0),                        sendtimeout = new timespan(0, 0, 2, 0),                        security =                            {                                mode = basichttpsecuritymode.transportcredentialonly,                                transport =                                    {                                        clientcredentialtype = httpclientcredentialtype.basic,                                        proxycredentialtype = httpproxycredentialtype.none,                                        realm = ""                                    },                                message =                                    {                                        clientcredentialtype = basichttpmessagecredentialtype.username,                                        algorithmsuite = securityalgorithmsuite.default                                    }                            },                        maxbuffersize = int32.maxvalue,                        maxreceivedmessagesize = int32.maxvalue,                        readerquotas = new xmldictionaryreaderquotas()                        {                            maxbytesperread = 8192                        }                    };     } 

i'm able work through changing binding custom binding

protected custombinding getcustombinding()     {         var custombinding = new custombinding() { name = "custombinding" };          custombinding.elements.add(new textmessageencodingbindingelement() { messageversion = messageversion.soap11 });         var securitybindingelement = securitybindingelement.createusernameovertransportbindingelement();         securitybindingelement.allowinsecuretransport = true;         securitybindingelement.enableunsecuredresponse = true;         securitybindingelement.includetimestamp = false;         custombinding.elements.add(securitybindingelement);         custombinding.elements.add(new httptransportbindingelement());          return custombinding;     } 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -