使用 Biztalk 编排作为 Web 服务

发布于 2024-07-13 18:58:19 字数 157 浏览 12 评论 0原文

我在 Biztalk 中发布了一个编排作为 Web 服务。 有谁知道我如何使用 XML 序列化或其他方法从文件加载 XML 并将其“转换”为 Web 服务期望的消息类型? 人们通常如何使用此网络服务? 我尽量避免使用非类型化消息,因为我同时使用 XML 和平面文件,并且了解到这可能意味着麻烦。

I published an orchestration in Biztalk as a webservice. Does anyone know how I can use XML serialization or something to load XML from a file and "convert" it to the messagetype the webservice expects? How do people usually use this webservices? I try to avoid using untyped messages since I use both XML and flatfile, and have read that it could mean trouble.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

樱娆 2024-07-20 18:58:19

嗯,我想一般来说,Web 服务的想法是添加一个对它们的 Web 引用,这将生成一组可用于与 Web 服务交互的代理类。

您通常不必担心将 xml 文件序列化为 Web 服务格式或从 Web 服务格式序列化 xml 文件,生成的代码会为您完成此操作。

但是,如果您确实希望使用 XML,则可以使用 .net 序列化将 xml 文件反序列化为生成的代理类型(以及序列化您收到的任何响应)。

下面是如何将 xml 反序列化为类实例的基本示例,然后您可以将此实例传递到生成的代理中的方法中。

            System.Xml.Serialization.XmlSerializer xser = new System.Xml.Serialization.XmlSerializer(typeof(<generated request type here>));
        xser.UnknownAttribute += new System.Xml.Serialization.XmlAttributeEventHandler(xser_UnknownAttribute);
        xser.UnknownElement += new System.Xml.Serialization.XmlElementEventHandler(xser_UnknownElement);
        xser.UnknownNode += new System.Xml.Serialization.XmlNodeEventHandler(xser_UnknownNode);
        xser.UnreferencedObject += new System.Xml.Serialization.UnreferencedObjectEventHandler(xser_UnreferencedObject);
        <generated request type here> request = (<generated request type here>)xser.Deserialize(<xml stream here>);

我希望这是有道理的

Well, I guess generally the idea of web services is that you add a web reference to them, which would generate a set of proxy classes you could use to interact with the web service.

You don't normally have to worry about serialising xml files to and from the web service formats, the generated code will do it for you.

If you do wish to, however, to work of XML, you could use .net serialisation to deserialise an xml file into the generated proxy type (as well as serialise any response you're getting).

Here's a basic example of how to deserialise xml into a class instance, you can then pass this instance into the method in the generated proxy.

            System.Xml.Serialization.XmlSerializer xser = new System.Xml.Serialization.XmlSerializer(typeof(<generated request type here>));
        xser.UnknownAttribute += new System.Xml.Serialization.XmlAttributeEventHandler(xser_UnknownAttribute);
        xser.UnknownElement += new System.Xml.Serialization.XmlElementEventHandler(xser_UnknownElement);
        xser.UnknownNode += new System.Xml.Serialization.XmlNodeEventHandler(xser_UnknownNode);
        xser.UnreferencedObject += new System.Xml.Serialization.UnreferencedObjectEventHandler(xser_UnreferencedObject);
        <generated request type here> request = (<generated request type here>)xser.Deserialize(<xml stream here>);

I hope that makes sense

凡尘雨 2024-07-20 18:58:19

你问的问题有点混乱。 您一开始就说您将编排发布为 Web 服务,但提出了有关使用它的问题。

如果您谈论的是已发布的网络服务:
BizTalk Web 服务向导生成的 Web 服务与您在 .NET 中编写的 Web 服务没有什么不同。 根据您编排所需的消息类型以及您在向导中构建操作的方式。 向导将使用 WSDL 和模式自动为您生成一个 Web 服务(其中会有一些 BizTalk 特定位,但您无需担心实现)。

您的消费者(独立于平台)应该能够使用该 Web 服务而不会出现任何重大问题。

如果您尝试使用 Orchestration 中的 Web 服务
看看这篇论文 http://msdn.microsoft .com/en-us/library/ms935219(BTS.10).aspx

You question is bit confusing. You started off with saying you published an orchestration as web service, but raised the question about consuming it.

If you are talking about published web service:
The web service generated by BizTalk Web service Wizard is not different from a web service you would have written in .NET. Based on the message type you orchestration is expecting and how your structured the operation in the wizard. The Wizard would have auto generated a webservice for you with WSDL and schemas (there will be some BizTalk specific bits inside, but you don't need to worry about the implementation).

You consumers (independant of platform) should be able to consume that web service without any major issues.

If you are trying to consume a web service from Orchestration
Have a look at this paper http://msdn.microsoft.com/en-us/library/ms935219(BTS.10).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文