web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

The type or namespace name 'SalesOrderServiceClient' could not be found

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I am trying to expose SO using C#. I want to create sales orders in Ax2012 using a .net application. When I started writing code in C# I was getting error of missing type or namespace.

Error 1 The type or namespace name 'SalesOrderServiceClient' could not be found (are you missing a using directive or an assembly reference?) c:\users\mactoresadmin.trendsutra\documents\visual studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 15 9 WindowsFormsApplication1

Below are the references that I am using in my application:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

Please suggest a solution.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    When you added a service reference, it created a namespace with the name.

    For example, if the namespace of your solution is WindowsFormsApplication1 and the reference is called ServiceReference1, add using WindowsFormsApplication1.ServiceReference1.

  • Community Member Profile Picture
    on at

    Thanks for the promplt reply. I have added the reference now and the error is gone. But now the reference for "AxdSalesOrder" is the problem.

    The type or namespace name 'AxdSalesOrder' could not be found (are you missing a using directive or an assembly reference?)

    I have tried updating the service reference, re-adding the reference. Also tried generating full CIL and AOS restart after that. Is there something that I have missed?

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Maybe there is no AxdSalesOrder at all - it doesn't have to be. Please look at the right type of the parameter where you're trying to use an AxdSalesOrder, or the return value that you're trying to assign to a AxdSalesOrder variable.

  • Community Member Profile Picture
    on at

    AxdSalesOrder is the document service class which is used to receive the sales orders coming from other (integration) system.

    I am referring the code mentioned in the below link:

    msdn.microsoft.com/.../ff628055(v=ax.50).aspx

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Yes, I know, that's what I'm talking about.

    Please follow the advice in my previous reply.

  • Community Member Profile Picture
    on at

    Hi Martin,

    I am using the same code from the provided link and the reference in VS to the document service. Also, there is no customization in the standard service. Hence, there shouldn't be any possibility of difference in the parameter provided or the return type accepted.

    I have also tried refreshing the document service. I believe there is something else that I am missing here.

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    All right, if you don't believe me, it would still be wise to look at the type. If you have the solution open in front of you, it's matter of seconds. I ask you one more time to do it, in your own interest. You might find that your create() operation accepts an array of entities, instead of a single Axd object. Or you'll proof that this is all right; then we'll look at what other bug you have in your code.

    By the way, the blog post's been written for on older version of AX.

  • Community Member Profile Picture
    on at

    Thanks a lot Martin. Yes, I was referring the code for Ax2009 as it's quite widely spread on the internet. Now i have removed AxdSalesOrder from the code and using the create() method directly. Thanks for your patience.

  • OrangeRocks Profile Picture
    700 on at

    The code would be as below:

    CallContext context = new CallContext();
    
    ...fill your context.fields here...
    
    salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine };
    AxdEntity_SalesTable[] salesArr = new AxdEntity_SalesTable[1] { salesTable};
               
     try
     {
         // Call the create method on the service passing in the document.
         EntityKey[] returnedSalesOrderEntityKey = proxy.create(context, salesArr );       ...
    }
    


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans