24.04.2013, 08:12 | #1 |
Участник
|
emeadaxsupport: How to implement basic authentication with Dynamics Ax 2012 web services
Источник: http://blogs.msdn.com/b/axsupport/ar...-services.aspx
============== Important: This sample is not a production ready solution. As described below the user credentials will be passed in plain text which is not ideal in a production environment. To prevent this from occurring it would be recommended to incorporate SSL with this solution.
Service operations:
proxy.ChannelFactory.Credentials.UserName.UserName = @"domain\user"; proxy.ChannelFactory.Credentials.UserName.Password = @"password"; CallContext context = new CallContext(); context.Company = "ceu"; AxdSalesOrder salesOrder = new AxdSalesOrder(); AxdEntity_SalesTable[] salesTables = new AxdEntity_SalesTable[1]; AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable(); salesTable.CurrencyCode = "USD"; salesTable.CustAccount = "1103"; salesTable.ReceiptDateRequested = Convert.ToDateTime("2/1/2012"); salesTable.Payment = "N060"; salesTable.PurchOrderFormNum = "PO113"; #region Financial Dimensions AxdType_DimensionAttributeValue dimBusinessUnit = new AxdType_DimensionAttributeValue(); dimBusinessUnit.Name = "BusinessUnit"; dimBusinessUnit.Value = "20"; AxdType_DimensionAttributeValue dimCustomerGroup = new AxdType_DimensionAttributeValue(); dimCustomerGroup.Name = "CustomerGroup"; dimCustomerGroup.Value = "10"; AxdType_DimensionAttributeValue dimDepartment = new AxdType_DimensionAttributeValue(); dimDepartment.Name = "Department"; dimDepartment.Value = "500"; AxdType_DimensionAttributeValueSet valueSet = new AxdType_DimensionAttributeValueSet(); valueSet.Values = new AxdType_DimensionAttributeValue[3] { dimBusinessUnit, dimCustomerGroup, dimDepartment }; salesTable.DefaultDimension = valueSet; #endregion AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine(); salesLine.ItemId = "1000"; salesLine.SalesQty = 1; salesLine.SalesUnit = "ea"; AxdEntity_SalesLine salesLine2 = new AxdEntity_SalesLine(); salesLine2.ItemId = "1000"; salesLine2.SalesQty = 55; salesLine2.SalesUnit = "ea"; AxdEntity_SalesLine salesLine3 = new AxdEntity_SalesLine(); salesLine3.ItemId = "10004"; salesLine3.SalesQty = 21; salesLine3.SalesUnit = "Pcs"; AxdEntity_InventDim inventDim = new AxdEntity_InventDim(); inventDim.InventSiteId = "1"; salesLine3.InventDim = new AxdEntity_InventDim[1] { inventDim }; salesTable.SalesLine = new AxdEntity_SalesLine[3] { salesLine, salesLine2, salesLine3 }; salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable }; try { proxy.create(context, salesOrder); MessageBox.Show("Worked"); } catch (Exception ex) { throw ex; }
Источник: http://blogs.msdn.com/b/axsupport/ar...-services.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|