I'm trying to create a Service to be consumed from a client. It must conform the WS-Security Oasis standard and the response must be like:
<soapenv:Envelope xmlns:ns="http://inti.notariado.org/XML" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Timestamp wsu:Id="TS-3E29AD5728CD9B921B14555351279296">
<wsu:Created>2016-02-15T11:18:47.928Z</wsu:Created>
<wsu:Expires>2016-02-15T11:23:47.928Z</wsu:Expires>
</wsu:Timestamp>
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509PKIPathv1"
wsu:Id="X509-3E29AD5728CD9B921B14555351276791">MIIH6zCCB+cw...OMMITED...2lpK
</wsse:BinarySecurityToken>
<ds:Signature Id="SIG-3E29AD5728CD9B921B14555351277955" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-3E29AD5728CD9B921B14555351277904">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<InclusiveNamespaces PrefixList="ns" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transform>
</ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>jBhSy8vJGQtkVx9ok+aiLklTMaU=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>ui...OMMITED...eLzGcWA==
</ds:SignatureValue>
<ds:KeyInfo Id="KI-3E29AD5728CD9B921B14555351277502">
<wsse:SecurityTokenReference wsse11:TokenType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509PKIPathv1"
wsu:Id="STR-3E29AD5728CD9B921B14555351277533"
xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd">
<wsse:Reference URI="#X509-3E29AD5728CD9B921B14555351276791"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509PKIPathv1"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
<ns:SERVICE_DISPATCHER>
<ns:TIMESTAMP>2008-09-29T03:49:45</ns:TIMESTAMP>
<ns:TIPO_MSJ>1</ns:TIPO_MSJ>
<ns:EMISOR>TEST</ns:EMISOR>
<ns:RECEP>CGN</ns:RECEP>
<!--Optional:-->
<ns:SERVICIO>CTREEF</ns:SERVICIO>
</ns:SERVICE_DISPATCHER>
</soapenv:Header>
<soapenv:Body wsu:Id="id-3E29AD5728CD9B921B14555351277904" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<ns:SERVICE_DISPATCHER_REQUEST>
<con:ConsultaTitularidadRealRequest xmlns:con="http://ancert.notariado.org/XML/ConsultaTitularidadReal/Terceros">
<con:TipoConsulta>EMPRESAS_ACTUAL</con:TipoConsulta>
<con:TipoResultado>XML_PDF</con:TipoResultado>
<con:DatosConsulta>
<con:Identificacion>
<con:TipoDocumento>1</con:TipoDocumento>
<con:NumeroDocumento>N4361258I</con:NumeroDocumento>
</con:Identificacion>
</con:DatosConsulta>
</con:ConsultaTitularidadRealRequest>
</ns:SERVICE_DISPATCHER_REQUEST>
</soapenv:Body>
I tried to do it with WSE 3.0 and WCF but I always get stuck and can't find good tutorials about how to secure the service.
So the questions are... What's the best way to develop it? Any good tutorial which could help me? Should I configure security by code or by web.config?
Thanks in advance.