Deploying multiple similar schemas in BizTalk

烈酒焚心 提交于 2019-12-14 02:17:19

问题


I have two different servers on which two similar WCF services are running. Both services are exactly same (clone). I have to consume both services in a single orchestration because I have to communicate them with each other. (I am using "Add generated Items" to add service reference). I want to get data from one service method named "Get" and send it to others "Send" method. After deploying project I get error that "Cannot locate document specification because multiple schemas matched the message type #####".

I have read a solution of creating custom pipeline with a specific document schema but that didn't worked.

How I can handle this situation?


回答1:


If the services really are identical, then you don't need to use the wizard to import the schema twice - just import the first service's WSDL to create the schemas and port types, and then create a new send port* and change the bindings accordingly to point to the second service (i.e. notably the service URL).

This situation also typically happens if your WCF Services use MessageContracts which accepts or returns the same message payload for more than one service call (as opposed to DataContract, where you should get typically 'uniquified' root element names of the form xmlns#MyMethod and xmlns#MyMethodResponse).

In this case (i.e. common MessageContracts), in addition to basvo's answer, you can also get around this issue as follows:

  1. Import all artifacts for all consumed WCF services into your BTS project in Visual Studio.
  2. Retain the first 'instance' of each request (or response schema), and then in Orchestration view in VS, go through each of the second and subsequent port types and delete the duplicated request or response messages ("operation message") on the Port type. (Under each Port Type, you should see the request, the response and also any fault message types)
  3. You then need to 'edit' each of the message types that you've deleted, and then manually go and change it to the original instance of the schema that you've retained.
  4. You may also need to delete or worse, hack, the duplicated message types out of the imported .xsd files.

This is a pain however if your web service changes and you need to 'refresh' your imported schemas again - it would be a nice feature if the Import Wizard detected duplicate schemas and offered to merge them in this way for you.

* Update - just to clarify, reuse the same logical send port in your orch design, but create a new Send Port in the deployed BTS server / cluster, subscribing the send port to the required messages / link the second Orch to the send port (depending on whether you are using Direct binding or not), and obviously change the binding to the second URL.




回答2:


The problem is that you now have more than one schema in your BizTalk application which has the same namespace and root element.

You need to set the DocumentSpecNames property on both the XMLReceivePipeline of your "get service" and the XMLTransmitPipeline of your "send service" to tell BizTalk which one to use.

The basic format of this value is ... Schemaname+Rootname,Assembly

Example:

Company.Schemas.Messages+GetReply,Company.Schemas, 
   Version=1.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089



回答3:


As these services are same so just adding service reference for any one of these will add the required schemas.Just create separate send ports for each service in BizTalk MMC and to connect the logical port created in orchestration to correct send port while configuring the orchestration.

This solution Worked.....



来源:https://stackoverflow.com/questions/14600665/deploying-multiple-similar-schemas-in-biztalk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!