Hi all,
To create a record in AX2009 from visual studio, do we need to configure aos with vs.
Hi all,
To create a record in AX2009 from visual studio, do we need to configure aos with vs.
I did some quick web search and found for example this discussion: dynamicsuser.net/.../error-while-consuming-ax-2009-web-service-in-external-application
Even though that specific question is not answered, at least you will see how you can control the authentication settings, which are missing in your current code.
Hi Nicolas,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsumeSalesOrderService.SalesOrder;
using System.Collections;
namespace ConsumeSalesOrderService
{
class Program
{
static void Main(string[] args)
{
// Instantiate an instance of the service client class.
SalesOrderService proxy = new SalesOrderService();
// Create an instance of the document class.
AxdSalesOrder salesOrder = new AxdSalesOrder();
// Create instances of the entities that are used in the service and
// set the needed fields on those entities.
AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();
salesTable.CurrencyCode = "USD";
salesTable.CustAccount = "1101";
salesTable.DeliveryDate = Convert.ToDateTime("2/14/2010");
salesTable.Payment = "N060";
salesTable.PurchOrderFormNum = "PO";
AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
salesLine.ItemId = "1001";
salesLine.SalesQty = 88;
salesLine.SalesUnit = "ea";
AxdEntity_InventDim inventDim = new AxdEntity_InventDim();
inventDim.configId = "HD";
inventDim.InventColorId = "01";
inventDim.InventSizeId = "42";
// Add the sub-entity instances to their parent entities as an array
// of the sub-entity type.
salesLine.InventDim = new AxdEntity_InventDim[1] { inventDim };
salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine };
salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable };
try
{
// Call the create method on the service passing in the document.
EntityKey[] returnedSalesOrderEntityKey = proxy.create(salesOrder);
// The create method returns an EntityKey which contains the ID of the sales order.
EntityKey returnedSalesOrder = (EntityKey)returnedSalesOrderEntityKey.GetValue(0);
Console.WriteLine("The sales order created has a Sales ID of " + returnedSalesOrder.KeyData[0].Value);
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadLine();
}
}
}
}
1) I used the above code in Vs, In proxy. create I am getting the exception.
2) This is the first integration for the client, IIs installed for poc purpose.
3)I have an experience in handling integration in ax2012 with the same service but the client is different as they handled already enabled IIs and no issues in connecting , but in ax2009 configuration is different .
Could you share any more details with us?
You said that your code is failing - would it be possible to see the code?
What service are you connecting to?
Have you ever developed similar integrations before or is this your first one?
Hi Nicolos,
I googled plenty of forum but it doesn't solve my issue .As I am using the standard entity not sure why it failed and what is the cause for that issue.
Ah, so your question is about connecting Visual Studio to a web service that his hosted on the AOS.
To me it seems that VS can initiate connection to the AOS, so that's not your issue. Otherwise it could not try to authenticate and fail. Seems that you're trying to connect to the service without authentication (Anonymous) but that's not supported.
You should be able to find plenty of discussion and examples on how to connect to AX2009 web services with .Net application. Here are some: www.google.com/search
Hi Nicolas,
1) In the same server AX and Visual studio is running, but there is no connectivity between 2application as we recently installed vs in the server.
2) I am able to ping the customer service URL in IE, it's working fine I can able to see the schema.
3) When I try to create a customer from Vs by adding the URL in-service reference, I am getting the authentication error." The HTTP request is unauthorised with the client scheme Anonymous".
4) I am thinking it might be an issue with the missing connection with Aos, I don't think there will be an issue in the IIS configuration because I can ping the URL in IE.
5) when I debug the c#code exactly in calling the service operation I am getting the above exception.
Why would you like to create a record from Visual Studio?
Could you tell us a bit more background?
Since you mention Visual Studio, you must be in a development system.
If you want to create record in a development system, you should normally use:
- Normal AX forms
- Table browser (in AOT)
- Data export / import by Definition groups
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,407
Most Valuable Professional
nmaenpaa
101,156