Biztalk Schema用于给定合作伙伴的不同角色 [英] Biztalk Schema for varying role for a given partner

查看:115
本文介绍了Biztalk Schema用于给定合作伙伴的不同角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Biztalk Schema用于给定合作伙伴的不同角色

背景:我有Biztalk 2010,SQL2008R2后端。我有Biztalk的平面文件源,如下所示。字段分隔I和记录分隔< CR > < LF > < /跨度>。
ENV | prt198623083932 | ...
PAR | TGL | 01 | 104 | D05 |合作伙伴名称1 ....
ROL | TGL | 01 | 104 | Role1 ...
ROL | TGL | 04 | 104 | Role2 ...
PAR | TGL | 01 | D104001 | D05 |合作伙伴2 ...
ROL | TGL | 01 | D104001 |角色1 ...
PAR | TGL | 01 | 104 | D052 |合作伙伴名称3 ....
ROL | TGL | 01 | 1042 | Role1 ...
ROL | TGL | 04 | 1042 | Role2 ...
ROL | TGL | 01 | 1042 | Role3 ...
ROL | TGL | 04 | 1042 | Role4 ...

一个ENV头,带有不同角色的PAR。角色至少为1,最大值无限制。

无论我对Min,Max,Group Sequence等做什么,架构都不会识别变化的伙伴ROL。感谢您的帮助。

我使用了Biztalk标准工具并创建了一个模式来导入记录。它如下。为了简单起见,我暂时保留了详细信息标准信息,并专注于合作伙伴和角色序列组模式。

谢谢,Toraj - toraj.khavari@gmail.com

- < xs:sequence minOccurs = 1 maxOccurs = 无界 >
- < xs:annotation >
- < xs:appinfo >
< groupInfo xmlns = http://schemas.microsoft.com/BizTalk/2003 sequence_number = 2 / >
< / xs:appinfo >
< ; / xs:annotation >
- < xs:element minOccurs = 0 maxOccurs = 无界 名称 = WraperPartnerRole >
- < xs:annotation >
- < xs:appinfo >
< b:recordInfo 结构 = 分隔符 preserve_delimiter_for_empty_data = true suppress_trailing_delimiters = false sequence_number = 1 < span class =code-attribute>
/ >
< / xs:appinfo >
< / xs:annotation >
- < xs:complexType >
- < xs:sequence >
- < xs:annotation >
- < xs:appinfo >
< b:groupInfo sequence_number = 0 / >
< / xs:appinfo >
< / xs:annotation >
- < xs:element maxOccurs = 无界 名称 = 合作伙伴 < span class =code-keyword>>
- < xs:annotation >
- < xs:appinfo >
< b:recordInfo tag_name = PAR 结构 = delimited child_delimiter_type = char child_delimiter = < span class =code-keyword> | child_order = 前缀 preserve_delimiter_for_empty_data = true suppress_trailing_delimiters = false notes = I)每个消息文件必须具有文件as one Patner segment。 II) 每个 消息 file < span class =code-attribute> 包含 多个 Patner 细分, 一个 per 每个 env。 sequence_number = 1 / >
< / xs:appinfo >
< / xs:annotation >
- < xs:complexType >
- < xs:sequence >
- < xs:annotation >
- < xs:appinfo >
< groupInfo sequence_number = 0 xmlns = http://schemas.microsoft.com/BizTalk/2003 / >
< / xs:appinfo >
< / xs:annotation >
- < xs:element 名称 = 客户端 type = xs:string >
- < xs:annotation >
- < xs:appinfo >
< b:fieldInfo 对齐 = left sequence_number = 1 / >
< / xs:appinfo >
< ; / xs:annotation >
< / xs:element >
- < xs:element 名称 = PartnerType type = < span class =code-keyword> xs:string
>
- < xs:annotation >
- < xs:appinfo >
< b:fieldInfo 理由 = left sequence_number = 2 / >
< / xs:appinfo >
< / xs:annotation >
< / xs:element >
- < xs:element 名称 = < span class =code-keyword> PartnerReference type = xs:string >
- < span class =code-keyword>< xs:annotation >
- < xs:appinfo >
< b:fieldInfo 对齐 = left sequence_number = 3 / >
< / xs:appinfo >
< / xs:annotation >
< / xs:element >
.......
- < xs:element name = UserName type = xs:string >
- < xs:annotation >
- < xs:appinfo >
< b:fieldInfo 对齐 = left sequence_number = 26 / >
< / xs:appinfo >
< / xs:annotation >
< ; / xs:element >
- < xs:element < span class =code-attribute> name = 日期 类型 = xs:string >
- < xs:annotation >
- < xs:appinfo >
< b:fieldInfo 对齐 < span class =code-keyword> = left sequence_number = 27 < span class =code-attribute> / >
< / xs:appinfo >
< / xs:annotation >
< / xs:element >
- < xs:element name = 时间 type = xs:string >
- < ; xs:annotation >
- < xs:appinfo >
< b:fieldInfo 理由 = left sequence_number = 28 < span class =code-attribute> / >
< / xs:appinfo >
< / xs:annotation >
< / xs:element >
< / xs :sequence >
< / xs:complexType >
< / xs:element >
- < xs:element maxOccurs = 无界 名称 = 角色 >
- < xs:annotation >
- < xs:appinfo >
< b:recordInfo tag_name = ROL 结构 = 分隔符 child_delimiter_type = char child_delimiter = | child_order = 前缀 preserve_delimiter_for_empty_data = true suppress_trailing_delimiters = false notes = 每个 合作伙伴 一个 更多 < span class =code-attribute>Role segment。 sequence_number = 2 / >
< / xs:appinfo >
< / xs:annotation >
- < xs:complexType >
- < xs:sequence >
- < xs:annotation >
- < xs:appinfo >
< groupInfo sequence_number = 0 xmlns = http://schemas.microsoft.com/BizTalk/ 2003 / >
< / xs:appinfo < span class =code-keyword>>
< / xs:annotation >
- < xs:element name = 客户端 类型 = xs:string >
- < xs:annotation >
- < xs:appinfo >
< b:fieldInfo 对齐 = left sequence_number = < span class =code-keyword> 1 / >
< / xs:appinfo >
< / xs:annotation >
< / xs :element >
- < xs:element name = PartnerRoleType 类型 = xs:string > ;
- < xs:annotation >
- < xs:appinfo >
< b:fieldInfo 对齐 = left sequ ence_number = 2 / >
< / xs:appinfo >
< / xs:annotation >
< / xs:element >
.. ..
- < xs:element 名称 = 日期 type = xs:string >
- < xs:annotation >
- < xs:appinfo >
< ;b:fieldInfo justification=\"left\" sequence_number=\"6\" />
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name=\"Time\" type=\"xs:string\">
- <xs:annotation>
- <xs:appinfo>
<b:fieldInfo justification=\"left\" sequence_number=\"7\" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs :sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>

