我在c#中创建了一个自托管的Web服务,一切正常。
我在这个基础Object类(DevExpress XPO)上工作:
[Persistent("System.StatusTable")]
public class XPStatusTable : XPBaseObject
{
private short fIDTable;
[Key(true)]
public short IDTable
{
get { return fIDTable; }
set { SetPropertyValue<short>("IDTable", ref fIDTable, value); }
}
private string fDescription;
public string Description
{
get { return fDescription; }
set { SetPropertyValue<string>("Description", ref fDescription, value); }
}
public XPStatusTable() { }
public XPStatusTable(Session session) : base(session) { }
}
我序列化了这些对象的集合:
private string GetSerializedData()
{
StringWriter streamWriter = new StringWriter();
using (UnitOfWork uow = new UnitOfWork())
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(XPCollection<XPStatusTable>));
XPCollection<XPStatusTable> list = new XPCollection<XPStatusTable>(uow);
xmlSerializer.Serialize(streamWriter, list);
return streamWriter.ToString();
}
}
Service接口有这个函数返回一个字符串,但该字符串是一个带有XPStatusTable模式的xml文件。
[OperationContract]
string GetSerializedData();
有没有办法在wsdl描述符中发布(或者我不知道在哪里)'GetSerializedData'返回XPSatusTable的集合而不是简单的字符串?