0
我用的是.wsdl文件和svcutil.exe的產生與cs文件添加命名空間, 生成cs文件是這樣的:變化WSDL文件中生成C#類
public partial class mytargettype {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
[System.Xml.Serialization.XmlArrayAttribute()]
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] prop1;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 1)]
[System.Xml.Serialization.XmlArrayAttribute()]
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] prop1;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 2)]
[System.Xml.Serialization.XmlArrayAttribute()]
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] prop3;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 3)]
[System.Xml.Serialization.XmlArrayAttribute()]
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public System.Nullable<int>[] prop4;
}
的.wsdl文件的相關部分是:
<wsdl:message name="mytargettype">
<wsdl:part name="prop1" type="ns1:stringArray" />
<wsdl:part name="prop2" type="ns1:stringArray" />
<wsdl:part name="prop3" type="ns1:stringArray" />
<wsdl:part name="prop4" type="ns1:intArray" />
</wsdl:message>
所以,我需要生成的.cs文件如:
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 2)]
[System.Xml.Serialization.XmlArrayAttribute(Namespace = "http://jaxb.dev.java.net/array")]
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] prop3;
如您所見我需要XmlArrayAttribute
命名空間參數,
需要什麼變更添加到.WSDL導致.cs文件的文件與上面類似。
TBH,這是問題,你一種解決方法'重新面對...... – Achilles
這就是我爲什麼表示「你面臨的問題」的原因。主要原因必須是服務的不符合標準的實施,在大多數情況下服務消費者無法實現。 – Achilles