目前我正在做一个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)位于System.ServiceModel.ChannelFactory.InitializeEndpoint(字符串配置名称,EndpointAddress地址)位于System.ServiceModel.ChannelFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ConfigurationEndpointTrait
1.CreateSimplexFactory()位于System.ServiceModel.ClientBase 1.CreateChannelFactoryRef(EndpointTrait
1端点Trait)位于System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()在Vrp.Crm.PluginLibrary2013.GetCustomerInfoService.TransactionServiceClient.ctor()中:第0行位于Vrp.Crm.PluginLibrary2013.CustomWorkflows.SetCumstomerIdToIncident.Execute(CodeActivityContext上下文),位于c:\Veripark\Projects\gisik\DRCRM.VERITOUCH.CRM2013\PluginLibrry2013\CustomWorkflows\CheckSubIncidentForMainIncident.cs:line 72位于System.Activities.CodeActivity.InternalExecute(ActivityInstance实例、ActivityExecutor执行器、BookmarkManager BookmarkManager)在System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor,BookmarkManager BookmarkManager,Location resultLocation)
假设您使用的是Dynamics CRM。这是一个高级概述:
- 创建一个自定义工作流活动,该活动对Web服务进行实际调用。这将帮助您开始:https://msdn.microsoft.com/en-us/library/gg328515.aspx
- 自定义活动将具有输出参数,这些参数将把Web服务的结果返回到调用CRM工作流
- 最后创建工作流及其触发器,以利用您的自定义活动。更多信息:http://crmbook.powerobjects.com/system-administration/processes/workflows/https://msdn.microsoft.com/en-us/library/gg328264.aspx
我希望这些信息足以让你走上正确的道路。