Base solution for your next web application
Open Closed

How to call other service in project #713


User avatar
0
jasuha created

i have two projects in my solution. i wanna call web api method other in project.

i don't wanna call like below code.

var client = new HttpClient() var addressResult = client.PostAsJsonAsync("http://localhost:5655/api/services/app/Address/GetAddressById", addressModel).Result;

Do you have any advice this situation?

Thank you for your help.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    ABP has a IAbpWebApiClient interface to make it simpler. While it needs enhancement, works properly. See demo: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/ConsoleRemoteWebApiCall">https://github.com/aspnetboilerplate/as ... WebApiCall</a>

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    jasuha created

    I solved. Thank you for help

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    billytsoi created

    IAbpWebApiClient only has PostAsync method to send HTTP POST request

    may i know whether it has PUT , GET method as well? If yes can you please give some example? Thanks a lot

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You are right, it does not conitan PUT or GET at the moment but you can implement them easily in your project.

    Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)