Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Envelope Schema
- This topic has 3 replies, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
March 29, 2009 at 7:35 AM #22049
Hi,
I have created an evelope schema and a content schema.
Envelope Schema:
<?xml version=”1.0″ encoding=”utf-16″ ?>
– <xs:schema xmlns:b=”http://schemas.microsoft.com/BizTalk/2003“ xmlns=”http://BasicXMLEnvelope“ targetNamespace=”http://BasicXMLEnvelope“ xmlns:xs=”http://www.w3.org/2001/XMLSchema“><b:recordInfo body_xpath=”/*[local-name()=’EnvelopeError’ and namespace-uri()=’http://BasicXMLEnvelope’%5D/*%5Blocal-name()=’Error’ and namespace-uri()=”]“ /></xs:appinfo></xs:annotation></xs:element></xs:schema>Content chema:<?xml version=”1.0″ encoding=”utf-16″ ?>– <xs:schema xmlns:b=”http://schemas.microsoft.com/BizTalk/2003“ xmlns=”http://BasicXMLEnvelope“ elementFormDefault=”qualified“ targetNamespace=”http://BasicXMLEnvelope“ xmlns:xs=”http://www.w3.org/2001/XMLSchema“><xs:element name=”ID“ type=”xs:integer“ /><xs:element name=”Type“ type=”xs:integer“ /><xs:element name=”Priority“ type=”xs:string“ /><xs:element name=”Description“ type=”xs:string“ /><xs:element name=”TimeStamp“ type=”xs:dateTime“ /></xs:sequence></xs:complexType></xs:element></xs:schema>Now If i create a sample batch xml , it always return error during instance validation. I know i must be missing something very basic to it but I am not able to find what?Sample XML:<
ns0:EnvelopeError xmlns:ns0=“http://BasicXMLEnvelope“>
<
BatchID>10</BatchID>
<Error>
<
ID>100</ID>
<
Type>100</Type>
<
Priority>Priority_0</Priority>
<
Description>Description_0</Description>
<
TimeStamp>1999-05-31T13:20:00.000-05:00</TimeStamp>
</
Error>
</
ns0:EnvelopeError>
Error:
error BEC2004: The ‘ID’ element is not declared.
error BEC2004: The element ‘Error’ has invalid child element ‘Type’
Thanks in advance.
-
March 30, 2009 at 3:10 PM #22055
Open your envelope schema and select the <Any> element. Set MaxOccurs = Unbounded and Process Contents = Skip
-
March 30, 2009 at 4:56 PM #22056
Looking at the schemas further, you will have problems when debatching the message in the pipeline as the content schema will not match the debatched message.
There are a number of problems.
Firstly the Body Xpath definition in the schema points to the Error node. So the XmlDisassembler will debatch each child node of this node. i.e. you will get 5 messages ( ID, Type, Priority, Description and Timestamp). Your content schema does not define any of these messages.
The namespaces are not correct. The envelope schema ElementFormDefault is set to Unqualified (the default) so only the root node has a namespace. While the content schema has the same namespace and ElementFormDefault is set to Qualified
- Here is a modified version of your schemas that should work:
<?xml version=“1.0“ encoding=“utf-16“?>
<xs:schema xmlns:ns0=“http://BasicError“ xmlns:b=“http://schemas.microsoft.com/BizTalk/2003“ xmlns=“http://BasicXMLEnvelope“ targetNamespace=“http://BasicXMLEnvelope“ xmlns:xs=“http://www.w3.org/2001/XMLSchema“>
<xs:import schemaLocation=“.\content.xsd“ namespace=“http://BasicError“ />
<xs:annotation>
<xs:appinfo>
<b:schemaInfo is_envelope=“yes“ xmlns:b=“http://schemas.microsoft.com/BizTalk/2003“ />
<b:references>
<b:reference targetNamespace=“http://BasicError“ />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name=“ErrorEnvelope“>
<xs:annotation>
<xs:appinfo>
<b:recordInfo body_xpath=“/*[local-name()=’ErrorEnvelope’ and namespace-uri()=’http://BasicXMLEnvelope’%5D“ />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref=“ns0:Error“ />
</xs:sequence>
<xs:attribute name=“BatchID“ type=“xs:string“ />
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version=“1.0“ encoding=“utf-16“?>
<xs:schema xmlns:b=“http://schemas.microsoft.com/BizTalk/2003“ xmlns=“http://BasicError“ elementFormDefault=“qualified“ targetNamespace=“http://BasicError“ xmlns:xs=“http://www.w3.org/2001/XMLSchema“>
<xs:element name=“Error“>
<xs:complexType>
<xs:sequence>
<xs:element name=“ID“ type=“xs:integer“ />
<xs:element name=“Type“ type=“xs:integer“ />
<xs:element name=“Priority“ type=“xs:string“ />
<xs:element name=“Description“ type=“xs:string“ />
<xs:element name=“TimeStamp“ type=“xs:dateTime“ />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>And a sample message:
<ErrorEnvelope xmlns=“http://BasicXMLEnvelope“ BatchID=“10“>
<Error xmlns=“http://BasicError“>
<ID>100</ID>
<Type>100</Type>
<Priority>Priority_0</Priority>
<Description>Description_0</Description>
<TimeStamp>1999-05-31T13:20:00.000-05:00</TimeStamp>
</Error>
</ErrorEnvelope>-
March 31, 2009 at 2:18 PM #22063
Thank ou very much. I do not have much understanding about XML namespaces and structure. Will tryo to refer some good study meaterial.If you can suggest any, I would be more then happy.
But really appreciate your input.
Thank you once again
- Here is a modified version of your schemas that should work:
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.