我有一个方法GetDetailByNo的服务,它将id号作为输入参数并将个人详细信息作为输出
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
DIT_DLH.DIT_WCFService.GetDetailByNoResponse DIT_DLH.DIT_WCFService.RequestDALPortType.GetDetailByNo(DIT_DLH.DIT_WCFService.GetDetailByNoRequest request) {
return base.Channel.GetDetailByNo(request);
}
public object GetDetailByNo(long REQUESTID) {
DIT_DLH.DIT_WCFService.GetDetailByNoRequest inValue = new DIT_DLH.DIT_WCFService.GetDetailByNoRequest();
inValue.REQUESTID = REQUESTID;
DIT_DLH.DIT_WCFService.GetDetailByNoResponse retVal = ((DIT_DLH.DIT_WCFService.RequestDALPortType)(this)).GetDetailByNo(inValue);
return retVal.@return;
}
GetDetailByNoRequest和GetDetailByNoResponse是此服务中的类,如下所示:
public partial class GetDetailByNoRequest {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://dal.req.com", Order=0)]
public long REQUESTID;
public GetDetailByNoRequest() {
}
public GetDetailByNoRequest(long REQUESTID) {
this.REQUESTID = REQUESTID;
}
}
public partial class GetDetailByNoResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://dal.req.com", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public object @return;
public GetDetailByNoResponse() {
}
public GetDetailByNoResponse(object @return) {
this.@return = @return;
}
}
现在在我的客户端代码中,如果我使用
GetDetailByNoResponse retVal = new GetDetailByNoResponse();
retVal = (GetDetailByNoResponse)wcfClient.GetDetailByNo(12345678);
我得到异常“无法将System.Xml.XmlNode转换为GetDetailByNoResponse” 如果我做了
XmlNode xmlnode = (XmlNode)wcfClient.GetDetailByNo(12345678);
或
Object obj=wcfClient.GetDetailByNo(12345678);
我没有 我仍然没有得到个人资料......