Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have developed a service in WCF with x509 certifcate security and deployed on UAT. My .net client is able to consume the service and also getting response from the service.

However when I consume the same service in Java, then I get the below error:
Security processor was unable to find a security header in the message. This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties. This can occur if the service is configured for security and the client is not using security.


My Service Config is as below:

XML
<?xml version="1.0"?>
<configuration>
  
   <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="C:\logs\web_messages.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
      <add initializeData="C:\logs\web_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>

  
  <system.serviceModel>

 <diagnostics>
      <messageLogging logEntireMessage="true" logKnownPii="true" logMalformedMessages="true"
        logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
      <endToEndTracing propagateActivity="true" activityTracing="true"
        messageFlowTracing="true" />
    </diagnostics>

  <behaviors>
      <serviceBehaviors>
        <behavior>
 
          <serviceCredentials>
             <clientCertificate>
              <authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck"  />
            </clientCertificate>
            <serviceCertificate findValue="myuatdomain.com"
                                storeLocation="LocalMachine" storeName="My"
                                x509FindType="FindBySubjectName" />
          </serviceCredentials>
	  <serviceMetadata httpGetEnabled="true"  httpsGetEnabled="true" 		
	   httpsGetUrl="https://myuatdomain.com:7443/IR/Transaction.svc/mex"   />

          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
	<binding name="CertBind" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"  				
		maxBufferPoolSize="2147483647" 	maxReceivedMessageSize="2147483647" >
	 		<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
			maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          	 	<security mode="TransportWithMessageCredential">
            		<message clientCredentialType="Certificate" />
			<transport clientCredentialType="None" />
          	 	</security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <protocolMapping>
            <add binding="basicHttpsBinding"  scheme="https" />
    </protocolMapping>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
    <services>
            <service name="InwardRemittanceService.Transaction">
                <endpoint name="basic" address="https://myuatdomain.com:7443/IR/Transaction.svc/mex"  
		binding="basicHttpBinding" contract="IRService.ITransaction" bindingConfiguration="CertBind" >
		 <identity>
			<dns value="myuatdomain.com"/>
			<certificateReference findValue="myuatdomain.com" storeLocation="LocalMachine" storeName="My" 
			x509FindType="FindBySubjectName" />
		</identity>
		</endpoint>
     	    </service>
     </services>  
  </system.serviceModel>

</configuration>




Any help is highly appreciated.

Thanks in advance.
Posted
Updated 20-Apr-15 23:53pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900