Calling a web/wcf service from orchestration: adding a generated item vs adding service reference

自闭症网瘾萝莉.ら 提交于 2020-01-01 12:02:34

问题


If I want to call a web service or wcf method from an orchestration, I can do it by either adding a service reference to the project or adding a generated item. What is the advantage of either approach - is there a best practice?


回答1:


Steef -Jan Wiggers answers a similar question here

TL;DR - Always use the Generated Items wizard.

My 10c - Although the .xsd files imported by Add Service is added as a schema and set to BtsCompile, there are some limitations such as:

  • Add Service Reference will add the client proxy, which isn't needed in a BizTalk project (and which might 'tempt' your devs to do silly things like using this proxy from a Custom assembly)
  • Service Reference makes a mess of importing complicated WSDL (e.g. with Generics or dependencies on other Schemas), See Considerations when consuming Web Services

Using the Add Generated Items wizard does extra work for you:

  • Adds in a Port Type for accessing the service, already preconfigured for the correct message types. Note however that it adds the Port type to a dummy .odx - i.e. don't delete the odx until you've moved the Port type elsewhere.
  • Allow you to create the Send Port bindings at the same time.

One thing I would recommend with the Wizard, is to create a folder for the WCF reference and always import all the artifacts into the folder (i.e. don't do the usual separation of Schemas from Ports and leave the dummy .odx there as well). This way, if you need to regenerate the items, just delete everything in the folder and start again (sadly, the wizard doesn't have a Update Service Reference equivalent.

Also note that if you do move the generated Schemas and Port Types into a separate assembly, that you will need to change the type modifier access to Public (it is internal by default)



来源:https://stackoverflow.com/questions/12927376/calling-a-web-wcf-service-from-orchestration-adding-a-generated-item-vs-adding

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