0

Could someone tell me what I should add to the call?

This is the WSDL: https://preproduccio.ejcat.justicia.gencat.cat/cee/TTA/TTAImport?wsdl

and this is my code:

try
        {
            // la url del servicio
            string urlServicio = @"https://preproduccio.ejcat.justicia.gencat.cat/cee/TTA/TTAImport?wsdl";

            var address = new EndpointAddress(urlServicio);
            // creamos la seguridas del transporte
            var binding = new BasicHttpsBinding();
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;

            // creamos el servico que vamos a mandar
            var client = new servicioGenCATTTAImport.JwsClient(binding, address);

            // añadimos al servicio el certificado (la seguridad)
            client.ClientCredentials.ClientCertificate.SetCertificate(
                StoreLocation.CurrentUser,
                StoreName.My,
                X509FindType.FindBySerialNumber,
                conexionObject.idCertificadoEmpresa
            );

            var taulaMaestra = new servicioGenCATTTAImport.ttaconsultaTaulaMestra();

            taulaMaestra.dadesTME = new servicioGenCATTTAImport.ttaconsultaTaulaMestraDadesTME();
            taulaMaestra.dadesTME.idiomaTME = "ESP";
            taulaMaestra.dadesTME.codiTME = "TIPUS_DOCUMENT_ESCRIT";

            taulaMaestra.dadesAplicacio = new servicioGenCATTTAImport.ttaconsultaTaulaMestraDadesAplicacio();
            var bytes = File.ReadAllBytes(@"C:\Users\angel\OneDrive\Escritorio\certificados\certificadoED.pfx");
            taulaMaestra.dadesAplicacio.CDA = bytes;
            taulaMaestra.dadesAplicacio.descClient = "ANGEL RODRIGUEZ RUIZ";
            taulaMaestra.dadesAplicacio.codiClient = "50817316N";


            // llamamos al servicio
            var kk = client.consultaTME(taulaMaestra);


            
           

            return conexionObject;

        }
        catch (Exception ex)
        {
            return conexionObject;
        }


        return null;

I have tried adding the certificate in PFX, .CER (binary and B64) format and nothing, I have tried to request support from the official body that manages it and they answer that this is out of their scope.

Apparently from JAVA, it works perfectly, but I don't know JAVA and I need it to go in .NET core.

I have tried everything I know, (which is very little), in addition we do not have a name or username or password, the identification is done through the use of the certificate.

Thank you very much in advance.

stuartd
  • 70,509
  • 14
  • 132
  • 163
Angel-ito
  • 1
  • 1
  • 1
    I suggest you look at the working Java code and see what algorithm it uses. Java isnt much different from c# – stuartd Apr 16 '23 at 17:18
  • There should be tools to create a C#/.NET Client from the wsdl. Have you tried any of those? – Fildor Apr 16 '23 at 19:14
  • Security is a non-functional requirement, and the standard for attaching this to wsdl is ws-policy. As suggested in [this case](https://stackoverflow.com/questions/5726127/adding-soap-implicit-headers-to-wsdl/5741644#5741644), you can use a code generator (Metro or Axis2). – Jiayao Apr 17 '23 at 02:39

0 Answers0