我已经使用 Visual Studio wsdl.exe 工具从提供的 wsdl 和 xsd 文件开始自动生成了一个 C# 类。我想用这个客户端来调用意大利由 SII (Servizio Informativo integrato) 创建的 java SOAP 服务。我收到这个错误。
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'
翻译:提供给 SII 服务接口的 MessaggioSII 与标准结构不匹配:
带有代码 [SII_AU_004] 的异常 SII_EX_ERROR - ProtocolValidationException,错误描述:MessaggioSII;没有属性命名空间声明的 MessaggioSII http://www.acquirenteunico.it/schemas/2010/SII_AU/MessaggioSII '
我也有调用相同 SOAP 服务的 Java 代码,它运行良好。
这是 wsdl.exe 工具自动生成的 C# 代码的相关部分。此代码因上述错误而失败。
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]));
}
SOAP 客户端应该能够连接到 SOAP 服务、发送问题并获得答案