मुझे एक एसओएपी सेवा मिली है जिसे मैं कनेक्ट करना चाहता हूं। इसे गंदे https तक पहुंचाया जाना चाहिए और इसे प्रमाण पत्र द्वारा हस्ताक्षरित निकाय की आवश्यकता है। इस प्रकारएचटीटीपीएस पर डब्ल्यूसीएफ और शरीर पर हस्ताक्षर
<basicHttpBinding>
<binding name="P4Binding" 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="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
सेटअप अप मेरे मुवक्किल:
P4_ServiceReference.P4PortTypeClient client = new P4_ServiceReference.P4PortTypeClient();
client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
client.ClientCredentials.ServiceCertificate.DefaultCertificate = new X509Certificate2(@"[..].cer");
client.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2(@"[..]", "somepass");
यहाँ तक कि मेरे Reference.cs बदल ServiceContractAttribute और OperationContractAttribute पर ProtectionLevel=ProtectionLevel.Sign
शामिल करने के लिए
मैं निम्नलिखित कोड की कोशिश की है।
क्या होता है कि wse: सुरक्षा हेडर बनाया गया है, लेकिन शरीर पर हस्ताक्षर नहीं किए जा रहे हैं। सेवा लौटाती है।
मुझे क्या याद आ रहा है ताकि शरीर ठीक से हस्ताक्षर हो जाए?
मैंने केवल शरीर पर हस्ताक्षर करने का प्रयास किया, लेकिन AsymmetricSecurityBindingElement का उपयोग करके अभी भी इसे एन्क्रिप्ट करता है (सेवा https का उपयोग नहीं करती है)। मेरे यहां एक प्रश्न है: http://stackoverflow.com/questions/20349062/wcf-client-binding-to-sign-the-body-of-a-request-to-a-java-web- सेवा –
@MrShoubs अपने सेवा इंटरफ़ेस में निम्न विशेषता लागू करें और एन्क्रिप्शन अब और नहीं होगा, '[ServiceContractAttribute (ProtectionLevel = ProtectionLevel.Sign, ...)] सार्वजनिक इंटरफ़ेस MyService {...} '। ध्यान दें कि यह कोड से भी किया जा सकता है जैसे 'myService.Endpoint.Contract.ProtectionLevel = ProtectionLevel.Sign'। –