Search code examples
validationxsdschemabiztalk

BizTalk schema validation fails due to choice in schema


Can someone figure out the solution to this issue? We have an integration with one receive location (WCF-BasicHttp). Due to some business requirement, that rcv-location had to be able to handle four different requests (with different schemas) being sent to it. So the only solution I could come up with was a schema containing those four schemas. Please take a look at picture below for clarity. enter image description here

The receive location does have Microsofts standard receive pipeline XMLReceive set. And So the solution works and receives the requests perfectly.

Now my issue is how to validate the requests (schemas) that do come in to us. I did try to set the SchemaDocSpec (for the schema above that you see) in the rcv pipeline with the hope that BizTalk would figure out validation. But that simply returns a 500 error back.

When the rcv location recieves (one of the four possible requests) the test request, it looks like below picture shows. enter image description here

Does anyone have an idea on what I could do or try to fix this issue? Please let me know if you need more information from me.


Solution

  • Just have 4 separate schemas and set the Validate = True on the XML disassembler.

    Or create a custom pipeline in Visual Studio and add the schemas there.

    1. Add a Receive Pipeline to your solution
    2. From the Toolbox add the XML disassembler into the Disassemble stage.
    3. Add the XML Validator into Validate stage
    4. In the XML Validator Pipeline Component Properties click on the ... button next to (Collection)enter image description here
    5. In the Schema Collection Property Editor select the schema you want and click Add enter image description here
    6. Repeat for the other schemas
    7. Click OK when all added.
    8. Deploy your solution and in the BizTalk Admin console, select the custom pipeline you created on the receive location.