locked
CRM 2013 BizTalk RRS feed

  • Question

  • In CRM 2013 Online, I am trying to call a BizTalk webservice through a plugin. However, online only runs plugins in the sandbox mode. Whenever I try to call the webservice, I get a 'System.Net.WebPermission' error. I keep reading that 'localhost' cannot be used and will cause the error, but I cannot get it to work when using the actual name rather than 'localhost'. It says there is no endpoint listening. Here is an excerpt of my plugin code using 'localhost'...

                //if the target account type isn't "account" exit
                if (accountEntity.LogicalName != "account")
                {  
                    //System.Diagnostics.EventLog.WriteEntry("Application","Target is not 'account' type", System.Diagnostics.EventLogEntryType.Error);  
                    return;
                }
                //Entity acctImage = context.PostEntityImages["PostEventImage"];
                string acctName = accountEntity["name"].ToString(); 
                //string acctNumber = accountEntity["accountnumber"].ToString(); 
                //string state = accountEntity["address1_stateorprovince"].ToString(); 
                //string phone = accountEntity["telephone1"].ToString();
                
                AcctChangeSvc.AccountChangeEvent acct = new AcctChangeSvc.AccountChangeEvent(); 
                acct.EventSource = "Dynamics CRM"; 
                acct.AccountName = acctName; 
                //acct.AccountNumber = acctNumber; 
                //acct.PrimaryState = state;
                //acct.PrimaryPhoneNumber = phone;
                BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
                            
                EndpointAddress addr = new EndpointAddress("http://localhost/AccountChangeService/AccountChangeService.svc");
                AcctChangeSvc.AccountChangeServiceClient client = new AcctChangeSvc.AccountChangeServiceClient(binding, addr);
                
                client.PublishAccountChange(acct); 

    Anyone find a workaround for this?


    • Edited by crmforde Wednesday, April 23, 2014 7:25 PM
    Wednesday, April 23, 2014 7:21 PM