我已经创建了一些代码来导出Bill和Adjusment屏幕的Application Tab Menu中的记录。我使用下面的代码导出所有记录并存储到DataGridView:
public Form1()
{
InitializeComponent();
username = Properties.Settings.Default.username;
password = Properties.Settings.Default.password;
url = Properties.Settings.Default.url;
serverDb = Properties.Settings.Default.serverDb;
dbName = Properties.Settings.Default.dbName;
userDb = Properties.Settings.Default.userDB;
passDb = Properties.Settings.Default.passDB;
}
private void btnFindRefNbr_Click(object sender, EventArgs e)
{
dgvRefNbrPre.Rows.Clear();
sCon.getLogin(username, password, url, context);
AP301000Content billSchema2 = context.AP301000GetSchema();
billSchema2.DocumentSummary.Type.Commit = false;
billSchema2.DocumentSummary.Type.LinkedCommand = null;
var command2 = new Command[]
{
new Value { Value = "Bill", LinkedCommand = billSchema2.DocumentSummary.Type},
new Value { Value = "1700020537", LinkedCommand = billSchema2.DocumentSummary.ReferenceNbr},
billSchema2.Applications.DocTypeDisplayDocType,
billSchema2.Applications.ReferenceNbrDisplayRefNbr,
billSchema2.Applications.Balance,
billSchema2.Applications.AmountPaid
};
//var applications = context.AP301000Submit(command2).ToList();
var applications = context.AP301000Export(command2, null, 0, false, true);
int rowApp = applications.Count();
int ab = 0;
foreach (var data in applications)
{
string docTypeApp = data[0].ToString();
string refNbrApp = data[1].ToString();
string balanceApp = data[2].ToString();
string amountPaid = data[3].ToString();
dgvRefNbrPre.Rows.Add();
dgvRefNbrPre.Rows[ab].Cells[0].Value = ab.ToString();
dgvRefNbrPre.Rows[ab].Cells[1].Value = docTypeApp;
dgvRefNbrPre.Rows[ab].Cells[2].Value = refNbrApp;
dgvRefNbrPre.Rows[ab].Cells[3].Value = balanceApp;
dgvRefNbrPre.Rows[ab].Cells[4].Value = amountPaid;
ab++;
}
sCon.getLogout(context);
}
public void getLogin(string username, string password, string url, Screen context)
{
context.CookieContainer = new System.Net.CookieContainer();
context.Timeout = 1000000;
context.Url = url;
LoginResult login = context.Login(username, password);
}
public void getLogout(Screen context)
{
context.Logout();
}
此代码在我的本地PC实例中运行良好。 我尝试在另一个实例中实现上面相同的代码,并运行此代码,但它不起作用。
wsdl of instance 1 : http://localhost/SGL2016/(W(1))/Soap/SGLI.asmx,
wsdl of instance 2 : http://202.182.186.133:82/SGLI/Soap/SGLI.asmx,
wsdl of instance 3 : http://localhost/AcuSGL/(W(1))/Soap/SGLI.asmx,
仅在实例1的wsdl中工作。在wsdl 2和3中它没有用。