BizTalk Web 参考 - 生成的 XSD 已“丢失”来自 WSDL 的信息
我正在使用 BizTalk 2006 R2 从 WSDL 文件生成 Web 引用。
将生成的 XSD 与 WSDL 进行比较,很明显丢失了很多信息。
考虑以下 WSDL 摘录:
<s:element form="unqualified" minOccurs="0" maxOccurs="4" name="Applicant">
<s:complexType>
<s:sequence>
<s:element form="unqualified" minOccurs="1" maxOccurs="1" name="ApplicantIdentifier">
<s:simpleType>
<s:restriction base="s:string" />
</s:simpleType>
</s:element>
<s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Name">
<s:complexType>
<s:sequence>
<s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Title">
<s:simpleType>
<s:restriction base="s:string">
<s:maxLength value="10" />
</s:restriction>
</s:simpleType>
</s:element>
<s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Forename">
<s:simpleType>
<s:restriction base="s:string">
<s:pattern value="[0-9A-Za-z \-]*" />
<s:maxLength value="15" />
<s:minLength value="1" />
</s:restriction>
</s:simpleType>
</s:element>
<!-- more -->
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
BizTalk 生成的等效 XSD 是:
<xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="Applicant">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="ApplicantIdentifier" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Name">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Title" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Forename" type="xs:string" />
<!-- more -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
因此,XSD 已丢失限制模式并为 minOccurs 和 maxOccurs 设置了自己的值。
我需要从另一个源映射到 XSD,并且希望捕获该阶段不符合 WSDL 的数据。
有谁知道为什么 BizTalk 没有在 XSD 中保留这些限制;或者如何生成无损 XSD?
I am using BizTalk 2006 R2 to generate a web reference from a WSDL file.
Comparing the generated XSD to the WSDL, it is apparent that a lot of information has been lost.
Consider the following extract from the WSDL:
<s:element form="unqualified" minOccurs="0" maxOccurs="4" name="Applicant">
<s:complexType>
<s:sequence>
<s:element form="unqualified" minOccurs="1" maxOccurs="1" name="ApplicantIdentifier">
<s:simpleType>
<s:restriction base="s:string" />
</s:simpleType>
</s:element>
<s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Name">
<s:complexType>
<s:sequence>
<s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Title">
<s:simpleType>
<s:restriction base="s:string">
<s:maxLength value="10" />
</s:restriction>
</s:simpleType>
</s:element>
<s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Forename">
<s:simpleType>
<s:restriction base="s:string">
<s:pattern value="[0-9A-Za-z \-]*" />
<s:maxLength value="15" />
<s:minLength value="1" />
</s:restriction>
</s:simpleType>
</s:element>
<!-- more -->
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
The equivalent XSD which BizTalk has generated is:
<xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="Applicant">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="ApplicantIdentifier" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Name">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Title" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Forename" type="xs:string" />
<!-- more -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
So, the XSD has lost the restriction patterns and has set its own values for minOccurs and maxOccurs.
I need to map from another source to the XSD and I wish to trap data that does not conform to the WSDL at that stage.
Does anyone know why BizTalk has not preserved the restrictions in the XSD; or how I can generate non-lossy XSD?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您在 BizTalk 管道中进行架构验证,否则限制和最大发生次数 > 1 实际上不会执行任何操作 - BizTalk 在运行时不会使用它们。我猜这就是网络引用有损的原因。
我个人从来不喜欢“添加 Web 引用”功能,甚至不喜欢“添加适配器元数据”/WCF。如果您的 wsdl 更改频繁,那么手动将类型定义复制到 xsd 文件中的工作量太大:
a) 考虑构建一个简单的控制台应用程序来检索 wsdl、提取类型并更新 xsd 文件(踢掉它)从 VS 中的外部工具菜单关闭),
b)找出您的开发过程中出了什么问题,需要经常更改服务合同!
Unless you're doing schema validation in a BizTalk pipeline, restrictions and maxoccurs > 1 aren't actually going to do anything - they're not used by BizTalk at runtime. I'm guessing this is the reason why the web reference is lossy.
I've personally never liked the 'add web reference' feature, or even the 'add adapter metadata'/WCF. If your wsdl is changing that frequently that manually copying the type definitions into an xsd file is too much work:
a) look at building a simple console app to retrieve the wsdl, extract the type(s) and update the xsd file (kick it off from the External Tools menu in VS), and
b) work out what's going wrong with your development process that requires service contract changes that often!
您是否尝试过使用 WCF 适配器而不是“添加 Web 引用”来完成此任务?
这是一个示例...
http://blogs.digitaldeposit.net/SARAVANA/post/2007/05/31/BizTalk-2006-R2-consume-an-ASMX-webservice-using-WCF -BasicHttp-adapter.aspx
Have you tried using the WCF adapter rather than the "add web reference" to get this done?
Here is an example...
http://blogs.digitaldeposit.net/SARAVANA/post/2007/05/31/BizTalk-2006-R2-consume-an-ASMX-webservice-using-WCF-BasicHttp-adapter.aspx