Biztalk 架构允许分隔文件中的可变列数吗?
希亚斯。我有一位客户以平面文件的形式向我们发送订单。该文件实际上并没有任何复杂性,但文件之间存在一些不一致之处。
文件的格式是这样的:
1,2,3[CRLF]
1,2,3[CRLF]
围绕该结构创建模式没有问题,但是有时他们会添加新列。
1,2,3,4[CRLF]
1,2,3,4[CRLF]
不幸的是,他们不会向后级联更改,因此我们希望支持 3 列和 4 列格式。两种格式都可能通过同一管道,因此我实际上无法选择创建单独的模式/管道。他们总是将新字段添加到行的末尾,因此至少是一致的。
我唯一能想到要做的就是创建一个精心设计的“找出适用的模式并相应地路由管道组件”,但在我走这条路之前,我想看看是否有人对使其工作的方法有一些想法使用单个平面文件模式(我尝试将可选列的 minOccurs 属性设置为 0,但这并不好)。
预先感谢您的任何建议。
Hiyas. I have a customer sending orders to us in a flat file. There isn't really any complexity to the file but there are some inconsistencies from file to file.
The format of the file is like this:
1,2,3[CRLF]
1,2,3[CRLF]
No problems creating a schema around that structure, however from time to time they will add a new column.
1,2,3,4[CRLF]
1,2,3,4[CRLF]
Unfortunatly, they don't make their changes cascade backwards so we hare expected to support both the 3 and 4 column formats. Both formats can potentially come through the same pipeline, so i don't really have the option of creating seperate schemas/pipelines. They do always add the new fields to the end of the row, so that much at least is consistent.
The only thiing i can think of to do is to create an elaborate "figure out which schema applies and route accordingly pipeline component", but before I go down that road I wanted to see if maybe anyone had some thoughts on way to make it work with a single flat file schema (I tried to set the minOccurs property of the optional columns to 0, but that was no good).
Thanks in advance for any advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是定义一个“外部”架构,并为您需要支持的不同版本导入架构。 “外部”架构将提供一个
choice
块,其中包含对导入的版本架构的引用。如果您需要添加下一个版本,您只需导入新架构并将其添加到
选择
中。当然,困难的部分是如何确定如何处理不同的版本。也许最简单的方法是为您需要处理的每种专用类型创建一个映射。另一方面,您可以扩展“最新且最好的”内部消息类型并根据消息内容进行决定。
“外部”架构
导入架构“Version_001”
导入架构“Version_002”
(为了便于阅读,省略了一些默认属性)
One way would be to define a "outer" schema and import schemas for the different versions you need to support. The "outer" schema will offer a
choice
block containing references to your imported version schemas.If you need to add the next version you just have to import a new schema and add it to the
choice
.The hard part of course is how you can determine how to process different versions. Maybe the simplest way would be to create a map for every dedicated type you need to handle. On the other hand you could extend a "latest-and-greatest" internal message type and decide based on message content.
"outer" schema
Imported schema "Version_001"
Imported schema "Version_002"
(some default attributes omitted for readability)