samedi 1 août 2015

Adding Security Header Username and password in API

Iam a Beginner in C#.Now iam working on one API on which iam facing one Exception

"Soap Exception :No security Header Found".

I just tried to add

CBANK.Service cService = new CBANK.Service();
cService.ClientCredentials.UserName.UserName = "username";
cService.ClientCredentials.UserName.Password= "Password";

but i cant find Clientcredentials in my service.My Webconfig settings is

<bindings>
        <customBinding>
            <binding name="ServiceComPortBinding" receiveTimeout="02:00:00" sendTimeout="02:00:00" openTimeout="02:00:00" closeTimeout="02:12:00">
                <transactionFlow transactionProtocol="WSAtomicTransactionOctober2004"/>
                <security defaultAlgorithmSuite="Basic128" authenticationMode="UserNameForCertificate" requireDerivedKeys="false" securityHeaderLayout="Strict" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10" requireSignatureConfirmation="false">
                    <localClientSettings cacheCookies="true" detectReplays="true" replayCacheSize="900000" maxClockSkew="01:00:00" maxCookieCachingTime="Infinite" replayWindow="01:00:00" sessionKeyRenewalInterval="10:00:00" sessionKeyRolloverInterval="01:0:00" reconnectTransportOnFailure="true" timestampValidityDuration="01:00:00" cookieRenewalThresholdPercentage="60"/>
                    <localServiceSettings detectReplays="true" issuedCookieLifetime="10:00:00" maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="01:00:00" negotiationTimeout="01:00:00" replayWindow="01:01:00" inactivityTimeout="01:00:00" sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="01:00:00" reconnectTransportOnFailure="true" maxPendingSessions="128" maxCachedCookies="10000" timestampValidityDuration="01:00:00"/>
                    <secureConversationBootstrap/>
                </security>
                <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11WSAddressing10" writeEncoding="utf-8">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                </textMessageEncoding>
                <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true">
                    <extendedProtectionPolicy policyEnforcement="Never"/>
                </httpTransport>
            </binding>
        </customBinding>
    </bindings>

can somebody help me to solve this issue.

Aucun commentaire:

Enregistrer un commentaire