Massimo Pasina
Massimo Pasina

Reputation: 21

How to fix "Attribute namespace declaration missing in XML"

I have automatically generated a C# class using the visual studio wsdl.exe tool starting from supplied wsdl and xsd files. I want to use this client to call a java SOAP service in Italy created by SII (Servizio Informativo integrato). I am getting this error.

System.Web.Services.Protocols.SoapHeaderException: 
'InRequestHandler[pdcInterfacciaServiziSII]: 
Il MessaggioSII fornito all'interfaccia Servizi SII non risulta conforme alla struttura standard: 
Eccezione SII_EX_ERROR con codice [SII_AU_004] - EccezioneValidazioneProtocollo, 
descrizione errore: MessaggioSII ; MessaggioSII without attribute namespace declaration 
http://www.acquirenteunico.it/schemas/2010/SII_AU/MessaggioSII'

Translation: The MessaggioSII supplied to the SII Services Interface does not match with the standard structure:

Exception SII_EX_ERROR with code [SII_AU_004] - ProtocolValidationException, Error description: MessaggioSII ; MessaggioSII without attribute namespace declaration http://www.acquirenteunico.it/schemas/2010/SII_AU/MessaggioSII'

I have also the Java code that calls the same SOAP service and it works perfectly.

This is the relevant part of the C# code automatically generated by the wsdl.exe tool. This code fails with the error written above.

public VerificaInteroperabilitaPdCService() {
    this.Url = "http://127.0.0.1:8080/openspcoop2/pdc/PD";
}

public event startCompletedEventHandler startCompleted;


[System.Web.Services.Protocols.SoapRpcMethodAttribute("start", RequestNamespace="http://www.acquirenteunico.it/schemas/2010/SII_AU/VerificaInteroperabilitaPdC", ResponseNamespace="http://www.acquirenteunico.it/schemas/2010/SII_AU/VerificaInteroperabilitaPdC", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.XmlElementAttribute("MessaggioSII")]
public StartResponseMessaggioSIIType start(StartMessaggioSIIType MessaggioSII) {
    object[] results = this.Invoke("start", new object[] {
                MessaggioSII});
    return ((StartResponseMessaggioSIIType)(results[0]));
}


public System.IAsyncResult Beginstart(StartMessaggioSIIType MessaggioSII, System.AsyncCallback callback, object asyncState) {
    return this.BeginInvoke("start", new object[] {
                MessaggioSII}, callback, asyncState);
}

public StartResponseMessaggioSIIType Endstart(System.IAsyncResult asyncResult) {
    object[] results = this.EndInvoke(asyncResult);
    return ((StartResponseMessaggioSIIType)(results[0]));
}

The SOAP client should be able to connect to the SOAP service, send a question and get an answer

Upvotes: 1

Views: 164

Answers (0)

Related Questions