Error sending signed xml to DGI ws

1

The DGI of Uruguay is implementing the electronic invoice. I using VS 2010 I already signed the xml and I tried to send it via SoapUi. Go well When I try to send it from my program (in C # or vb.net, windows form application), having created the service reference to ( link )) only answers" Error when consuming Web Service ".

My code is

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim WS As New Servicio4.WS_eFacturaSoapPortClient

    Dim ClaveDelCertificado As String = "Prueba.01"
    Dim certPath As String
    certPath = Path.Combine("G:\A-enviar\", "PKPrueba - EMPRESA.pfx")

    Dim Certi As New X509Certificate2(certPath, ClaveDelCertificado, X509KeyStorageFlags.Exportable Or X509KeyStorageFlags.PersistKeySet)

    WS.ClientCredentials.ClientCertificate.Certificate = Certi
    Dim xEnviar As New WS_Enviar4.Servicio4.Data()
    Dim xRecib As New WS_Enviar4.Servicio4.Data()
    *Dim Sobre_cCFE As String = "G:\A-enviar\Sobre17_09_13T20_52_31.xml"*
    *Dim campo() As String*
    *campo = File.ReadAllLines(Sobre_cCFE)*
    *xEnviar.xmlData = campo.ToString*
    Try
        xRecib = WS.EFACRECEPCIONSOBRE(xEnviar)
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

and my app.config

<configuration>
<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="WS_eFacturaSoapBinding">
              <security mode="Transport" >
                <transport clientCredentialType="Certificate" />
              </security>
            </binding>
            <binding name="WS_eFacturaSoapBinding1" />
        </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://efactura.dgi.gub.uy:6443/ePrueba/ws_eprueba"
          binding="basicHttpBinding" bindingConfiguration="WS_eFacturaSoapBinding"
          contract="Servicio4.WS_eFacturaSoapPort" name="WS_eFacturaSoapPort" >
      </endpoint>
    </client>
</system.serviceModel>

Please help me, I'm stuck with this. I suppose that somewhere it should inform the WS what is .pfx and its key to authenticate; I do not know where to do it. And the other, is the invoice signed for shipping well loaded?

Dim Sobre_cCFE As String = "G:\A-enviar\Sobre17_09_13T20_52_31.xml"
Dim campo() As String
campo = File.ReadAllLines(Sobre_cCFE)
xEnviar.xmlData = campo.ToString

The content that the variable xEnviar.xmldata should have when I try to attach it truncates and deforms it: is there any way to attach it?

    
asked by Ruben 21.09.2017 в 20:14
source

0 answers