locked
Restriction on attribute in Schema RRS feed

  • Question

  • I have the following schema:

     the format of Date attribute should be YYYY-MM-DD(1999-05-31 ) format.If user enter the date different then this format then Date attribute should not be created in destination schema and a message in Error attribute should be displayed in destination schema.

    The restriction should be applied in the basis of attributes properties.

    I did the following thing :

    But when I put the different format of date, it is also processed. The restriction is not applied correctly.

    Am I doing something wrong ? 


    Prakash

    Saturday, September 13, 2014 10:24 AM

Answers

  • If the issues is that the invalid date is passing through the system, then you have to enable Schema Validation at some point, such as with the XmlDisassembler or XmlValidator Pipeline Components.

    However, you probably don't want to do that (enable Schema Validation) because you have to have a specific way to cover this case, the Error attribute.  Schema Validation will result in a Failed Message which in your case will make things harder than they need to be.

    This problem is best solved in a Map where you check for format of the Date attribute, such as with a Regular Expression, and act accordingly, including set the Error attribute in the failure case.

    You don't show the input above so we can't comment on what Visual Studio is showing.

    • Marked as answer by Angie Xu Thursday, September 18, 2014 1:34 AM
    Saturday, September 13, 2014 11:52 AM
    Moderator
  • You could run the message validation against schema in either the port level or in orchestration.

    For orchestration you can process in multiple ways, and create the error/Fixing process accordingly:

    - Pick up the value and verify that it is of proper type from the message in an expression shape By using xpath

    - Create a map and validate the value

    - Create a helper class for messagevalidation

    http://dietergobeyn.be/validating-biztalk-messages-orchestration/

    - Run a pipeline that includes message validation step in an orchestration

    http://msdn.microsoft.com/en-us/library/aa562035.aspx

    • Proposed as answer by Jari Myllylä Monday, September 15, 2014 8:51 AM
    • Marked as answer by Angie Xu Thursday, September 18, 2014 1:34 AM
    Monday, September 15, 2014 8:49 AM

All replies

  • If the issues is that the invalid date is passing through the system, then you have to enable Schema Validation at some point, such as with the XmlDisassembler or XmlValidator Pipeline Components.

    However, you probably don't want to do that (enable Schema Validation) because you have to have a specific way to cover this case, the Error attribute.  Schema Validation will result in a Failed Message which in your case will make things harder than they need to be.

    This problem is best solved in a Map where you check for format of the Date attribute, such as with a Regular Expression, and act accordingly, including set the Error attribute in the failure case.

    You don't show the input above so we can't comment on what Visual Studio is showing.

    • Marked as answer by Angie Xu Thursday, September 18, 2014 1:34 AM
    Saturday, September 13, 2014 11:52 AM
    Moderator
  • Hi Prakash ,

    The restriction only applies if you change pipeline setting.

    Go to pipeline -> configure Pipeline - XML Recive -> Validate Document = True .

    But if you do above setting then pipeline will reject the message at pipeline stage and you would not be able to set Error Message .

    so one way you can use Map .

    Regards ,

    Mohit Gupta

    Monday, September 15, 2014 7:42 AM
  • You could run the message validation against schema in either the port level or in orchestration.

    For orchestration you can process in multiple ways, and create the error/Fixing process accordingly:

    - Pick up the value and verify that it is of proper type from the message in an expression shape By using xpath

    - Create a map and validate the value

    - Create a helper class for messagevalidation

    http://dietergobeyn.be/validating-biztalk-messages-orchestration/

    - Run a pipeline that includes message validation step in an orchestration

    http://msdn.microsoft.com/en-us/library/aa562035.aspx

    • Proposed as answer by Jari Myllylä Monday, September 15, 2014 8:51 AM
    • Marked as answer by Angie Xu Thursday, September 18, 2014 1:34 AM
    Monday, September 15, 2014 8:49 AM