SII - Immediate supply of information - leasehold farms

1

I have already carried out the development to send the SII to the hacienda, but now we are thinking of sending it to the regional haciendas of Navarre and the Basque Country. With the one from Navarra we did not have problems but with the one from the Basque Country, it gives us an error when Parsing the XML.

After comparing the files that were sent, we realized that the difference is in the namespace that for Spanish finance is:

<SuministroLRFacturasEmitidas xmlns="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd"> 

and for alava it is

<SuministroLRFacturasEmitidas xmlns="https://sii.araba.eus/documentos/SuministroLR.xsd">.

My question is how we can modify only the namespace when making the method call:

SuministroLRFacturasRecibidas objEnvioFacturas = null;
RespuestaLRFRecibidasType objRespuestaFacturas = null;
objSWFact.Timeout = Configuracion.Configuracion.SIITimeOutEnvio * 1000;

objEnvioFacturas = new SuministroLRFacturasRecibidas()
            {
                Cabecera = (CabeceraSii)ObtenerCabecera(cliente, argstrTipoComunicacion),
                RegistroLRFacturasRecibidas = ObtenerFacturasRecibidas(_mdecIdEmpresas, cliente, argstrTipoComunicacion, argstrFechaDesde, argstrFechaHasta, ref strMensajeFacturasErroreas, ref facturasEnviadas, argdecIdCaimtransacciones, argblnPrimerSemestre)
            };
            objRespuestaFacturas = objSWFact.SuministroLRFacturasRecibidas((SuministroLRFacturasRecibidas)objEnvioFacturas);
    
asked by rrg 01.12.2017 в 09:05
source

1 answer

0

I think the solution depends on how the namespace is placed in the XML in the first place.

Knowing the answer to that, you may be able to do something before generating the XML to be generated with one namespace or another.

I think it is necessary to show more code of your application to understand properly where the problem could be solved.

If the XML string is generated manually from your programming, there you have the answer, modify the value you pass in that attribute.

But it seems to me that in your case the coding of object c # to XML is being done by some kind of SOAP client that you therefore installed what I understand is that the SOAP client when reading the definition from the WSDL Basque Country should know how to correctly encode the data before sending it.

Now the only thing that can occur to me, because as I say is very little code / info to know with certainty, is that you may have generated locally some objects based on the definition of the Spanish Tax Agency and those objects you are instantiating them to fill them with the data before passing them as a parameter to the webservice client command. That said, you may have to generate another version of those objects from the Basque Country SII definition.

I'll also tell you how I work in my case with PHP and SoapClient:

  • I do not generate any local classes from any definition
  • I just create a PHP multi-level associative array, with the whole structure, header and rows
  • Then I simply call $cliente->metodo($datos) and the same PHP SoapClient encodes my associative array to the XML it needs before sending it
  • Therefore I understand that in my case if instead of connecting to the WSDL of the main Tax Agency of Spain, I will connect to the URL of the Basque Country, it should work automatically.

    I hope it helps you and if you provide more information I will be happy to give you a feedback although I have no experience with c # but with php.

    Finally, to tell you that in link I have written an ebook that contains a technical guide to make a basic implementation of the SII, explains topics of web services, use of certificates, and contains code examples in PHP together with a mini application that links all parts of the communication circuit with the SII.

        
    answered by 16.01.2018 в 15:48