我有一个来自我的客户及其wsdl文件的Web服务URL。我从wsdl文件中添加了新项目。
在wsdl
<element name="ProductionDate" type="xsd:date" minOccurs="0" maxOccurs="1" nillable="true"/>
在reference.cs文件中
[System.Xml.Serialization.SoapElementAttribute("ProductionDate", DataType="date", IsNullable=true)]
public System.Nullable<System.DateTime> ProductionDate{
get {
return this.ProductionDate;
}
set {
this.ProductionDate= value;
}
}
当我尝试创建WebService类实例时,会抛出异常:
'date'是SoapElementAttribute的无效值。
我改变了我的wsdl
[System.Xml.Serialization.SoapElementAttribute("ProductionDate", DataType="date")]
public System.DateTime ProductionDate{
get {
return this.ProductionDate;
}
set {
this.ProductionDate= value;
}
}
所以我可以创建webService类实例但是当我从我的客户webservice Url调用时,抛出异常:
方法'q1:blabla未实现:方法名称或命名空间不 识别。
还有其他方法让这个工作吗?
答案 0 :(得分:0)
我相信你必须在.cs文件中使用数据类型作为'dateTime'来获取xsd模式文件中的date数据类型。
试试这个
SoapElement(DataType = "dateTime")