C# WCF未从服务获取值
我有一个方法为GetDetailByNo的服务,它将id号作为输入参数,并将个人详细信息作为输出C# WCF未从服务获取值,c#,wcf,C#,Wcf,我有一个方法为GetDetailByNo的服务,它将id号作为输入参数,并将个人详细信息作为输出 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] DIT_DLH.DIT_WCFService.GetDetailByNoResponse DIT_DLH.DIT_WCFService.RequestDALPortType.GetD
[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;
}
GetDetailByNoreRequest和GetDetailByNorResponse是此服务中的类,如下所示:
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转换为GetDetailByNorResponse”
如果我这样做了
XmlNode xmlnode = (XmlNode)wcfClient.GetDetailByNo(12345678);
或
我不明白
我仍然没有获得个人详细信息…确切的错误是什么?因此没有错误,但我从服务接收的对象不包含姓名、年龄等个人详细信息的值。
Object obj=wcfClient.GetDetailByNo(12345678);