0

我有一个 ASMX Web 服务,并且有一个返回 ArrayList 的方法。它工作正常,但我不知道如何从客户端代码中获取 Array 项。这是asmx方法

[WebMethod]
public ReturnParcel[] getConStrings(string dbType)
{
   var OdbName = GetSetting(document, "Odbname");
   var OuserName = GetSetting(document, "Ousername");
   var Opassword = GetSetting(document, "Opassword");
   if (dbType == "Oracle")
   {
      return new ReturnParcel[] {new ReturnParcel { DBName = OdbName, UserID = OuserName, Password = Opassword },};
   }
   else
   {
      return new ReturnParcel[] {new ReturnParcel { DBName = SdbName, UserID = SuserName, Password = Spassword },};
   }
}

public class ReturnParcel
{
   public string DBName { get; set; }
   public string UserID { get; set; }
   public string Password { get; set; }
}

客户代码:

 WebServiceProxy.OraSPDataXchange objServiceClient = new WebServiceProxy.OraSPDataXchange();
 objServiceClient.Url = "http://portal.mydomain.local/_layouts/SPCustomWS/OraSPDataXchange.asmx";

 objServiceClient.getConStrings("Oracle");

检查客户端代码的最后一行..我需要获取返回值..所以需要知道如何在这里获取它..

4

1 回答 1

2

我假设

var receivedConnectionStrings = objServiceClient.getConStrings("Oracle");

会将结果放入receivedConnectionStrings变量中。

于 2013-03-17T15:26:41.327 回答