Wm6 Template migration Failed Segment Delimiter cannot be null

I’m attempting to upgrade our EDI process (which isn’t in production yet) to 6.0.1, in order to take advantage of the new generateFA service, among other things.

Anyway, I’m following the instructions to convert my existing flat file templates to Flat File Schemas (as outlined on page 101 of the Integration Platform Guide 6.0.1) and have run into a snag.

I get the following error: “Failed: Segment Delimiter cannot be null” when trying to “migrate” (step 7/8 on p 102) my fixed length flat file templates.

The templates worked fine for translating the fixed length data into a record via wm.b2b.edi:convertToValues, and translating the record structure to a fixed length file via wm.b2b.edi:convertToString under 4.6.

any suggestions? The relevant parts of my template are:
<?xml> (should be a version=“1.0” in there - forum strips it)
<positional_flat_file_template>
<segment-delimiter>
<fixed>10</fixed>
<keyword/>
<offset/>
</segment-delimiter>
<field-delimiter>
<fixed/>
<keyword/>
<offset/>
</field-delimiter>
<sub-field-delimiter>
<fixed/>
<keyword/>
<offset/>
</sub-field-delimiter>

Never mind - the issue was with how I “Put” the templates into the package (step 3a) - I was mapping a level too high. Once I realized that, everything worked mostly smoothly.

Thanks wmUsers - typing out the problem helped me solve it :wink:

Hopefully I can save someone else the trouble of figuring it out somewhere down the line.

Suggestion -

Did you think of moving out of the EDI templates. webMethods have started using SEF files and Flatfile Schemas and apparently is a replacement for the templates which we used to define it manually in Pre-6.0 version. Ofcourse, the services convertToValues and convertToString support templates but I see in their sample files, that they are using Flatfile Schemas generated out of EDI SEF files.

Hi, Greg

Could you show us how you “Put” the templates into the package (the actual flow if you will)?

We are having problem to use the migrate tool to convert our flat file template created in version 4.6.

If the template was put by the flow in Maping2HigherLevel attachment, When we migrate it, we get error “Segment Delimiter cannot be null”.

If the template was put by the flow in Maping2LowerLevel attachment, When we migrate it, we get error “java.lang.NullPointerException”.

Any suggestion will be appreciated.
Thank you very much

Min

Maping2HigherLevel
Map2HigherLevel.htm (0.3 k)

Maping2LowerLevel
Map2LowerLevel.htm (0.3 k)

Wow - I didn’t think to check back in this thread (since my problem was solved)

Anyway, Min - to further explain what I did wrong, then what I did to fix it…

In order to load a template, what I had been doing was:
pub.file:getFile
pub.web:stringToDocument
pub.web:documentToRecord

Mapping documentToRecord’s boundNode to a record called “EDITemplate”

I set up those steps as a service called “pcsGetTemplate” which took parameters to specify which file I wanted to load etc.

Then, to store the template into the template manager, I did the following:
pcsGetTemplate
wm.b2b.edi.templateMgr:putTemplate

The trick was to see what putTemplate was expecting, by calling
wm.b2b.edi.templateMgr:getTemplate and comparing the pipeline with the result of pcsGetTemplate.

After performing a “pcsGetTemplate” successfully, the pipeline contained a record called “EDITemplate” which contained a subrecord called “positional_flat_file_template” which is the top level in my template xml document above. wm.b2b.edi.templateMgr:getTemplate was just returning a template object, without the extra level.

To get it to work, I mapped EDITemplate.positional_flat_file_template to the templateObject parameter of wm.b2b.edi.templateMgr:putTemplate

This has allowed me to migrate my templates over to 6.0.1

A couple of warnings though - first, the Flat File Schema that is generated by the migration tool does not bring over ordinality (ie, it treats everything as a single occuring record) To fix that, go through your template xml file, looking for all occurences of “,” in the loops, and set the occurences of that record to “Unlimited”

Also, the schema will contain all the individual records at the top level. Basically, it doesn’t do a very good job of parsing out the meaning of the Loops section of the template.

There are other subtle differences that I’m slowly working my way through too.

Hope this helped.

Hi, Greg

Thank you very much for the reply. I tried to put our template the way you described here but when I use the migrate tool in WmEDI package, I still got NullPointerException.

I just wonder if the template itself have problems. Could you take a look at our template and see if you can convert it with the migration tool?

Thanks again for your help!

Flat File Template
TemplateForFreightBill_v4.xml (4.7 k)

Well, I’ve never used a record with no ID before, so I’m not sure how it works… One quick thing that I noticed is that your loop doesn’t have any segments - <seg-id>recordWithNoID</seg-id> should be inside your Loop tags.

I’ll give it a quick run through my setup and see if it works or not.

That seemed to import just fine after I added in the <seg-id> tags (note that it has to be upper case, but the message board nicely converts it to lower case for me.)

Good luck, and let me know how you do with it.

Thank you very much. It worked.

Just one thing guys!

We donot see putTemplate service in our wmEDI package. Is there something that we are missing? Or is this a restricted service?
Can you help us locate the service so that we can use it for migrating templates from 4.6 to 6.01

Thanks !

putTemplate is 4.6 only - they’ve removed it from 6.0.1 so that people won’t use templates anymore, and will migrate to flatfile schemas.

I am running the template migration against a positional file and getting the error below; template is shown below also. I have successfully been able to migrate templates where specific lengths of fields are defined.

ERROR:
EDIFFSchema.FlatFile_CargillNATLSKleinschmidt.V2:TFFTemplateCLM_HEADER
Failed: No fields defined

TEMPLATE:
<?xml>
<fftemplate>
<field-delimiter>
<fixed>32</fixed>
<keyword/>
<offset/>
</field-delimiter>
<sub-field-delimiter>
<fixed/>
<keyword/>
<offset/>
</sub-field-delimiter>
<segment-delimiter>
<fixed>10</fixed>
<keyword/>
<offset/>
</segment-delimiter>
<segment>
<field>
<field>
<field>
<field>
<field>
<field>
<field>
<field>
</segment>

<segment/>

<loop>
<seg-id>#CLMDATA</seg-id>
</loop>

<loop/>

</fftemplate>


com.wm.app.b2b.server.ServiceException: No fields defined
at wm.b2b.edi.parse.migration.SegmentHolder$ASegment.<init>(SegmentHolder.java:239)
at wm.b2b.edi.parse.migration.SegmentHolder.<init>(SegmentHolder.java:47)
at wm.b2b.edi.parse.migration.MigrateTemplate.<init>(MigrateTemplate.java:94)
at wm.b2b.edi.migration.migrateTemplate(migration.java:582)
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)