...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Preface
In Microsoft Dynamics 365 Business Central the extension model is object-based; .
You create new objects, and extend existing objects depending on what you want your extension to do. The underlying Mobile WMS source code is now sealed and can no longer be modified directly.
This necessitated a refactoring of our model for making custom changes to the Xml Resquests and Xml Responses that is being communicated between the mobile devices and the Mobile WMS backend in Business Central. As a part of this refactoring, we are introducing new "accessor" layer to manipulate the Xml content, but with no need to manipulate the Xml Documents directly as to date.
Info |
---|
Requires MOB5.00 for Business Central (or newer). If you are looking for the C/SIDE documentation, visit our Dynamics NAV library |
Past model (C/SIDE)
Historically changes to Xml Responses Changes to XML Response was made directly in Mobile WMS document hander handler codeunits, e.g. codeunit "MOB WMS Receive" etc.
Changes implied writing directly to the Xml XML output, and required knowledge of the xml XML element, a case sensitive xml tag tags and using a correct namespacenamespaces.,
Example:
// The choices are: None, Warn, Block
// MobXMLMgt.AddElement(XMLOrderLine, 'UnderDeliveryValidation', 'Warn', BaseDataModelNS, XMLCreatedNode);
MobXMLMgt.AddElement(XMLOrderLine, 'UnderDeliveryValidation', 'Block', BaseDataModelNS, XMLCreatedNode);
New model (AL)
Changes to Xml XML Responses now requires a new Event Subscriber procedure procedures to be declared in your own code.
Changes are now strictly in your own project, and the underlying Mobile WMS source code is no longer modified. You
You can subscribe to (among others) a number of new "OnAfterSetFrom"-events that is now published by the Mobile WMS app, The documention of exact available events can be found in the API Document Handlers documentationof "On After Set From XXX"-events .
Rather than manipulating the Xml output directly, values is now set in new "accesssor table" that hides all underlying Xml considerations. By using Set/Get accessor methods in these accessor tables, content is automatically formatted and inserted at correct nodes and namespaces in the Xml documents.
Example:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Receive", 'OnGetReceiveOrderLines_OnAfterSetFromAnyLine', '', true, true)]
procedure OnReceiveOnAfterSetFromAnyLine(_RecRef: RecordRef; var _BaseOrderLineElement: Record "MOB Ns BaseDataModel Buffer")
begin
// Under-/OverDeliveryValidation - The choices are: None, Warn, Block
_BaseOrderLineElement.Set_UnderDeliveryValidation('Block');
end;
Accessor class (C#)
New "accessor tables" has been introduced to Mobile WMS. The accessor tables concept is derived from C# property classes.
...
Properties have many uses: they can validate data before allowing a change; they can transparently expose data on a class where that data is actually retrieved from some other source, such as a database; they can take an action when data is changed, such as raising an event, or changing the value of other fields.
Example, C# syntax
Code Block | ||||
---|---|---|---|---|
| ||||
class Person { private string name; // the name field public string Name // the Name property { get { return name; } set { name = value; } } } |
Accessor table (AL)
In AL, codeunits (the AL equivalent for C# classes) cannot be parameters to procedures/methods, unlike in C# (newer BC versions indeed supports codeunits as parameters, but this is not the case for every BC version we support). This makes AL codeunits a poor choice when temporary data needs to be stored and transferred between codeunits and procedures. Instead, we have introduced new "accesssor tables" in Mobile WMS, basically being C# style acccessor classes, but implemented at table level.
Three new accessor tables has been introduced. Each table corresponds to a specfic part of the Mobile WMS Xml schema, and makes available get/set accessors for each node in corresponding namespaces.
- table 6181380 "MOB Ns Resp Element"
- table 6181381 "MOB Ns BaseDataModel Element"
- table 6181382 "MOB Ns WhseInquery Element"
...
"MOB Ns Resp Element" is the most simple of those, and includes only get/set-methods for one predefined property "description". Also, every accessor table includes get/set-methods to add custom elements not being a part of the standard schema, including as CDATA elements:
- Get_description(): Text
- Set_description(NewValue: Text)
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
SetValueAsCData(_PathToSet: Text; _NewXmlCData: XmlCData)
SetValueAsCData(_PathToSet: Text; _NewCDataValue: Text)
Ns BaseDataModel Element (Accessor table, AL)
The "MOB Ns BaseDataModel Element" is used to build "<BaseOrder>" and "<BaseOrderLine>" elements in the BaseDataModel namespace. It is the most frequently used new accessor table by far. All 'GetXXXOrdes" and "GetXXXOrderLines" requests will make this accessor table available from a number of new "OnAfterSetFrom[...]"-events.
...
... for new (custom) tags:
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
SetValueAsCData(_PathToSet: Text; _NewXmlCData: XmlCData)
SetValueAsCData(_PathToSet: Text; _NewCDataValue: Text)
Ns WhseInquiry Element (Accessor table, AL)
The "MOB Ns WhseInquiry Element" is used to build "<LookupResponse>"-elements in the WarehouseInquiryDataModel namespace. It is used from the "MOB WMS Lookup" codeunit.
...
... for new (custom) tags with no preexisting Get/Set-methods:
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
SetValueAsCData(_PathToSet: Text; _NewXmlCData: XmlCData)
SetValueAsCData(_PathToSet: Text; _NewCDataValue: Text)