web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Consuming an external service.

(0) ShareShare
ReportReport
Posted on by 535

So I built a class object to be able to consume in a class in D365.

namespace ExternalWebServices
{
    public class GetBDFFund
    {

        public string getXXXFunds(String billto, ref decimal CoopFunds, ref decimal AMFFunds, ref string strError)
        {
            string error = string.Empty;
            decimal AMFFFunds = 0;
            string pass = "ft89UL1aa7P4";
           // BasicHttpBinding httpBinding = new BasicHttpBinding();
            //EndpointAddress endPoint = new EndpointAddress(@"http://XXXdev.channel-fusion.com/asmx/FundByDealerNumber.asmx");

            var soapClient = new XXXSoap.FundByDealerNumberSoapClient();
            var usdToinr = soapClient.AvailableFunds(billto.ToString(), ref CoopFunds, ref AMFFFunds, ref strError, pass);
            return usdToinr.ToString();

        }

    }
}

In the D365 class I am getting an "}" expected at the list reference. I tried using just a simple var and it was giving me the same error. 

using ExternalWebServices;

internal final class ConsumeXXXFunds
{
    ExternalWebServices.GetBDFFund getXXXFunds = new ExternalWebServices.GetBDFFund();

    list funds = new strlist(Types::String);
    funds(0) = getXXXFunds.getXXXFunds("3333");
    Info(strFmt("%1", Funds);
}

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Moved from Dynamics 365 General Forum, because it looks like X , therefore F&O. Let me know if it isn't the case.

    I guess you mean List instead of strlist. Your syntax for adding an element to the list is completely wrong. Let me fix it:

    using ExternalWebServices;
    
    internal final class ConsumeXXXFunds
    {
        ExternalWebServices.GetBDFFund getXXXFunds = new ExternalWebServices.GetBDFFund();
    
        List funds = new List(Types::String);
    	funds.addEnd(getXXXFunds.getXXXFunds("3333"));
    }

    Note that your call of getXXXFunds() is wrong - the method has four parameters and you provided just one.

  • KeithM Profile Picture
    535 on at

    Thank you, yes it's X . I've went back and forth and couldn't get the error to disappear. The fund list variable says it "}" expected. The last 3 parameters of the getXXXFund are references. Which should return my information to my knowledge. I looked into the function and only need a var, but that gives me the same error "}" expected. It should just be a boolean returned.

    using ExternalWebServices;
    
    internal final class ConsumeXXXFunds
    {
        ExternalWebServices.GetBDFFund getXXXFunds = new ExternalWebServices.GetBDFFund();
    
