How to use Call Context in AIF web service in AX 2009 ? Does AX 2009 support call context ?

In AX 2012 we are using call context

SalesOrderServiceClient proxy = new SalesOrderServiceClient();

CallContext context = new CallContext();

context.Company = “dat”;

but how can we use this in AX 2009 ?

I know that you haven’t been satisfied with this answer, but I still think that SetHeader_DestinationEndpoint() is the right way.

Hi Martin,

I followed the link below but still i am not able to create SO in particular company.

rogue-technology.com/blog/2011/02/setting-custom-aif-headers-when-using-wcf/

Can you please help me how to use this in my scenario

In Visual Studio the code is as follows…

ServiceReference2.

SalesOrderServiceClient

proxy;

proxy =

new ServiceReference2.SalesOrderServiceClient

();

AxdSalesOrder salesOrder = new AxdSalesOrder

();

AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable

();

salesTable.CurrencyCode =

“INR”

;

salesTable.CustAccount =

“100010”

;

salesTable.DeliveryDate =

Convert.ToDateTime(“3/25/2013”

);

salesTable.PurchOrderFormNum =

“POFN”

;

salesTable.CustGroup =

“Springfiel”

;

AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine

();

salesLine.ItemId =

“00122”

;

salesLine.SalesQty = 1;

salesLine.SalesUnit =

“floor”

;

AxdEntity_InventDim inventDim = new AxdEntity_InventDim

();

salesLine.InventDim =

new AxdEntity_InventDim

[1] { inventDim };

salesTable.SalesLine =

new AxdEntity_SalesLine

[1] { salesLine };

salesOrder.SalesTable =

new AxdEntity_SalesTable

[1] { salesTable };

ServiceReference2.

EntityKey

[] returnedSalesOrderEntityKey = proxy.create(salesOrder);

ServiceReference2.

EntityKey returnedSalesOrder = (ServiceReference2.EntityKey

)returnedSalesOrderEntityKey.GetValue(0);

Response.Write(

"The sales order created has a Sales ID of "

  • returnedSalesOrder.KeyData[0].Value);

}

http://

You still didn’t set the destination endpoint.

I have an issue pls guide to resolve it. i want to create sales order service in AIF using c #. I have written code but i get exception issue. My exception issue is " ‘System.InvalidOperationException’ occurred in System.Xml.dll". pls guide me i will attach code . I am new to ax so pls give brief explanation.

class Program

{

static void Main(string[] args)

{

ServiceReference1.SalesOrderServiceClient client = new ServiceReference1.SalesOrderServiceClient();

ServiceReference1.AxdSalesOrder salesorder = new ServiceReference1.AxdSalesOrder();

ServiceReference1.CallContext callcontext = new ServiceReference1.CallContext();

ServiceReference1.EntityKey[] keys;

ServiceReference1.EntityKey key = new EntityKey();

ServiceReference1.KeyField fld = new KeyField();

ServiceReference1.AxdEntity_SalesTable salestable = new ServiceReference1.AxdEntity_SalesTable();

salestable.CustAccount = “1101”;

salestable.PurchOrderFormNum = “PO”;

salestable.ReceiptDateRequested = System.DateTime.Today;

salestable.CurrencyCode = “USD”;

salestable.DeliveryDate = System.DateTime.Today;

salestable.Payment = “N030”;

salestable.DlvMode = “10”;

ServiceReference1.AxdEntity_SalesLine salesline = new ServiceReference1.AxdEntity_SalesLine();

salesline.ItemId = “1000”;

salesline.SalesQty = 5;

salesline.SalesUnit = “ea”;

salesline.SalesPrice = 2000;

salestable.SalesLine = new ServiceReference1.AxdEntity_SalesLine[] { salesline };

salesorder.SalesTable = new ServiceReference1.AxdEntity_SalesTable[] { salestable };

callcontext.Company = “ceu”;

callcontext.Language = “en-us”;

keys = client.create(callcontext, salesorder);

Console.WriteLine(“success”);

pls help me to solve that exception issue and reason fr issue and hw to overcome it. and say abt setdestinationendpoint.