Logic Apps B2B encode minor update

This post has been republished via RSS; it originally appeared at: MSDN Blogs.

We are rolling out a small fix to Logic Apps B2B connectors (EDIFACT and X12) for their Encode API. We were not catching properly exception from invalid XML document user input where the document contained XML complex type Choice or All elements which actual occurrences count exceeded the maximum specified in the XML schema. For instance if the schema declared:

	<xs:element name="REF_SubLoop">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="REF_SubscriberIdentifier" minOccurs="1" maxOccurs="1"/>
				<xs:element ref="REF_MemberPolicyNumber" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="REF_MemberSupplementalIdentifier" minOccurs="0" maxOccurs="13"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>

But the encode request payload XML document contained:

    <ns0:REF_SubLoop>
      <ns0:REF_SubscriberIdentifier>
        <REF01_ReferenceIdentificationQualifier>0F</REF01_ReferenceIdentificationQualifier>
        <REF02_SubscriberIdentifier>101c9469-50de-47da-9074-23a5d2cc03e7</REF02_SubscriberIdentifier>
      </ns0:REF_SubscriberIdentifier>
      <ns0:REF_SubscriberIdentifier>
        <REF01_ReferenceIdentificationQualifier>0F</REF01_ReferenceIdentificationQualifier>
        <REF02_SubscriberIdentifier>101c9469-50de-47da-9074-23a5d2cc03e7</REF02_SubscriberIdentifier>
      </ns0:REF_SubscriberIdentifier>
    </ns0:REF_SubLoop>

Once the update rollout is complete, we will detect those invalid inputs and correctly fail the encode call with HTTP error code 400 Bad Request response and an error message alike:

Error in serialization Errors: Error: 1 (Segment level error)
    SegmentID: INS
    Position in TS: 1
    7: Segment not in proper sequence

Error: 2 (Segment level error)
    SegmentID: REF
    Position in TS: 3
    7: Segment not in proper sequence

Error: 3 (Segment level error)
    SegmentID: REF
    Position in TS: 3
    5: Segment exceeds maximum use description

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.