locked
Target Namespace RRS feed

  • Question

  • Can 2 schema's have same Target Namespace in BizTalk?
    Tuesday, July 5, 2016 10:34 AM

Answers

  • Hi Thirupathimushnam,

    YEs two schemas can have same namespaces.

    What you need to understand that BizTalk combines the MEssage Type with the DocumentSpecNames property to identify the nature of the received message and rout it to the required subscriber. Consider following scenario.

    1) There is a BizTalk application A having a schema with message type sampleNamespace#rootnode

    2) There is a BizTalk application B having a schema with message type again as Namespace#rootnode

    3) Now there is a BizTalk Subscriber (lets say an Orchestration) which accepts the message type Namespace#rootnode to process the message.

    Now if you have provide the reference of the schema of the Application A to the Orchestration project and created your message based on the schema from application A, then the BizTalk uses the DocumentSpecNames property while accepting the message of message type namespace#rootnode.

    So if you provide the Orchestration with the message generated from the schema from application B then the BizTalk will raise an error something on the lines

    "Expected the message type Namespace#rootnode from the xxxxx(DocSpecName of A) but received the message of type Namespace#rootnode from yyyy(DocSpecName of B)".

    So BizTalk will not process the message.

    The messageType and the DoumnetSpecName property is promoted in the disassemble stage of the receive pipeline.

    Now what is the resolution?

    1) In the XML Disassembler component of the Receive Pipeline the application B, forcefully overwite the DocumentSpecName property and then the ORchestration will accept the messages from application B also.Now consider another scenario, you have exposed schema as WCF service for application X.

    You are consuming this wcf service from applications Y and Z and use the add generated items to consume the wcf service of x.

    Now you deploy Y and Z. Now basically there is a same structure of request /response of application x schemas in applications Y and Z.

    So when you try to consume the WCF service you will get the error There was a failure executing the receive pipeline: "<ReceivePipeline>"
    Source: "XML disassembler" Receive Port: "<ReceivePortName>" URI:
    "<URI>\*.xml" Reason: Cannot locate document specification because
    multiple schemas matched the message type
    "<TargetNameSpace><RootName>"
    .

    so to solve this you need to set the AllowUnrecognizedMessage in the disassembler component to true. It will work like a charm.

    But these are workarounds are not recommended and you should generally try to have a unique message type.


    Mandar Dharmadhikari

    Tuesday, July 5, 2016 12:17 PM
    Moderator
  • Yes it can.

    Make sure that the schema root node name is different or else you will run into issues while receiving the message using XmlRecieve pipeline. Specifically,  the XmlDisassembler will throw an error as it would find multiple MessageTypes with the same Namespace#RootNodeName combination deployed.


    Thanks Arindam


    Tuesday, July 5, 2016 10:40 AM
    Moderator

All replies

  • Yes it can.

    Make sure that the schema root node name is different or else you will run into issues while receiving the message using XmlRecieve pipeline. Specifically,  the XmlDisassembler will throw an error as it would find multiple MessageTypes with the same Namespace#RootNodeName combination deployed.


    Thanks Arindam


    Tuesday, July 5, 2016 10:40 AM
    Moderator
  • Hi Thirupathimushnam,

    You got it consfused between the rootnode and the target name space,

    Root node uses the target namespace defined for the schema, root node is not part of the target namespace.

    Now for two schemas having different root nodes and same namespace will not make their namespace different.

    BizTalk uses the TargetNamespace#RootNode Name to create the message type property which is used to route the message to the necessary subscribers.

    So no targetnamespace is not a combination of namespace#Rootnode..it is the message type created by the BizTalk engine.

    Also as Arindam has pointed out deploying same schema under different assemblies can produce errors in BizTalk during runtime. So Please make sure that you change the root node atleast if you want to keep the namespace same.

    Regards,


    Mandar Dharmadhikari

    Tuesday, July 5, 2016 11:02 AM
    Moderator
  • Yes it can,  but you will get a runtime error if you use XmlRecieve pipeline to receive a message of that schema type.  Reason mentioned in my first reply above.

    So basically not recommended. What problem are you facing?

    Note- There is a workaround to get this to work- by specifying the fully qualified schema assembly name in the DocumentSpecNames property in the XmlDisassembler.  The assembly that you specify in above property should contain only the schema (out of the 2 schemas with same MessageType) that you want to parse with this specific pipeline.


    Thanks Arindam





    Tuesday, July 5, 2016 11:31 AM
    Moderator
  • The answer to you specific question is Yes.

    However, we need some context in order to answer what's is probably you real question.

    Can you describe you situation and exactly why you're asking this?

    Tuesday, July 5, 2016 12:16 PM
    Moderator
  • Hi Thirupathimushnam,

    YEs two schemas can have same namespaces.

    What you need to understand that BizTalk combines the MEssage Type with the DocumentSpecNames property to identify the nature of the received message and rout it to the required subscriber. Consider following scenario.

    1) There is a BizTalk application A having a schema with message type sampleNamespace#rootnode

    2) There is a BizTalk application B having a schema with message type again as Namespace#rootnode

    3) Now there is a BizTalk Subscriber (lets say an Orchestration) which accepts the message type Namespace#rootnode to process the message.

    Now if you have provide the reference of the schema of the Application A to the Orchestration project and created your message based on the schema from application A, then the BizTalk uses the DocumentSpecNames property while accepting the message of message type namespace#rootnode.

    So if you provide the Orchestration with the message generated from the schema from application B then the BizTalk will raise an error something on the lines

    "Expected the message type Namespace#rootnode from the xxxxx(DocSpecName of A) but received the message of type Namespace#rootnode from yyyy(DocSpecName of B)".

    So BizTalk will not process the message.

    The messageType and the DoumnetSpecName property is promoted in the disassemble stage of the receive pipeline.

    Now what is the resolution?

    1) In the XML Disassembler component of the Receive Pipeline the application B, forcefully overwite the DocumentSpecName property and then the ORchestration will accept the messages from application B also.Now consider another scenario, you have exposed schema as WCF service for application X.

    You are consuming this wcf service from applications Y and Z and use the add generated items to consume the wcf service of x.

    Now you deploy Y and Z. Now basically there is a same structure of request /response of application x schemas in applications Y and Z.

    So when you try to consume the WCF service you will get the error There was a failure executing the receive pipeline: "<ReceivePipeline>"
    Source: "XML disassembler" Receive Port: "<ReceivePortName>" URI:
    "<URI>\*.xml" Reason: Cannot locate document specification because
    multiple schemas matched the message type
    "<TargetNameSpace><RootName>"
    .

    so to solve this you need to set the AllowUnrecognizedMessage in the disassembler component to true. It will work like a charm.

    But these are workarounds are not recommended and you should generally try to have a unique message type.


    Mandar Dharmadhikari

    Tuesday, July 5, 2016 12:17 PM
    Moderator
  • Hi thirupathimushnam,

    yes 2 schemas have same target namespace in BizTalk .please see the below link:

    https://msdn.microsoft.com/en-us/library/aa578080.aspx

    Thanks

    SophiaRanjani

    Wednesday, July 6, 2016 6:16 AM