Connected Service AWAIT

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 3 ans
I have imported  WSDL and my connected service is sending request to our internal systems.
I can see on internal server log that a response is being sent back to our test NOP website.
I am unable to access data within plugin I am developing.  I suspect it is because the logic continues on before response is received.

Can someone tell me the proper syntax to create a way to wait until response is received?

Here is my current code -

    [HttpPost]
        public ActionResult Backorder(BackorderModel model)
        {
            RBKOR.Ibkor_PwsClient client = new Ibkor_PwsClient();
            RBKOR.ROU_INQCLKResponse rclient = new ROU_INQCLKResponse();
            client.ROU_INQCLKAsync(model.CustNum);
            model.TdataIn = rclient.RESULT;
            model.Success="Did it "+ model.CustNum + rclient.RESULT + model.TdataIn ;
            return View("~/Plugins/Widgets.AmtLion/Views/_Backorder.cshtml", model);
        }

**  client.ROU_INQCLKAsync(model.CustNum);  is the line that sends data to our internal system.
    model.TdataIn = rclient.RESULT; is what should contain the result.

When I hover over client.ROU_INQCLKAsync(model.CustNum); I get the following suggestion, just can't get it to work.

(awaitable) System.Threading.Tasks.Task<ROU_INQCLKResponse> ibkor_PwsClient.ROU_INQCLKAsync(string FIELDNAME)
Il y a 3 ans
Hi there,

if your internal system supports async and await, you could convert your method which is calling your internal method into a Task method that returns a Task.

Otherwise, you'll have to look into using threading for waits and so forth.
Il y a 3 ans
I ended up using .Result on the call.  This is not async but it does do what I need to do.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.