调用Cloud发布的webservice接口,连接的时候报错
金蝶云社区-云社区用户G88I1234
云社区用户G88I1234
0人赞赏了该文章 1,527次浏览 未经作者许可,禁止转载编辑于2014年10月10日 11:34:49

public void Save_Material()
{
try
{
ServiceConfig.URL = @"http://localhost/K3CloudServiceInterface/";
var user = new KDUser()
{
AccountId = "db6900daed07bf0e11e44386fc37eb3f",
UserName = "Administrator",
Password = "888888"
};
using (var client = new KDServiceClient(user, ServiceConfig.URL))//执行到此处报错
{
BD_MaterialInfo_Save save = new BD_MaterialInfo_Save();
save.Model = new BD_MATERIAL();
//创建组织
save.Model.FCreateOrgId = new BD_MATERIAL_ORG_Organizations { FNUMBER = "1" };
//使用组织
save.Model.FUseOrgId = new BD_MATERIAL_ORG_Organizations { FNUMBER = "1" };
//编码
save.Model.FNumber = "kkklkl999ddd";
//物料名称
save.Model.FName = "原材ddd999ddd";
save.Model.BD_MATERIAL__SubHeadEntity = new BD_MATERIAL__SubHeadEntity();
// 存货类别,必填
save.Model.BD_MATERIAL__SubHeadEntity.FCategoryID = new BD_MATERIAL_BD_MATERIALCATEGORY();
save.Model.BD_MATERIAL__SubHeadEntity.FCategoryID.FNumber = "CHLB01_SYS";
var ret = client.Send(save);
}
MessageBox.Show("save success");
}
catch (Exception ex)
{
throw ex;
}
}