Biztalk and the best way to call web service

老子叫甜甜 提交于 2019-12-19 04:08:15

问题


I am writing a biztalk orchestration that will need to call a web service, probably multiple web services, and probably more than once. I see two options before me; one, consume the wsdl in a separate code project, and call the web services from code in an expression shape, and two, consume it from Biz, get schemas, etc and call through request/response ports. What is the best practice here? On the one hand, if the wsdl is updated it will be easier to update the code than the schemas and ports, and it seems like a lot of clutter and work to build ports enough for multiple web service calls. On the other hand, all the tuning you can do at the port level(retries being one) makes it robust to call web service.


回答1:


Also see this question here, which discusses a 3rd option, viz using add service reference in BizTalk as an alternative method to import XSD's.

IMO you would be defeating the point of using BizTalk by using .NET proxies to handle integration. For example:

  1. You are hard coding the protocol (WCF), and now need to marshal request and response messages to / from your custom code. With a send port, any request-response mechanism can be configured at deployment time - especially useful for unit and integrating testing.
  2. You will be losing all of the benefit of BizTalk's message delivery mechanisms, such as retries, backup transports, resume suspended messages, different maps for different ports, and arguably the whole pub sub ability, (e.g. what if multiple listeners want to listen to the responses from the called web services?)
  3. Where will you store the WCF serviceModel config settings, such as the endpoint etc? i.e. You've lost the flexibility of binding files.
    • etc.

So, TL;DR Always use the WCF adapters in BizTalk

However, that said, am in agreement that updating generated items if the consumed service changes can be messy. FWIW, we mitigate some of this as follows:

  • Always create a separate, empty folder in which to import all the imported generated artifacts.
  • Leave all the generated items 'as-is', i.e. don't be tempted to move the dummy .odx, or delete it (since it has the preconfigured Port Types)

Unfortunately this leaves the below actions which still need to be manually applied:

  • Remember to change the visibility of the Port Types to public if the artifacts are in a separate assembly to your orchestrations
  • Promoted and distinguished properties on the imported schemas need to be reapplied (e.g. remember to document screen shots after any change). Possibly this can be simplified or automated by saving and re-pasting in the <xs:annotation> section of the schma.
  • If you are using message contracts in your WCF service, and are reusing the same referenced messages across multiple applications, you will need to manually delete the duplicates created by the add generated items and then re-reference the existing schemas. (e.g. we have a standard 'response' message back to all BizTalk calls)



回答2:


Interestingly, you can have a mixture of both infact. Check this out by Saravana Kumar!!!

It uses passthrough receive and consumes a webservice using the dll on the send port, without going through the pain of creating schemas and webports.

This gives all the power of Biztalk ( routing response, send port configuration, etc) and still the flexibility to change the schema without much fuss.



来源:https://stackoverflow.com/questions/13734813/biztalk-and-the-best-way-to-call-web-service

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