[英]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:
这是一个高级概述:
I hope this is enough information to get you heading down the right path. 我希望这足以让你走上正确的道路。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.