Ciao a tutti, stiamo provando ad inviare la notifica esito a operatore economico ma riceviamo sempre l’errore 400 Bad Request con wsa:ActionNotSupported
Abbiamo inoltrato la richiesta all’endpoint https://testservizi.fatturapa.it/ricevi_notifica, impostando l’encoding del messaggio come MTOM e provando sia con BasicHttpBinding che con WSHttpBinding… ma nulla è cambiato
Utilizziamo ASP NET Services .asmx, C#
Qualcuno che è riuscito a risolvere?
Stiamo utilizzando questo codice
/** Imposto TLS12 */
ServicePointManager.ServerCertificateValidationCallback = ValidateCallback;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
NotificaEsito srvReq = new NotificaEsito();
/** Provo con BasicHttpBinding */
/*
BasicHttpBinding cBinding = new BasicHttpBinding();
cBinding.MessageEncoding = WSMessageEncoding.Mtom;
cBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
cBinding.Security.Mode = BasicHttpSecurityMode.Transport;
*/
/** Provo con WSHttpBinding */
WSHttpBinding cBinding = new WSHttpBinding();
cBinding.MessageEncoding = WSMessageEncoding.Mtom;
cBinding.TextEncoding = Encoding.UTF8;
cBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
cBinding.Security.Mode = SecurityMode.Transport;
var certificate = new X509Certificate2("...test-client.pfx", "...password...", X509KeyStorageFlags.MachineKeySet);
var address = new EndpointAddress(new Uri("https://testservizi.fatturapa.it/ricevi_notifica"));
var factory = new ChannelFactory<TrasmissioneFattureChannel>(cBinding, address);
factory.Credentials.ClientCertificate.Certificate = certificate;
factory.Endpoint.Contract.ProtectionLevel = ProtectionLevel.Sign;
factory.Credentials.ServiceCertificate.DefaultCertificate = new X509Certificate2("...testservizi.fatturapa.it.cer");
factory.Credentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication
{
CertificateValidationMode = X509CertificateValidationMode.None,
RevocationMode = X509RevocationMode.NoCheck,
};
var channel = factory.CreateChannel();
try
{
byte[] f = System.IO.File.ReadAllBytes("...IT00000000000_0000_EC_001.xml");
byte[] x = Convert.FromBase64String(Convert.ToBase64String(f, 0, f.Length));
srvReq.notificaEsito1 = new fileSdI_Type1();
srvReq.notificaEsito1.File = x;
srvReq.notificaEsito1.NomeFile = "IT00000000000_0000_EC_001.xml";
srvReq.notificaEsito1.IdentificativoSdI = "1234567";
channel.NotificaEsito(srvReq);
}
catch (Exception exc)
{
/** ... */
}
Risposta da fatturapa
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\">
<soapenv:Header xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">
<wsa:Action>http://www.w3.org/2005/08/addressing/fault</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Sender</soapenv:Value>
<soapenv:Subcode>
<soapenv:Value xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">wsa:ActionNotSupported</soapenv:Value>
</soapenv:Subcode>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang=\"en-US\">Internal Error</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<wsa:ProblemAction xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">
<wsa:Action>http://www.fatturapa.it/TrasmissioneFatture/NotificaEsito</wsa:Action>
</wsa:ProblemAction>
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>"