简体   繁体   English

通过crm工作流程调用Web服务

[英]Call Web Service via crm workflow

Currently i'm working on a crm project. 目前我正在研究一个crm项目。 In this project i have to send data to web service and take refined data back. 在这个项目中,我必须将数据发送到Web服务并获取精确的数据。 This operation must be work on custom workflow but i'm stuck infact i have no idea how to do it? 这个操作必须在自定义工作流程上工作,但我陷入困境,我不知道该怎么做? Any suggestions? 有什么建议么?

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();
        } 

When i tested plugin, i received that error; 当我测试插件时,我收到了这个错误;

Error Message: 错误信息:

Unhandled Exception: System.InvalidOperationException: Could not find default endpoint element that references contract 'GetCustomerInfoService.ITransactionService' in the ServiceModel client configuration section. 未处理的异常:System.InvalidOperationException:无法在ServiceModel客户端配置部分中找到引用合同“GetCustomerInfoService.ITransactionService”的默认端点元素。 This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. 这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。 at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName) at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) at System.ServiceModel.ChannelFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.ConfigurationEndpointTrait 1.CreateSimplexFactory() at System.ServiceModel.ClientBase 1.CreateChannelFactoryRef(EndpointTrait 1 endpointTrait) at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef() at Vrp.Crm.PluginLibrary2013.GetCustomerInfoService.TransactionServiceClient..ctor() in :line 0 at Vrp.Crm.PluginLibrary2013.CustomWorkflows.SetCumstomerIdToIncident.Execute(CodeActivityContext context) in c:\\Veripark\\Projects\\gisik\\DRCRM.VERITOUCH.CRM2013\\PluginLibrary2013\\CustomWorkflows\\CheckSubIncidentForMainIncident.cs:line 72 at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityEx System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint,String configurationName)的System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName,EndpointAddress address)at 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()at Vrp.Crm.PluginLibrary2013.GetCustomerInfoService.TransactionServiceClient..ctor( )在:系统中的c:\\ Veripark \\ Projects \\ gisik \\ DRCRM.VERITOUCH.CRM2013 \\ PluginLibrary2013 \\ CustomWorkflows \\ CheckSubIncidentForMainIncident.cs:第72行中的Vrp.Crm.PluginLibrary2013.CustomWorkflows.SetCumstomerIdToIncident.Execute(CodeActivityContext context)中的第0行。 Activities.CodeActivity.InternalExecute(ActivityInstance实例,ActivityEx ecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor,BookmarkManager bookmarkManager,Location resultLocation)中的ecutor执行程序,BookmarkManager bookmarkManager)

Assuming that you are using Dynamics CRM. 假设您正在使用Dynamics CRM。 This is a high-level overview: 这是一个高级概述:

  1. Create a custom workflow activity that makes the actual call to the webservice. 创建一个自定义工作流活动,以实际调用Web服务。 This should help you get started: https://msdn.microsoft.com/en-us/library/gg328515.aspx 这应该可以帮助您入门: https//msdn.microsoft.com/en-us/library/gg328515.aspx
  2. The custom activity would have output parameters that would return the results from the webservice back to the calling CRM workflow. 自定义活动将具有输出参数,该参数将从Web服务返回到调用CRM工作流的结果。
  3. Finally create the workflow and its triggers that would make use of your custom activity. 最后创建工作流及其触发器,以利用您的自定义活动。 More info: http://crmbook.powerobjects.com/system-administration/processes/workflows/ https://msdn.microsoft.com/en-us/library/gg328264.aspx 更多信息: http//crmbook.powerobjects.com/system-administration/processes/workflows/ https://msdn.microsoft.com/en-us/library/gg328264.aspx

I hope this is enough information to get you heading down the right path. 我希望这足以让你走上正确的道路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM