| At line 1 changed 1 line. |
| !!!Defining a Delimiter List |
| This Wiki page is obsolete. |
| At line 3 removed 160 lines. |
| As an example, we shall create a delimiter list for the simple Encoder structure shown in the following figure. |
| __Figure 1-14 Sample Encoder Tree__ |
| [{Image src='Sample_Schema_Tree.gif' width='' height='' align='left|center|right' }] |
| !To create a delimiter list |
| 1 In the XSD Editor, select the node for which you want to define a set of delimiters (this example uses the __root__ node, which is designated Element_1). By default, the value for the {{Node Type}} property is set to {{delimited}} and the value for the {{Delimiter List}} property appears as {{not specified}}. |
| %%information |
| Note - The {{Node Type}} values for elements and fields also are {{delimited}} by default, so they automatically pick up the delimiters specified for their ancestors unless you define new delimiter lists for them.\\ |
| %% |
| 2 Click the ellipsis (…) button in the {{Delimiter List}} value field to display the Delimiter List Editor, which is initially blank. |
| 3 Click {{Add Level}} to add a level to the delimiter list, then click {{Add Delimiter}} to add a delimiter to the selected level. Click in the {{Bytes}} field to activate it for editing and type in the delimiter characters. |
| 4 Press {{Enter}} to set the delimiter value. The list should appear as shown in the following figure. |
| __Figure 1-15 Delimiter List Editor - Add Delimiter__ |
| [{Image src='E1_DLE_PipeEntered.gif' width='' height='' align='left|center|right' }] |
| 5 Continue adding levels and delimiters as required, as shown in the following figure. |
| __Figure 1-16 Delimiter List Editor - Add Levels and Delimiters__ |
| [{Image src='E1_DLE_3LevelsEntered.gif' width='' height='' align='left|center|right' }] |
| 6 Click {{OK}} to close the editor and save your work. |
| 7 The value for the {{Delimiter List}} property will now indicate the number of delimiter levels that are specified, as shown in the following figure. |
| __Figure 1-17 Element_1 - Delimiters Specified__ |
| [{Image src='E1_Enc_Props_Set.gif' width='' height='' align='left|center|right' }] |
| 8 The properties for Element_2 are displayed in the following figure. It automatically picks up the delimiters for __Level 2__, since the existing delimiter list is defined for Element_1. Defining another delimiter list here would override the existing list. |
| __Figure 1-18 Element_2 Properties__ |
| [{Image src='E2_Enc_Props_NotSet.gif' width='' height='' align='left|center|right' }] |
| 9 Leave the {{Node Type}} property for Field_1 set to {{delimited}}; it automatically picks up the delimiters for __Level 3__ from the list defined for Element_1, as displayed in the following figure. Again, the {{Delimiter List}} property remains {{not specified}}. |
| __Figure 1-19 Field_1 Properties__ |
| [{Image src='F1_Enc_Props_NotSet.gif' width='' height='' align='left|center|right' }] |
| 10 Once you have defined your delimiter list, you should test the Encoder to verify that it parses correctly. |
| !!!Validating and Testing the Custom Message Definition |
| !!Validating the Custom Message Definition |
| You can validate the encoding rules, along with the message definition in XML format, by clicking the validation button in the XSD Editor. If encoding rules are present, they are validated following validation of the XML grammar and semantics. An example output showing multiple errors is shown in the following figure. |
| __Figure 1-20 Example Validation Result__ |
| [{Image src='Validation_Example.gif' width='' height='' align='left|center|right' }] |
| !!Testing the Encoder Runtime Behavior |
| The Encoder Tester allows you to test the Encoder's runtime behavior at design time. To display the tester dialog, right-click the XSD file to display its context menu and select {{Encoder > Test}}, as shown in the following figure. |
| __Figure 1-21 Starting the Encoder Tester__ |
| [{Image src='XSD_CMenu_EncTest.gif' width='' height='' align='left|center|right' }] |
| The Test Encoding dialog is shown in the following figure. The various fields are described briefly in the table following the figure. After the Decode test is complete, the result is placed in an XML file inside the current project. This file can then be validated as described in the preceding section. There is no automatic method for validating the Encode result, however. |
| __Figure 1-22 Test Encoding Dialog__ |
| [{Image src='Test_Encoding_Dialog.gif' width='' height='' align='left|center|right' }] |
| __Table 1-12 Test Encoding Dialog Fields__ |
| || Section|| Field Caption|| Description |
| | Meta| Select an Element| Specifies the top-level element whose structure you want to test. |
| | Meta|XSD File| Identifies the XSD file you have selected for testing. |
| | Input| Decode/Encode| Option buttons to select the direction of data flow for the test. Specifies whether encoding or decoding behavior is being tested. |
| | Input|From/To String| Specifies that the input or output data is in string format. If not checked, byte format is assumed. |
| | Input|Data File| Specifies the data file to use in the Decode test. |
| | Input|XML Source File| Specifies the source file to use in the Encode test. |
| | Input|Source/Result Coding| Specifies the encoding of the serialized data. See Data Encoding |
| | Output| File Name| Specifies the file name to use for the test result. |
| | Output|Folder| Specifies the folder in which you want the output file to be placed. |
| | Output|Overwrite Output| Specifies whether or not you want to overwrite any existing output file having the same name. |
| | Output|Created File| Confirms that the output file has been created, along with the location. |
| | Debug| Verbose Level| Specifies the level of detail contained in the log file. The options are:\\- {{None}}\\- {{Info}}\\- {{Fine}}\\- {{Finer}}\\- {{Finest}}\\ |
| !!!Using Custom Encoders in JBI Projects |
| Using a Custom Encoder in a JBI Project is described in the following procedure. |
| !To Use a Custom Encoder in a JBI Project |
| # Import the XSD into a WSDL using the WSDL context menu. |
| # Configure the individual binding component's inbound or outbound message type as {{encoded}} and set the encoding style to {{customencoder-1.0}}. See the following figure as an example. |
| __Figure 1-23 File Message Property Configuration__ |
| [{Image src='File_Msg_Props.gif' width='' height='' align='left|center|right' }] |
| !!!About Data Parsing and Serialization |
| The parsing and serializing operations require data to be in byte-array form, so different methods for encoding and decoding data must be used to accommodate different input and output data formats. These different methods incorporate various stages of character conversion using specific character sets. |
| !!Encoding Process |
| Internally, the encoder requires the data input and output to be in bytes. The encoding process uses the {{serializing charset}}, as illustrated in the following figure. |
| __Figure 1-24 Encoding Process__ |
| [{Image src='Encoder_Coding_marshal.gif' width='' height='' align='left|center|right' }] |
| !!encodeToString() Method |
| The {{encodeToString()}} method requires conversion to produce an output string after encoding from a byte[] field. This method also requires conversion when encoding from a string field, since the parser requires the data in bytes, and conversion again to produce an output string. The {{encodeToString()}} process uses the {{serializing charset}}, as illustrated in the following figure. |
| __Figure 1-25 encodeToString()__ |
| [{Image src='Encoder_Coding_marshalToString.gif' width='' height='' align='left|center|right' }] |
| !!encodeToBytes() Method |
| The {{encodeToBytes()}} method requires conversion to produce bytes after encoding from a string field. Following serialization, this method also requires conversion to produce an output (in bytes) having a different format from that used by the parser. If the same format is desired, then the {{output charset}} is left undefined, the {{serializing charset}} property is substituted by default, and the double conversion is bypassed. The {{encodeToBytes()}} process uses both the {{serializing charset}} and the {{output charset}}, as illustrated in the following figure. |
| __Figure 1-26 encodeToBytes()__ |
| [{Image src='Encoder_Coding_marshalToBytes.gif' width='' height='' align='left|center|right' }] |
| !!encodeToStream() Method |
| Encodes an XML representation of a message into an OutputStream object, encoded in custom format. |
| !!encodeToWriter() Method |
| Encodes an XML representation of a message into a Writer object, encoded in custom format. |
| !!Decoding Process |
| Internally, the decoding process requires conversion when decoding to a string field, since the input is in bytes as required by the parser. The decoding process uses the {{parsing charset}}, as illustrated in the following figure. |
| __Figure 1-27 Decoding Process__ |
| [{Image src='Encoder_Coding_unmarshal.gif' width='' height='' align='left|center|right' }] |
| !!decodeFromString() Method |
| The {{decodeFromString()}} method requires conversion of the input string, since the parser requires the data in bytes. This method requires a second conversion when decoding to a string field. The {{decodeFromString()}} process uses the {{parsing charset}}, as illustrated in the following figure. |
| __Figure 1-28 decodeFromString()__ |
| [{Image src='Encoder_Coding_unmarshalFromString.gif' width='' height='' align='left|center|right' }] |
| !!decodeFromBytes() Method |
| The {{decodeFromBytes()}} method requires conversion if the input data has a different byte format from that used by the parser. If the same format is desired, then the {{input charset}} is left undefined, the {{parsing charset}} is substituted by default, and the double conversion is bypassed. After parsing, this method requires further conversion if decoding to a string field. The {{decodeFromBytes()}} process uses both the {{input charset}} and the {{parsing charset}}, as illustrated in the following figure. |
| __Figure 1-29 decodeFromBytes()__ |
| [{Image src='Encoder_Coding_unmarshalFromBytes.gif' width='' height='' align='left|center|right' }] |
| !!decodeFromStream() Method |
| Decodes an InputStream object encoded in custom format into an XML-encoded message. |
| !!decodeFromReader() Method |
| Decodes a Reader object encoded in custom format into an XML-encoded message. |
| !!Setting Delimiters |
| The following figure illustrates how the delimiter gets set and passed into the parser. |
| __Figure 30 Setting Delimiters__ |
| [{Image src='DelimiterToParser_FlowGFESB.gif' width='' height='' align='left|center|right' }] |
| As an example, if you select a delimiter in the XSD Editor by hex code (such as __\x7C__), it is passed directly into the parser. If you type the delimiter in as a pipe (__|__), however, then the pipe character is first converted to hex code, using the GUI’s encoding, and then sent to the parser. |