Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:10:33+00:00 2026-05-30T17:10:33+00:00

I have a Web Service for my ASP.NET MVC 3 app which creates a

  • 0

I have a Web Service for my ASP.NET MVC 3 app which creates a new Sales Order in AX. In AX I have created an OnlineOrder class which has 1 method for now. It is to generate a Sales Reference. Below is the code in my web service:

public AxaptaObject order;

        public void CreateOrder()
        {
            AxaptaStart();
            order = Axapta.CreateAxaptaObject("OnlineOrder");
            AxaptaStop();
        }

        public string GetSalesRef(string username, string delivery, string reference)
        {

            AxaptaStart();
            string number = order.Call("orderCreate", username, delivery, reference).ToString();
            AxaptaStop();
            return number;
        }

Then in my Controller I call these methods:

            client.CreateOrder();

            string number = client.GetSalesRef(user.Username, order.deliverymethod, order.custorder).ToString();

This doesn’t work and there is no exception info to show, its just a blank message. I believe the order AxaptaObject is not of type OnlineOrder so it can’t call those methods. How would I instantiate the object to use the orderCreate method?

EDIT:

If I do:

        public string CreateOrder(string username, string delivery, string reference)
        {
            AxaptaStart();
            order = Axapta.CreateAxaptaObject("OnlineOrder");
            string number = order.Call("orderCreate", username, delivery, reference).ToString();
            AxaptaStop();
            return number;
        }

This works, but this isn’t a valid solution as I’d like to add more methods to my OnlineOrder object in the future and I dont want to call them all in 1 method on my web service

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:10:34+00:00Added an answer on May 30, 2026 at 5:10 pm

    This will never work as the order object is sort of closed when you call the AxaptaStop method.

    I will suggest creating a class implementing IDisposable, then call AxaptaStop in the Dispose method. The AxaptaStart call could go to the constructor. This will allow you to scope the AX context like:

    using (var axWrap = new AxWrap())
    {
        var order = axWrap.onlineOrder();
        var number = axWrap.orderCreate(order, username, delivery, reference);
    }
    

    The Dispose is automatically called by the using statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created Web-Service in asp.net with c# . Now i want to pass
I have an ASP.NET web service which does some heavy lifting, like say,some file
I have an ASP.net web service that I'm using for a web application which
I have an ASP.NET MVC web app whose controllers use WCF to call into
I have an ASP.NET MVC 3 / .NET Web Application, which is heavily data-driven,
I have a basic 3 tier app Presentation/Web (ASP.NET MVC) Application Services (WCF, hosted
Background I have a page on my ASP.NET MVC web app for users to
I have a web service in ASP.NET being called by a time-sensitive process. If
I have a web service in asp.net and I have this model to return:
I'm developing a web service (in asp.net) and I would like to have each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.