So I have an external C# class project that I consume a soap connection and get 3 pieces of data back. Which I would like to pass back from the call I make in the class in X code. Below I was the boolean that I get back from the call and the coopfunds and amffunds that return a decimal number.
public void GetBillToInfo(str Billto) { ExternalWebServices.GetBDFFund GetBDFFund = new ExternalWebServices.GetBDFFund(); real CoopFunds = 0; real AMFFunds = 0; String50 errorMsg; var fund = ""; var tempFund = GetBDFFund.GetMichelinFunds(Billto, CoopFunds, AMFFunds, errorMsg); return tempFund; }
You seem to making a set of artificial problem. Using a class is much easier.
For example:
public MichelinInfo GetMichelinFunds(String billto) { BasicHttpBinding httpBinding = new BasicHttpBinding(); EndpointAddress endPoint = new EndpointAddress(@"http://xxx.channel-fusion.com/asmx/FundByDealerNumber.asmx"); var soapClient = new FundByDealerNumberSoapClient(httpBinding, endPoint); MichelinInfo data = new MichelinInfo(); try { decimal coopFunds = 0; decimal amfFunds = 0; str strError = ''; data.Success = soapClient.AvailableFunds(billto, ref coopFunds, ref amfFunds, ref strError, pass); data.CoopFunds = coopFunds; data.AMFFunds = amfFunds; } finally { if (soapClient) { soapClient.Close(); } } return data; }
Usage from X :
public void getBillToInfo(str _billto) { ExternalWebServices.GetBDFFund getBDFFund = new ExternalWebServices.GetBDFFund(); ExternalWebServices.MichelinInfo michelinInfo = getBDFFund.GetMichelinFunds(_billto); real coopFunds = michelinInfo.CoopFunds; real amfFunds = michelinInfo.AMFFunfs; }
My issue is getting the right type between the C# class project and the d365 X type. I am trying to use an array, but since its a system type and x is not is not complying.
Error Cannot implicitly convert from type 'System.String[' to type 'str['.
c# class object
public string[] GetMichelinFunds(String billto, decimal CoopFunds, decimal AMFFunds, string strError) { BasicHttpBinding httpBinding = new BasicHttpBinding(); EndpointAddress endPoint = new EndpointAddress(@"http://xxx.channel-fusion.com/asmx/FundByDealerNumber.asmx"); string[] michelinInfo = new string[3]; var soapClient = new FundByDealerNumberSoapClient(httpBinding, endPoint); michelinInfo[0] = soapClient.AvailableFunds(billto, ref CoopFunds, ref AMFFunds, ref strError, pass).ToString(); michelinInfo[1] = CoopFunds.ToString(); michelinInfo[2] = AMFFunds.ToString(); soapClient.Close(); return michelinInfo; }
x method:
public void GetBillToInfo(str Billto) { ExternalWebServices.GetBDFFund GetBDFFund = new ExternalWebServices.GetBDFFund(); real CoopFunds = 0; real AMFFunds = 0; String50 errorMsg; String30 michelinInfo[]; michelinInfo = GetBDFFund.GetMichelinFunds(Billto, CoopFunds, AMFFunds, errorMsg); }
The usual way in object-oriented programming is creating an object with three values and returning this object.
André Arnaud de Cal...
291,969
Super User 2025 Season 1
Martin Dráb
230,842
Most Valuable Professional
nmaenpaa
101,156