从ASMX Web服务获取RETURN值

时间:2012-07-23 08:46:38

标签: c#

是否可以从asmx web服务获取返回值,我有以下代码:

[WebMethod(CacheDuration = 0)]
public System.Xml.XmlDocument Load_DOK(System.Xml.XmlDocument XmlDoc)   
  {
  }

INPUT参数是XML DOCUMENT,返回消息必须是格式化的SOAP消息,如下所示:

 soapEnvelop.LoadXml(@"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Body><Response_status>0</Response_status><Description>SUCCESS</Description></soap:Body></soap:Envelope>");
return soapEnvelop;

这是一个带参数传递给Web服务的调用:

System.Xml.XmlDocument ReceivingXmlDoc = new System.Xml.XmlDocument();
 TestService.TestService ws_dok = new TEST.TestService.TestService();

 ws_dok.Load_DOK(SendingXmlDoc);

那么可以提取该回报吗?

谢谢!

2 个答案:

答案 0 :(得分:0)

这应该就这么简单:

XmlDocument receivingXmlDoc = ws_dok.Load_DOK(sendingXmlDoc);

答案 1 :(得分:0)

是的,因为您已经声明了webmethod Load_DOK to return as XmlDocument

XmlDocument doc=  ws_dok.Load_DOK(SendingXmlDoc);