目前我正在研究一个crm项目。在这个项目中,我必须将数据发送到Web服务并获取精确的数据。这个操作必须在自定义工作流程上工作,但我陷入困境,我不知道该怎么做?有什么建议吗?
Here is my service code;
var tmpIncident = getIncidentById(organizationServiceContext);
if (tmpIncident != null) //if we have decent incident we connect service and proceed the data.
{
GetCustomerInfoService.TransactionServiceClient client = new GetCustomerInfoService.TransactionServiceClient();
GetCustomerInfoService.TransactionRequest request = new GetCustomerInfoService.TransactionRequest();
#region authentication
request.AuthenticationData.UserName = "user";
request.AuthenticationData.Password = "pass";
#endregion
Guid id = Guid.NewGuid(); //create random guid
request.RequestId = id.ToString();
request.OrderNumber = tmpIncident.vrp_ordernumber;
GetCustomerInfoService.TransactionResponse response = client.GetTransactionByOrderNumber(request);
tmpIncident.CustomerId = new EntityReference("Contact", new Guid(response.Message));
this.updateChanges(organizationServiceContext, tmpIncident);
client.Close();
}
当我测试插件时,我收到了该错误;
错误讯息:
未处理的异常:System.InvalidOperationException:无法在ServiceModel客户端配置部分中找到引用合同“GetCustomerInfoService.ITransactionService”的默认端点元素。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。
在System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint,String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName,EndpointAddress address)
在System.ServiceModel.ChannelFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ConfigurationEndpointTrait
1.CreateSimplexFactory()
在System.ServiceModel.ClientBase 1.CreateChannelFactoryRef(EndpointTrait
1 endpointTrait)
在System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
在Vrp.Crm.PluginLibrary2013.GetCustomerInfoService.TransactionServiceClient..ctor()in:第0行
在Vrp.Crm.PluginLibrary2013.CustomWorkflows.SetCumstomerIdToIncident.Execute(CodeActivityContext context)c:\ Veripark \ Projects \ gisik \ DRCRM.VERITOUCH.CRM2013 \ PluginLibrary2013 \ CustomWorkflows \ CheckSubIncidentForMainIncident.cs:第72行
在System.Activities.CodeActivity.InternalExecute(ActivityInstance实例,ActivityExecutor执行器,BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor,BookmarkManager bookmarkManager,Location resultLocation)
答案 0 :(得分:0)
假设您正在使用Dynamics CRM。这是一个高级概述:
我希望这足以让你走上正确的道路。