none
BAM Updating Through Pipleine RRS feed

  • Question

  • Hi,

    I have a requirement where i have to Update the below kind of schemas through Pipeline 
    Input Schema:

      <?xml version="1.0" encoding="utf-16" ?> 
    - <xs:schema xmlns="http://xyz.Schemas.Oinput" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://xyz.Schemas.Oinput" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    - <xs:element name="Oinput">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="a" type="xs:string" /> 
      <xs:element name="b" type="xs:string" /> 
    - <xs:element name="Record">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="s" type="xs:string" /> 
      <xs:element name="b" type="xs:string" /> 
    - <xs:element maxOccurs="unbounded" name="Record">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="v" type="xs:string" /> 
      <xs:element name="re" type="xs:string" /> 
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>


    Output Schema:

      <?xml version="1.0" encoding="utf-16" ?> 
    - <xs:schema xmlns="http://PQR.Schemas.OOutput" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://PQR.Schemas.OOutput" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    - <xs:element name="Oinput">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="a" type="xs:string" /> 
      <xs:element name="b" type="xs:string" /> 
    - <xs:element name="Record">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="s" type="xs:string" /> 
      <xs:element name="b" type="xs:string" /> 
    - <xs:element maxOccurs="unbounded" name="Record">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="v" type="xs:string" /> 
      <xs:element name="re" type="xs:string" /> 
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>


    if you could look at both the schemas the entire structure is the same except the Target Namespace. I am using BAM API  and Generated XSD Classes for these schemas.

    But since i am using these 2 XSD calsses in the same solution it will not allow me to build it since there will be an ambiguity between fileds and records.

    If i use only one XSD Class for both schemas i get a runtime error when it validates the namespace the Error will be like below.

    System.InvalidOperationException: <Oinput xmlns='http://xyz.Schemas.Oinput'> was not expected.
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderOinput.Read5_Oinput()

    To Update you on how i am calling from the Pipeline,i am taking the IbaseMessage converting it into Xml Document and then passing it to String writer class like below

                  StringWriter sw = new StringWriter();
                    XmlTextWriter tx = new XmlTextWriter(sw);
                    output.WriteTo(tx);
                    string sd = sw.ToString();
                    XmlSerializer serializer = new XmlSerializer(typeof(Oinput));

    during the serializer, i am getting the above error

    Can you help me on How to Achieve this?

    Saturday, April 30, 2016 6:45 PM

Answers