解决方案

Hi: 
After working at this for a while, there i s no easy solution to it than good old XSLT Loop inside a loop. Here what I finally did and working in production.
Cheers, Toraj
<xsl:for-each select=\"../Partner\">
<ns0:Record-XMNREF0 xmlns:ns0=\"urn:ProcessPartner\">
<ns0:Col-CLIENT>
<xsl:value-of select=\"Client/text()\" />
</ns0:Col-CLIENT>
<ns0:Col-NRTYPE>
<xsl:value-of select=\"PartnerType/text()\" />
</ns0:Col-NRTYPE>
<ns0:Col-NRNREF>
<xsl:value-of select=\"PartnerReference/text()\" />
</ns0:Col-NRNREF>
<ns0:Col-NRPGRP>
<xsl:value-of select=\"PartnerGroup/text()\" />
</ns0:Col-NRPGRP>
<ns0:Col-NRNAME>
<xsl:value-of select=\"PartnerName/text()\" />
</ns0:Col-NRNAME>
<ns0:Col-NRADR1>
<xsl:value-of select=\"AddressLine1/text()\" />
</ns0:Col-NRADR1>
...
<ns0:Col-NRDATE>
<xsl:value-of select=\"Date/text()\" />
</ns0:Col-NRDATE>
<ns0:Col-NRTIME>
<xsl:value-of select=\"substring(Time, 1, 4)\" />
</ns0:Col-NRTIME>

<!-- Patner Reference -->
<xsl:variable name =\"prtRef\" select=\"PartnerReference/text()\"/>
<xsl:for-each select=\"../Role\" >
<!-- Role Reference -->
<xsl:variable name=\"refRef\" select=\"string(Reference)\"/>
<xsl:if test=\"(


refRef =


prtRef)\">
<!--Put the Role information inside the current Partner node only if Role belong to current Partner-->
<ns0:Record-XMNIRL0 xmlns:ns0=\"urn:ProcessPartner\">
<ns0:Col-CLIENT>
<xsl:value-of select=\"Client/text()\" />
</ns0:Col-CLIENT>
<ns0:Col-NITYPE>
<xsl:value-of select=\"PartnerRoleType/text()\" />
</ns0:Col-NITYPE>
<ns0:Col-NINREF>
<xsl:value-of select=\"Reference/text()\" />
</ns0:Col-NINREF>
......
<ns0:Col-NIDATE>
<xsl:value-of select=\"Date/text()\" />
</ns0:Col-NIDATE>
<ns0:Col-NITIME>
<xsl:value-of select=\"substring(Time, 1, 4)\" />
</ns0:Col-NITIME>
</ns0:Record-XMNIRL0>
</xsl:if>
</xsl:for-each>

</ns0:Record-XMNREF0>
</xsl:for-each>


Biztalk Schema for varying role for a given partner

Background: I have Biztalk 2010, SQL2008R2 backend. I have flat file source to Biztalk which looks as follows. Field delimited "I" and Record Delimited "<CR><LF>".
ENV|prt198623083932|…
PAR|TGL|01|104|D05|Partner Name 1….
ROL|TGL|01|104|Role1 …
ROL|TGL|04|104|Role2 …
PAR|TGL|01|D104001|D05|Partner 2 …
ROL|TGL|01|D104001|Role 1 …
PAR|TGL|01|104|D052|Partner Name 3….
ROL|TGL|01|1042|Role1 …
ROL|TGL|04|1042|Role2 …
ROL|TGL|01|1042|Role3 …
ROL|TGL|04|1042|Role4 …

