Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

CRM 2013 Online - Plugin calling external webservice

$
0
0

Hi

I'm trying to create a POC for at customer, but I think I hit bottom here.

Im trying to connect to an external web service, which is hosted on a internal development server at the moment, through a CRM plugin.

Because the CRM enviroment is Online, my plugin has to be registered in sandbox. 

 When I run the plugin from CRM, Í get the following error:

My code looks like this:

if (context.InputParameters.Contains("Target") &&
                context.InputParameters["Target"] is Entity)
                {
                    Entity sag = (Entity)context.InputParameters["Target"];

                    

                    Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains("PostImage")) ? context.PostEntityImages["PostImage"] : null;
                    OptionSetValue match = (OptionSetValue)postImageEntity["new_match"];
                    if (match.Value == 2)
                    {
                        string[] conditionFields = new string[] { "new_ediibilagndid" };
                        string[] conditionValues = new string[] { postImageEntity.Id.ToString() };

                        EntityCollection ediInds = RetrieveMultiRequest("new_ediind", conditionFields, conditionValues, service);

                        if (ediInds.Entities.Count == 1)
                        {
                            foreach (Entity ediInd in ediInds.Entities)
                            {

                                                                var myBinding = new BasicHttpBinding();
                                myBinding.Security.Mode = BasicHttpSecurityMode.None;
                                EndpointAddress endPointAddress = new EndpointAddress("http://wmsi003755:1234/FacadeService/FacadeService.svc");

                                FacadeService.FacadeServiceClient FSC = new FacadeService.FacadeServiceClient(myBinding, endPointAddress);
                                //---------------------------------
                                string EDICpr = (string)ediInd.Attributes["new_cprnummer"];
                                Money EDIBeloeb = (Money)ediInd.Attributes["new_totaltoverfrtbelb"];

                               // FacadeServiceClient FSC = new FacadeServiceClient(myBinding, endPointAddress);

                                FacadeService.OverfoerelseIndAiaRequest OAR = new FacadeService.OverfoerelseIndAiaRequest();
                                //APPension.Integration.Skema.Depot.OverfoerelseIndAiaRequest OAR = new APPension.Integration.Skema.Depot.OverfoerelseIndAiaRequest();

                                FacadeService.OverfoerelsePalDetaljer[] palListe = new FacadeService.OverfoerelsePalDetaljer[6];
                               // APPension.Integration.Skema.Depot.OverfoerelsePalDetaljer[] palListe = new APPension.Integration.Skema.Depot.OverfoerelsePalDetaljer[6];
                                palListe[0] = createPAL((EntityReference)ediInd.Attributes["new_palrnuvrender"], (Money)ediInd.Attributes["new_palbelbnuvrender"]);
                                palListe[1] = createPAL((EntityReference)ediInd.Attributes["new_palr1"], (Money)ediInd.Attributes["new_palbelbr1"]);
                                palListe[2] = createPAL((EntityReference)ediInd.Attributes["new_palr2"], (Money)ediInd.Attributes["new_palbelnr2"]);
                                palListe[3] = createPAL((EntityReference)ediInd.Attributes["new_palr3"], (Money)ediInd.Attributes["new_palbelnr3"]);
                                palListe[4] = createPAL((EntityReference)ediInd.Attributes["new_palr4"], (Money)ediInd.Attributes["new_palbelbr4"]);
                                palListe[5] = createPAL((EntityReference)ediInd.Attributes["new_palr5"], (Money)ediInd.Attributes["new_palbelbr5"]);

                                FacadeService.OverfoerelseIndAiaPaategning EksternSelskab = new FacadeService.OverfoerelseIndAiaPaategning();
                                //APPension.Integration.Skema.Depot.OverfoerelseIndAiaPaategning EksternSelskab = new APPension.Integration.Skema.Depot.OverfoerelseIndAiaPaategning();

                                EksternSelskab.Kode = "FRI004";
                                EntityReference afgivendeSelskab = (EntityReference)ediInd.Attributes["new_afgivendeselskabsnavn"];
                                EksternSelskab.Selskab = afgivendeSelskab.Name;
                                EksternSelskab.StartDato = (DateTime)ediInd.Attributes["new_oprindeligtegningsdato"];

                                OAR.Cpr = (string)ediInd.Attributes["new_cprnummer"];

                                Money TotalOverfoertBeloeb = (Money)ediInd.Attributes["new_totaltoverfrtbelb"];
                                OAR.DepotBeloeb = TotalOverfoertBeloeb.Value;

                                OAR.InternEkstern = FacadeService.OverfoerelseInternEkstern.Ekstern; //APPension.Integration.Skema.Depot.OverfoerelseInternEkstern.Ekstern;
                                OAR.DepotOverfoerelseFonde = null;
                                OAR.OpsparingDaekninger = null;
                                OAR.Overenskomstnummer = "39170418-001"; //DENNE MANGLER I CRM

                                Money ratePension = (Money)ediInd.Attributes["new_opsparingratepension"];
                                OAR.OverfoertRate = ratePension.Value;
                                OAR.PalDetaljeListe = palListe;
                                OAR.Policenummer = (string)ediInd.Attributes["new_policenummer"];
                                OAR.Proces = FacadeService.OverfoerelseProces.Crm; //APPension.Integration.Skema.Depot.OverfoerelseProces.Crm;
                                OAR.Paategning = EksternSelskab;
                                OAR.SkalVederlagAOpkraeves = false;
                                OAR.SkalVederlagFOpkraeves = false;

                                FacadeService.Identifikation Iden = new FacadeService.Identifikation();
                                //APPension.Integration.Skema.Identifikation Iden = new APPension.Integration.Skema.Identifikation();
                                Iden.Dato = DateTime.Today;
                                Iden.JuridiskId = "112233-44";
                                Iden.Type = FacadeService.BrugerRolle.Kunde; //APPension.Integration.Skema.BrugerRolle.Kunde;

                                FSC.OpretOverfoerelseIndAia(OAR, Iden);

Can anyone see, if this is possible at all?


Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>