Share this link

    Home / Tradeshift Documentation / Tradeshift Partner Apps / Babelway / Chapter 4. Channels

    Message Definition Formats: Part 2

    2324 0 Created on 2020-10-28 10:08:51; Last updated on 2022-07-01 13:01:36

    JSON Message Format

    JSON Wizard screen allows you to define your JSON message format according to your own file format.

    JSON (JavaScript Object Notation) is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for many languages. JSON format is often used for serializing and transmitting structured data for web applications.

    The following properties are available:

    Sample: An example of JSON file handled by this message definition

    To define a message in JSON format, select an existing template or make a copy of the generic JSON wizard in the catalogue and the following screen will be displayed.

    File sample

    Below is a sample of JSON file:

    

    The following properties are available:

    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    Note: Regarding the Messages Out of type JSON each field in the last level of the tree will have a "type" attribute that will store the type to this field that will be used to validate the generated output message.

    For example: Below is the tree of the above mentioned JSON file. The "type" attribute for the field "ppu" is float. This means that the generated output message for the "ppu" field will be validated if its value is a float value, as shown below:

    Message Out of type JSON

    If the input message for this field has a value of "75" or "8.5", the messages will be processed successfully. If the message has "Cake" value, which is a string, then the processed message will fail in error: Unparseable number: "Cake". This is because the value of "Cake" is string, not a float.

    Below are the values that can be used in the "type" attribute (int, float, string, Boolean, array).

    Rest Message Format

    

    The output format (json, xml or csv) will be chosen according to the metadata rest_output_format. Note that this metadata is automatically set if you use a REST Gateway IN in your channel.

    The following properties are available:

    • CSV delimiter character: The character that is used to separate the fields, when generating CSVs.
    • Quote character: The character that is used to quote the special characters, when generating CSVs.
    • Headers: Tells if the csv files must begin with a line that contains the headers of the columns.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    In order to use them in any output format, there are some limitations about the message definition tree that you can use:

    • Only the first two levels of the tree is used when asking for CSV output format. If the tree has at least 2 levels (beside the root node), the first level tags will be mapped into rows of the CSV, and the second level into columns. If the tree has only one level, fields will be only mapped into columns.
    • If you use a CSV with headers, headers will be automatically calculated based on the element names of the first row.

    Here is an example of an output file in the 3 formats:

    


    

    

    

    

    SAP IDOC Message Format

    SAP IDOC are the well-known SAP interchange format. You can obtain the definition parser directly from SAP. In order to do this, select the transaction WE63. Select Basic type or Extended Type according IDoc extensions usage.

    IDOC parser sample

    Below is a sample of SAP IDOC file:

    

    The following properties are available:

    • Idoc parser: The Idoc parser.
    • Output Charset: Output Charset is used to encode the file.
    • Input Charset:  Input Charset is used to decode the file.
    • Sample: An example of SAP IDOC file handled by this message definition.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    Not Defined Message Format

    Not Defined message format is used when there is no need to define the format of Message In and Out, because no processing will be performed on it as no change is required.

    For formats not natively supported by Babelway: Advanced users have the option to upload programmatic code that provides support to proprietary message formats, such as specific binary ERP format (for example idoc of SAP...)

    If the Message In format is "Not defined", so should be the Message Out. Otherwise the output may return an unexpected result or an empty message.

    Usually, this setting is used in combination with No Transformation in a channel that simply transfers an unchanged and unprocessed message from one gateway to another.

    • Output Character Set: Output Charset is used to encode the file. Leave empty to keep the file as is.
    • Input Character Set:  Input Charset is used to decode the file. Leave empty to keep the file as is.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    Generic Message Format

    Generic Wizard screen allows you to define your generic message format according to your own file format.

    The following properties are available:

    • Output Charset: Output Charset is used to encode the file.
    • Input Charset:  Input Charset is used to decode the file.
    • ConverterClass: ConverterClass is used to parse the file.
    • Sample: An example of the file handled by this message definition.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    UBL

    OASIS Universal Business Language (UBL) is the product of an international effort to define a royalty-free library of standard electronic XML business documents such as purchase orders and invoices.

    File sample

    Below is a sample of UBL file:

    <?xml version="1.0" encoding="UTF-8"?>
    <Catalogue xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2" xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2 ../UBL 2.1 schema/maindoc/UBL-Catalogue-2.1.xsd">
    	<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    	<cbc:CustomizationID>urn:www.cenbii.eu:transaction:biicoretrdm019:ver2.0:extended:urn:www.peppol.eu:bis:peppol1a:ver2.0</cbc:CustomizationID>
    	<cbc:ProfileID>urn:www.cenbii.eu:profile:bii01:ver2.0</cbc:ProfileID>
    	<cbc:ID>1234</cbc:ID>
    	<cbc:ActionCode listID="ACTIONCODE:PEPPOL">Add</cbc:ActionCode>
    	<cbc:Name>Peppol Catalogue</cbc:Name>
    	<cbc:IssueDate>2013-08-01</cbc:IssueDate>
    	<cbc:VersionID>1</cbc:VersionID>
    	<cac:ValidityPeriod>
    		<cbc:StartDate>2013-09-01</cbc:StartDate>
    		<cbc:EndDate>2014-12-31</cbc:EndDate>
    	</cac:ValidityPeriod>
    	<cac:ReferencedContract>
    		<cbc:ID>3299-8RA</cbc:ID>
    		<cbc:ContractType>Framework</cbc:ContractType>
    	</cac:ReferencedContract>
    	<cac:ProviderParty>
    		<cac:PartyIdentification>
    			<cbc:ID schemeID="GLN">579000123002</cbc:ID>
    		</cac:PartyIdentification>
    		<cac:PartyName>
    			<cbc:Name>Office AS</cbc:Name>
    		</cac:PartyName>
    	</cac:ProviderParty>
    	<cac:ReceiverParty>
    		<cbc:EndpointID schemeID="NO:ORGNR">99156827</cbc:EndpointID>
    		<cac:PartyIdentification>
    			<cbc:ID schemeID="NO:ORGNR">99572527</cbc:ID>
    		</cac:PartyIdentification>
    		<cac:PartyName>
    <cbc:Name>DIFI</cbc:Name>
    		</cac:PartyName>
    	</cac:ReceiverParty>
    	<cac:CatalogueLine>
    		<cbc:ID>1</cbc:ID>
    		<cbc:ActionCode listID="ACTIONCODE:BII2">Add</cbc:ActionCode>
    		<cbc:OrderableIndicator>true</cbc:OrderableIndicator>
    		<cbc:OrderableUnit>BX</cbc:OrderableUnit>
    		<cbc:OrderQuantityIncrementNumeric>1</cbc:OrderQuantityIncrementNumeric>
    		<cbc:MinimumOrderQuantity>1</cbc:MinimumOrderQuantity>
    		<cac:RequiredItemLocationQuantity>
    			<cac:Price>
    				<cbc:PriceAmount currencyID="NOK">20.00</cbc:PriceAmount>

    The following properties are available:

    • Sample: An example of UBL file handled by this message definition.
    • Document type: Type and version of the UBL document. Automatically detected from the provided sample
    • Profile and customization: UBL Profile and UBL customization reference used to validate the UBL document. Automatically detected from the provided sample
    • Disable UBL Validation: Some business rules related to the document profile and customization are automatically validated. Click here to disable this validation.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    By using UBL message definition, you will get benefit of UBL XSD validation and schematron validation for some of the UBL Profile and Customization (OpenPEPPOL, ePrior)

    RosettaNet

    The RosettaNet standard is based on XML and defines message guidelines, interfaces for business processes, and implementation frameworks for interactions between companies. Mostly addressed is the supply chain area, but also manufacturing, product and material data, and service processes are within scope.

    The following properties are available:

    • RosettaNet process type: The message definition will represent a PIP action or a RNIF signal. Please select it in the list.
    • Disable Rosetta net Validation: Some business rules related to the process type are automatically validated. Click here to disable this validation.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    0 people found this helpful.

    Related Articles