所以,我有一个应用程序我的工作,我要叫两个冷融合Web服务,我可以在不同的Web引用resource.cs中强制对象转换为相同的类型吗?
http://blah/search.cfc and http://blah/asset.cfc
这都返回一个“QueryBean”。我称它们为DAM_Search和DAM_Asset。 QueryBean结果具有相同的类型,但它们存储在两个目录中。
DAM_Search具有该类位于 项目文件夹\ Web引用\ DAM_Search \ Reference.cs 和DAM_Asset具有位于 项目文件夹\ Web引用同一类\ DAM_Asset \ Reference.cs
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="http://wstypes.newatlanta.com")]
public partial class QueryBean {
private object[] dataField;
private string[] columnListField;
/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
public object[] data {
get {
return this.dataField;
}
set {
this.dataField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
public string[] columnList {
get {
return this.columnListField;
}
set {
this.columnListField = value;
}
}
}
我的问题是我想从这个服务的结果发送到一个单一的函数,将QueryBean转换为XML节点,我可以传回曾经调用它的任何应用程序。但是当我尝试使用该函数时,它失败了,因为DAM_Search.QueryBean与DAM_Asset.QueryBean不一样。当我尝试将其丢
private XmlDocument Get_AssetInfo(object qBean)
{
DAM_Search.QueryBean qBean2 = (DAM_Search.QueryBean)qBean;
我收到此错误信息
*无法投型“DAM_Service.DAM_Asset.QueryBean”的对象键入“DAM_Service.DAM_Search.QueryBean”。*
有没有一种方法可以强制转换,因为我知道数据类型真的是一样的,还是有方法可以让Web服务对QueryBean类使用相同的类引用?
这是否因为任何人在那里? :-)
添