AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 27.10.2016, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Schema Validation and AIF Services in Dynamics AX
Источник: https://stoneridgesoftware.com/schem...n-dynamics-ax/
==============

While attempting to create a Transfer Order with the InventInventoryTransferOrderCreateService you may encounter an error similar to this:

The element ‘InvTransTable’ in namespace ‘http://schemas.microsoft.com/dynamic...rCreate’ has invalid child element ‘InventLocationIdTransit’ in namespace ‘http://schemas.microsoft.com/dynamic...rCreate’. List of possible elements expected: ‘InventLocationIdFrom’ in namespace ‘http://schemas.microsoft.com/dynamic...rCreate’.

The problem appears to be that the ‘InventLocationIdTransit’ field doesn’t belong in the document.  If you load the XML and XSD files Visual Studio you can verify the message is valid.



Looking at the XSD, you can see that the asdf field is defined, and allowed to be null.





What isn’t so obvious, is that the previous two fields are required. Both ‘InventLocationIdFrom’ and ‘InventLocationIdTo’ must be specified. The Xml document validation engine is working through the XSD from top to bottom. When it encounters the ‘InventLocationIdTransit’ field it knows it missed ‘InventLocationIdFrom’; but fails to tell you that a required field is missing.

The obvious way to fix the issue is to make sure you specify all required values. There may be times however when your business logic can compensate for missing values. For these scenarios, you can modify the schema so that the fields are no longer mandatory. To do this you need to override the AxInternalBase::initMandatoryFieldsExemptionList() method for your object. In this case, the modified class is AxInventTransferTable.

/// /// Sets fields as non mandatory./// protected void initMandatoryFieldsExemptionList(){ super(); this.setParmMethodAsNotMandatory(methodStr(AxInventTransferTable, parmTransferId)); this.setParmMethodAsNotMandatory(methodStr(AxInventTransferTable, parmInventLocationIdTransit)); this.setParmMethodAsNotMandatory(methodStr(AxInventTransferTable, parmInventLocationIdFrom)); this.setParmMethodAsNotMandatory(methodStr(AxInventTransferTable, parmInventLocationIdTo));}



Источник: https://stoneridgesoftware.com/schem...n-dynamics-ax/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
daxdilip: How to: Configure Dynamics AX AIF Services to listen for SSL Requests (https) Blog bot DAX Blogs 0 23.01.2011 10:12
Dianne Siebold: Microsoft Dynamics AX 2009 Services White Paper Blog bot DAX Blogs 0 03.07.2009 11:05
Creating Custom Dynamics AX Services Blog bot DAX Blogs 0 17.12.2008 12:05
Inside Dynamics AX 4.0: AIF Architectural Overview Blog bot DAX Blogs 0 04.10.2007 11:20

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 21:51.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.