One ENV header, PAR with Varying Roles. Roles are at minimum 1 and maximum are unbounded.

Regardless of what I do with Min, Max, Group Sequence etc. the schema does not recognizes the varying partner "ROL". Appreciate your help.

I have used Biztalk standard tools and created a schema to import the records. It is as follows. To keep it simple, I keep the details standard information out for now and focus on the Partner and Role Sequence Group schema.

Thanks, Toraj – toraj.khavari@gmail.com

- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:annotation>
- <xs:appinfo>
  <groupInfo xmlns="http://schemas.microsoft.com/BizTalk/2003" sequence_number="2" />
  </xs:appinfo>
  </xs:annotation>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="WraperPartnerRole">
- <xs:annotation>
- <xs:appinfo>
  <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" />
  </xs:appinfo>
  </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:annotation>
- <xs:appinfo>
  <b:groupInfo sequence_number="0" />
  </xs:appinfo>
  </xs:annotation>
- <xs:element maxOccurs="unbounded" name="Partner">
- <xs:annotation>
- <xs:appinfo>
  <b:recordInfo tag_name="PAR" structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" notes="I) Each message file must have at least one "Patner" segment. II) Each message file can contain multiple "Patner" Segments, but only one per each "env"." sequence_number="1" />
  </xs:appinfo>
  </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:annotation>
- <xs:appinfo>
  <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
  </xs:appinfo>
  </xs:annotation>
- <xs:element name="Client" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="1" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:element name="PartnerType" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="2" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:element name="PartnerReference" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="3" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
.......
- <xs:element name="UserName" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="26" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:element name="Date" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="27" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:element name="Time" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="28" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <xs:element maxOccurs="unbounded" name="Role">
- <xs:annotation>
- <xs:appinfo>
  <b:recordInfo tag_name="ROL" structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" notes="Each "Partner" segment will have one or more "Role" segment." sequence_number="2" />
  </xs:appinfo>
  </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:annotation>
- <xs:appinfo>
  <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
  </xs:appinfo>
  </xs:annotation>
- <xs:element name="Client" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="1" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:element name="PartnerRoleType" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="2" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
....
- <xs:element name="Date" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="6" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:element name="Time" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="7" />
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:sequence>

解决方案

Hi:
After working at this for a while, there is no easy solution to it than good old XSLT Loop inside a loop. Here what I finally did and working in production.
Cheers, Toraj
<xsl:for-each select="../Partner">
    <ns0:Record-XMNREF0 xmlns:ns0="urn:ProcessPartner">
        <ns0:Col-CLIENT>
          <xsl:value-of select="Client/text()" />
        </ns0:Col-CLIENT>
        <ns0:Col-NRTYPE>
          <xsl:value-of select="PartnerType/text()" />
        </ns0:Col-NRTYPE>
        <ns0:Col-NRNREF>
          <xsl:value-of select="PartnerReference/text()" />
        </ns0:Col-NRNREF>
        <ns0:Col-NRPGRP>
          <xsl:value-of select="PartnerGroup/text()" />
        </ns0:Col-NRPGRP>
        <ns0:Col-NRNAME>
          <xsl:value-of select="PartnerName/text()" />
        </ns0:Col-NRNAME>
        <ns0:Col-NRADR1>
          <xsl:value-of select="AddressLine1/text()" />
        </ns0:Col-NRADR1>
...
        <ns0:Col-NRDATE>
          <xsl:value-of select="Date/text()" />
        </ns0:Col-NRDATE>
        <ns0:Col-NRTIME>
          <xsl:value-of select="substring(Time, 1, 4)" />
        </ns0:Col-NRTIME>

        <!-- Patner Reference -->
        <xsl:variable name ="prtRef" select="PartnerReference/text()"/>
        <xsl:for-each select="../Role">
            <!-- Role Reference -->
            <xsl:variable name="refRef" select="string(Reference)"/>
            <xsl:if test="(


refRef =


prtRef)"> <!--Put the Role information inside the current Partner node only if Role belong to current Partner--> <ns0:Record-XMNIRL0 xmlns:ns0="urn:ProcessPartner"> <ns0:Col-CLIENT> <xsl:value-of select="Client/text()" /> </ns0:Col-CLIENT> <ns0:Col-NITYPE> <xsl:value-of select="PartnerRoleType/text()" /> </ns0:Col-NITYPE> <ns0:Col-NINREF> <xsl:value-of select="Reference/text()" /> </ns0:Col-NINREF> ...... <ns0:Col-NIDATE> <xsl:value-of select="Date/text()" /> </ns0:Col-NIDATE> <ns0:Col-NITIME> <xsl:value-of select="substring(Time, 1, 4)" /> </ns0:Col-NITIME> </ns0:Record-XMNIRL0> </xsl:if> </xsl:for-each> </ns0:Record-XMNREF0> </xsl:for-each>


这篇关于Biztalk Schema用于给定合作伙伴的不同角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