Open Closed

Unable to call service from javascript via Dynamic Client Proxy #3173


User avatar
0
Spospisil created
  • ABP Framework version: v5.2.1
  • UI type:MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Tiered

I am not able to call an ABP service directly from Javascript. It appears as if my ABP Service is not being included in the ServiceProxyScript that gets loaded. Steps to reproduce issue.

  • Run the DB migrator to create DB
  • Log in as admin
  • Go to the dashboard page
  • At the bottom of the dashboard page is a button with the caption 'Save'
  • Push the Save button to call the javascript code block below.

$('#CallFunctionButton').click(function (e) { structureWeb.companyTenant().then(function (result) { console.log(result.items); }); });


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I removed the project link because the project includes your commercial license. I also suggest you make the project private.

    I will check it.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You are using tiered project, so you need to create an API Controller for AppService.

    Like we do: https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs

  • User Avatar
    0
    Spospisil created

    Hi,

    Any chance you can note in the online documentation that if you are using a tiered project auto-api controllers (via application services) are not an option so others do not waste their time trying to get it to work?

    Thanks.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We mentioned it in the best practices document https://docs.abp.io/en/abp/latest/Best-Practices/Module-Architecture#http-layer

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11