开发者

After converting console app to asp.net web app, post is no longer instantaneous

开发者 https://www.devze.com 2023-04-12 00:12 出处:网络
I have a console app which connects to a service reference that allows it to send SOAP calls to a service, which updates information in a separate program that I do not own or control. The console app

I have a console app which connects to a service reference that allows it to send SOAP calls to a service, which updates information in a separate program that I do not own or control. The console app works fine, and here is a bit of code just to give you an idea of what I'm doing.

public static void PlaceOrders(wsCHRUtilsSoapClient client)
    {
        //identifying vars for patient/provider (not part of orders)
        string patientID = "1234";
        string csn = "123456789";
        string orderingUser = "98765";
        string authProvider = "98765";
        string departmentID = "123456";
        string projectKey = "eProj-CDS";
        string messages;

        //Create order samples
        Order oOne = CreateOrder("LAB", "CBCD", "1", "yay its friday", null, null, null, null, null, null, null, "4",
            "13", null, null, null, null, null, null, null, ", , , ", null, null, null, null, null, null, null, null, null);

        ArrayOfOrderOrder orders = new ArrayOfOrderOrder();
        orders.Add(oOne);

        client.PlaceOrders(patientID, csn, orderingUser, authProvider, departmentID, projectKey, orders, out messages);
    }

CreateOrder method just returns an Order object, which is basically a glorified struct containing strings and enums based on strings (suggested by Intellisense so I know they're correct from the service reference). It works splendidly and I can immediately view the posted information on the host program.

Here's the same method in my web app:

public void PlaceOrders(object sender, EventArgs e)
    {
        wsCHRUtilsSoapClient client = new wsCHRUtilsSoapClient("wsCHRUtilsSoap");
        string messages;
        string orderPatID = this.orderPatID.Text;
        string orderCSN = this.orderCSN.Text;
        string orderOrderingUser = this.orderOrderingUser.Text;
        string orderAuthProvider = this.orderAuthProvider.Text;
        string orderDeptID = this.orderDeptID.Text;
        string orderProjKey = this.orderProjKey.Text;

        string strOrderType = this.orderType.Text;
        string orderCode = this.orderCode.Text;
        string strQuantity = this.quantity.Text;
        string comment = this.comment.Text;
        // ...Like 25 more strings that call their respective ASP textboxes...
        string rflPriority = this.rflPriority.Text;
        string processingInstructions = this.processingInstructions.Text;

        ArrayOfOrderOrder orders = new ArrayOfOrderOrder();
        Order order = CreateOrder(strOrderType, orderCode, strQuantity, comment, strFutureStanding, strStandingCount, standingInterval, 
            expirationDate, strAutoRelease, futureExpectedDate, strFutureApproximate, priority, orderClass, strPatientTaking, route, strDaw, 
            strDispenseQuantity, dispenseUnit, strRefill, sig, modifiers, rflFromProviderID, rflToProviderID, rflToFacility, rflToSpecialty, 
            rflType, rflReason, strRflNumVisits, rflPriority, processingInstructions);

        orders.Add(order);

        client.PlaceOrders(orderPatID, orderCSN, orderOrderingUser, orderAuthProvider, orderDeptID, orderProjKey, orders, out messages);
        client.Close();

The web app seems to sporadically update the program. I can't figure out a debug pattern or anything significant for when it works as opposed to when it doesn't. When it does update, it's usually not instantaneous. Can anybody offer any help?? I'm pretty new to C# and ASP.NET so there's a possibility I missed one of the nuances of correctly setting up the web app service reference (though I'm pretty sure I did it the same way for both applications).

Something I forgot that may be worth mentioning: The console app has a Main that just create开发者_运维百科s a client and runs the service, then exits. The web app runs and executes the function after I finish filling out the forms and click an ASP button.


You should make sure that web.config contains the same configuration of your console app's app.config for the service.

And you should verify that you bound the method "PlaceOrders" to some event handler (Button click or any thing else)


As it turns out, it was a problem on the service reference provider's side (though they initially insisted it wasn't). Thanks for all of you input everyone!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号