2013-03-27 60 views
0

我想從使用遠程API的Catalook下訂單。這裏是我的代碼:Catalook遠程API

CATALooKRemote.RemoteController remote = new CATALooKRemote.RemoteController(); 
    remote.Url = "http://localhost/Customers/DotNetNuke_Community_06.02.04_Install/DesktopModules/CATALooKStore/remote.asmx"; 
    bool log = remote.Login(0, "host", "dnnhost"); 
    Response.Write(log); 
    var orders = remote.GetOrders(new DateTime(2009, 1, 1), new DateTime(2014, 1, 1), -1); 
    foreach (var a in orders) 
    { 

    } 

    //throws null reference exception 
    Response.Write(orders.Count()); 

我在系統中只有一個命令,但使用這種方法,我不能查詢。訂單已付款狀態。

回答

0

我從來沒有使用CATALookRemote服務,但看着WSDL,你不需要傳遞用戶名,密碼和門戶id嗎?

SRVRemote.RemoteControllerSoapClient remote = new SRVRemote.RemoteControllerSoapClient(); 
List<SRVRemote.OrderDetailsRemote> oOrders = null; 
oOrders = remote.GetOrders(System.DateTime.FromOADate(0), System.DateTime.Today, -1, 0, "MyUsername", "MyPassword"); 
foreach (SRVRemote.OrderDetailsRemote order in oOrders) { 
    //Do something 
} 
+0

對於GetOrders,您必須添加用戶名和密碼。對於GetInvoices,您不需要用戶名和密碼。 – 2013-03-27 21:36:11