        List funds = new List(Types::String);
    	funds.addEnd(getXXXFunds.getXXXFunds("1002711",0,0,""));
    }

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    The problem with } is that you're trying to use the variable directly in the class declaration, which isn't allowed. You need to create a method and put your code there.

  • KeithM Profile Picture
    535 on at

    Oh lord.... was going back and forth and didn't realize I cut that out.

    I am getting an error saying it, 
    Error Method 'getMichelinFunds(System.String, System.Decimal, System.Decimal, System.String)' is not found on type 'ExternalWebServices.GetBDFFund'. GroupOConsumeSoap (ISV) [Fleet Management K:\AosService\PackagesLocalDirectory\bin\XppSource\FleetManagement\AxClass_ConsumeMichelinFunds.xpp 19"

    Which is odd since I can select it in intelsense. It consumed the .dll just fine and can see the parameters needed.

    fund = GetBDFFund.getXXXFunds("1002711",CoopFunds,AMFFunds,"");

    using ExternalWebServices;
    
    internal final class ConsumeMichelinFunds
    {
    
        public void GetXXXFunds()
        {
    
            ExternalWebServices.GetBDFFund GetBDFFund = new ExternalWebServices.GetBDFFund();
    
            str billto;
            real CoopFunds = 0;
            real AMFFunds = 0;
    
            var fund = "";
            fund = GetBDFFund.getXXXFunds("1002711",CoopFunds,AMFFunds,"");
            Info(strFmt("%1", fund));
        }
    }
    

  • ergun sahin Profile Picture
    8,826 Moderator on at

    Time to time, project references can cause problems. If you have made changes to External Web Services, the reference may not see the change. Did you make any changes?

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    I think the problem is that you declared three parameters with 'ref', but you're passing normal parameters. The system looks for a method compatible with the parameters you passed, and it doesn't find any.

    I recommend not using ref parameters, but if you insist, change your code in GetXXXFunds() to actually use them.

  • KeithM Profile Picture
    535 on at

    I thought it might of been that, but I have tried both ways. 

    class library program:   I recompiled and reapplied to my class in f&o.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using ExternalWebServices.XXXSoap;
    using System.ServiceModel;
    
    namespace ExternalWebServices
    {
        public class GetBDFFund
        {
            public string geXXXFunds(String billto, decimal CoopFunds, decimal AMFFunds, string strError)
            {
                string error = string.Empty;
                decimal AMFFFunds = 0;
                string pass = "ft89UL1aa7P4";
                BasicHttpBinding httpBinding = new BasicHttpBinding();
                EndpointAddress endPoint = new EndpointAddress(@"http://XXXdev.channel-fusion.com/asmx/FundByDealerNumber.asmx");
    
                var soapClient = new FundByDealerNumberSoapClient(httpBinding, endPoint);
                var usdToinr = soapClient.AvailableFunds(billto.ToString(), ref CoopFunds, ref AMFFFunds, ref strError, pass);
                return usdToinr.ToString();
    
            }
    
        }
    }

    Then I changed my isv for the class and method for D365: I still get that error: 
    Error Method 'getMichelinFunds(System.String, System.Decimal, System.Decimal, System.String)' is not found on type 'ExternalWebServices.GetBDFFund'. GroupOConsumeSoap (ISV) [Fleet Management K:\AosService\PackagesLocalDirectory\bin\XppSource\FleetManagement\AxClass_ConsumeMichelinFunds.xpp 19

    using ExternalWebServices.GetBDFFund;
    
    internal final class ConsumeXXXFunds
    {
    
        public void GetXXXFunds()
        {
    
            ExternalWebServices.GetBDFFund GetBDFFund = new ExternalWebServices.GetBDFFund();
    
            str billto = "1002711";
            real CoopFunds = 0;
            real AMFFunds = 0;
    
            var fund = "";
            var tempFund = GetBDFFund.getXXXFunds(billto,CoopFunds, AMFFunds, "");
            Info(strFmt("%1", fund));
        }
    
    }

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    I don't see anything wrong with the method profile, although the fact that the ref parameters are useless looks suspicious at least. You also don't use some variables and calling ToString() on a string isn't very useful.

    Anyway, I have a few ideas about what to check.

    First of all, verify that the names are identical, including letter case. We can't verify that, because you change the names. (More preciselly, we can see that the names don't match, but I assume you made the mistake when obfuscating names before sharing.)

    Make sure you deployed the assembly correctly, especially if you're using a file reference (not a project reference).

    A good idea may be creating a new method for testing purpose, maybe with just a single string parameter. Then you can easily verify that the assembly was updated (because you'll see your new method) and you'll have a simpler case to test.

  • KeithM Profile Picture
    535 on at

    Ok... I adjusted the method in the class library and added a simple string return. To which it didn't pick up when I removed and added in the reference again. All I do is clean and rebuild the class library dll.  Remove it from the F&O project and add the reference back in again from updated dll.

    namespace ExternalWebServices
    {
        public class GetBDFFund
        {
            public string getXXXFunds(String billto, decimal CoopFunds, decimal AMFFunds, string strError)
            {
                string pass = "ft89UL1aa7P4";
                BasicHttpBinding httpBinding = new BasicHttpBinding();
                EndpointAddress endPoint = new EndpointAddress(@"http://XXXdev.channel-fusion.com/asmx/FundByDealerNumber.asmx");
    
                //var soapclient = 
                var soapClient = new FundByDealerNumberSoapClient(httpBinding, endPoint);
                var usdToinr = soapClient.AvailableFunds(billto, ref CoopFunds, ref AMFFunds, ref strError, pass);
                return usdToinr.ToString();
    
            }
    
            public string GetStringInfo(string TestInput)
            {
                return TestInput;
            }
    
        }
    }

    It doesn't find it when try and select it with intelesense.

    4784.Forum1.png

  • KeithM Profile Picture
    535 on at

    Stratch that... it did pick it up and is giving me the same error as the other method.'

    Error Method 'GetStringInfo(System.String)' is not found on type 'ExternalWebServices.GetBDFFund'. GroupOConsumeSoap (ISV) [Fleet Management] K:\AosService\PackagesLocalDirectory\bin\XppSource\FleetManagement\AxClass_ConsumeMichelinFunds.xpp 21

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans