在BizTalk 2006 R2中使用WCF服务

时间:2022-06-27 09:49:33

I'm trying to figure out how to consume a WCF service in BizTalk 2006 R2 (sending a request and receiving a response).

我试图弄清楚如何在BizTalk 2006 R2中使用WCF服务(发送请求并接收响应)。

I've gotten as far as going through the "Add Generated Items" wizard. Now I am trying to find out how to use the items it generated in an orchestration.

我已经完成了“添加生成的项目”向导。现在我试图找出如何使用它在业务流程中生成的项目。

How should the request be made?

应该如何提出要求?

3 个解决方案

#1


4  

Below is a description of how to do this - I'm going to presume at least basic knowledge of things like BizTalk mapping, please let me know if you need any more detail and I'll update.

下面是如何执行此操作的说明 - 我将至少假设BizTalk映射等基本知识,如果您需要更多详细信息,请告诉我,我会更新。

After generating the items in BizTalk you should have (at the least):

在BizTalk中生成项目后,您应该(至少):

  • An orchestration file with Messages and Port Types created
  • 创建了包含消息和端口类型的业务流程文件

  • A schema that describes the messages you send and receive from and to your WCF service
  • 描述您从WCF服务发送和接收的消息的模式

  • A .Binding.xml file that describes the service contract exposed by the WCF service and allows easy configuration in BizTalk

    一个.Binding.xml文件,描述了WCF服务公开的服务契约,并允许在BizTalk中轻松配置

    1. Open the orchestration file. This should be empty.
    2. 打开业务流程文件。这应该是空的。

  • Drag a Port from the toolbox onto the orchestration designer surface.

    将端口从工具箱拖到业务流程设计器表面上。

  • Name the port appropriately.
  • 适当地命名端口。

  • Select "Use an existing Port Type" - one of the existing port types will be your WCF service (created by the Add Generated Items wizard)
  • 选择“使用现有端口类型” - 其中一个现有端口类型将是您的WCF服务(由“添加生成的项目”向导创建)

  • Specify that you will be sending and receiving messages
  • 指定您将发送和接收消息

  • Specify Bind Later
  • 指定稍后绑定

This port should have Request and Response operation messages and they should have been automatically configured to use the messages for your WCF service. If your service exposes multiple operations, you will see that reflected here.

此端口应具有请求和响应操作消息,并且它们应已自动配置为使用WCF服务的消息。如果您的服务公开了多个操作,您将看到此处反映的内容。

  1. Using standard BizTalk mapping methods, map the data you want to send to the WCF service into the request message for the WCf port. (you may want the change the message names in the orchestration designer to be something better than the default message_1, message_2...)

    使用标准BizTalk映射方法,将要发送到WCF服务的数据映射到WCf端口的请求消息中。 (您可能希望更改业务流程设计器中的消息名称,使其比默认message_1,message_2更好...)

  2. Drag Receive and Send shapes onto the orchestration designer and connect them to the right Port messages.

    将接收和发送形状拖到业务流程设计器上,并将它们连接到正确的端口消息。

  3. Wire up the rest of the BizTalk orchestration to take data from appropriate source systems (this is just basic BizTalk, not WCF)

    连接BizTalk业务流程的其余部分以从适当的源系统获取数据(这只是基本的BizTalk,而不是WCF)

  4. Deploy the BizTalk application.

    部署BizTalk应用程序。

    The application is now ready to go, you can deploy it to BizTalk.

    现在应用程序已准备就绪,您可以将其部署到BizTalk。

  5. Configure the BizTalk application

    配置BizTalk应用程序

    • Open the BizTalk Server 2006 Administration Console and find the application containing the orchestration you just deployed.
    • 打开BizTalk Server 2006管理控制台,找到包含刚刚部署的业务流程的应用程序。

    • The orchestraion will be unenlisted, you need to bind all of its ports
      For most of the ports this is just like any other BizTalk application - only the ports that deal with the WCF service differ.
    • 管弦乐将不会被列入,你需要绑定它的所有端口对于大多数端口,这就像任何其他BizTalk应用程序一样 - 只有处理WCF服务的端口不同。

For the WCF ports you have (at least to begin with) two main options:

对于WCF端口,您(至少可以开始)有两个主要选项:

  1. Import the bindings file made by the BizTalk Generate Items wizard (right click on the applicaiton and import - navigate to the .xml binding file) - Perhaps advisable until you have an idea of how Biztalk represents all the WCF binding options.
  2. 导入BizTalk Generate Items向导生成的绑定文件(右键单击应用程序并导入 - 导航到.xml绑定文件) - 在您了解Biztalk如何表示所有WCF绑定选项之前,可能是可取的。

  3. Configure your own WCF send port.

    配置您自己的WCF发送端口。

    • For this the port needs to be Solicit-Response to match the WCF service.
    • 为此,端口需要是Solicit-Response以匹配WCF服务。

    • Choose one of the WCF Send Port types to match the binding type of your WCF service.
      To begin with (for a basic Webservice) this will often be WCF-BasicHttp.
      Once you have the basics working you might want to return here and experiment with the options available in the Custom binding - there is a LOT there!
    • 选择一种WCF发送端口类型以匹配WCF服务的绑定类型。首先(对于基本的Web服务),这通常是WCF-BasicHttp。一旦你掌握了基础工作,你可能想回到这里并尝试自定义绑定中可用的选项 - 那里有很多!

    • Configure the send port.
      • In the general tab enter the url where the .svc file is specified
        e.g. http://localhost/WCF/myservice.svc
      • 在常规选项卡中,输入指定.svc文件的URL,例如HTTP://localhost/WCF/myservice.svc

      • Set the Action to match the action specified in the WCF service .wsdl file
        e.g. http://tempuri.org/IMyContract/MyMethod
      • 设置Action以匹配WCF服务.wsdl文件中指定的操作,例如http://tempuri.org/IMyContract/MyMethod

    • 配置发送端口。在常规选项卡中,输入指定.svc文件的URL,例如http://localhost/WCF/myservice.svc设置Action以匹配WCF服务.wsdl文件中指定的操作,例如http://tempuri.org/IMyContract/MyMethod

With your WCF port now created you can bind the orchestration ports to it.

现在创建了WCF端口,您可以将业务流程端口绑定到它。

Once all this is done, you should be able to start the BizTalk application and things should work.

完成所有这些后,您应该能够启动BizTalk应用程序,事情应该可行。

One thing that may help - errors will be written to the event log, they may not be helpful, but you should also be able to see any soap fault messages returned from the service in the suspended message view.

有一件事可能会有所帮助 - 错误将被写入事件日志,它们可能没有帮助,但您还应该能够在挂起的消息视图中看到从服务返回的任何soap错误消息。

Good luck!

#2


0  

BizTalk is overkill if you are just using it to orchestrate WCF services. You can use WCF services in .NET 3.5 inside of Windows Workflow Foundation a bit more easily.

如果您只是使用它来编排WCF服务,那么BizTalk就太过分了。您可以更轻松地在Windows Workflow Foundation中使用.NET 3.5中的WCF服务。

That said, here is a screencast that should help:

也就是说,这是一个应该有帮助的截屏视频:

http://www.pluralsight.com/community/blogs/aaron/archive/2007/11/15/49172.aspx

#3


0  

Its is very simple as other Service development in BizTalk. Let make it more simpler.

它与BizTalk中的其他服务开发一样非常简单。让它更简单。

  1. Just Develop you desire Work Flow (Orchestration) and Service.
  2. 只需开发您想要的工作流程(编排)和服务。

  3. Open WCF Web publishing Wizard and Check (a) Enable Metadata Endpoint , (b) Create BizTalk Receive Location in the in ur application.
  4. 打开WCF Web发布向导并检查(a)启用元数据端点,(b)在您的应用程序中创建BizTalk接收位置。

  5. Go to you BizTalk console and Enable the Receive location and Start your Application from Biztalk Console.
  6. 转到BizTalk控制台并启用接收位置并从Biztalk控制台启动应用程序。

  7. Then Browse it from IE or Fire Fox to check that either Service is running or Not. Now Service has been Develop. Lets do something for its Client.
  8. 然后从IE或Fire Fox中浏览它以检查服务是否正在运行。现在服务一直在发展。让我们为客户做点什么。

  9. Go to the Patah "c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\" and Write SVCUTL and your url of your service i.e. c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\svcutil localhost:axix//axx.svx?wsdl, this will copy the two files, one is output.config and other is BizTalkServiceInstance. cut and paste both files to your ciletn and then See you service desp for its consumption. I Think this is the most simplest which i tried to make. Thanks Abdul Aziz Farooqi.
  10. 转到Patah“c:\ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Bin \”并编写SVCUTL和您的服务URL,即c:\ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Bin \ svcutil localhost:axix // axx.svx?wsdl,这将复制两个文件,一个是output.config,另一个是BizTalkServiceInstance。将两个文件剪切并粘贴到您的ciletn然后查看服务desp以供其使用。我认为这是我试图做的最简单的。谢谢Abdul Aziz Farooqi。

#1


4  

Below is a description of how to do this - I'm going to presume at least basic knowledge of things like BizTalk mapping, please let me know if you need any more detail and I'll update.

下面是如何执行此操作的说明 - 我将至少假设BizTalk映射等基本知识,如果您需要更多详细信息,请告诉我,我会更新。

After generating the items in BizTalk you should have (at the least):

在BizTalk中生成项目后,您应该(至少):

  • An orchestration file with Messages and Port Types created
  • 创建了包含消息和端口类型的业务流程文件

  • A schema that describes the messages you send and receive from and to your WCF service
  • 描述您从WCF服务发送和接收的消息的模式

  • A .Binding.xml file that describes the service contract exposed by the WCF service and allows easy configuration in BizTalk

    一个.Binding.xml文件,描述了WCF服务公开的服务契约,并允许在BizTalk中轻松配置

    1. Open the orchestration file. This should be empty.
    2. 打开业务流程文件。这应该是空的。

  • Drag a Port from the toolbox onto the orchestration designer surface.

    将端口从工具箱拖到业务流程设计器表面上。

  • Name the port appropriately.
  • 适当地命名端口。

  • Select "Use an existing Port Type" - one of the existing port types will be your WCF service (created by the Add Generated Items wizard)
  • 选择“使用现有端口类型” - 其中一个现有端口类型将是您的WCF服务(由“添加生成的项目”向导创建)

  • Specify that you will be sending and receiving messages
  • 指定您将发送和接收消息

  • Specify Bind Later
  • 指定稍后绑定

This port should have Request and Response operation messages and they should have been automatically configured to use the messages for your WCF service. If your service exposes multiple operations, you will see that reflected here.

此端口应具有请求和响应操作消息,并且它们应已自动配置为使用WCF服务的消息。如果您的服务公开了多个操作,您将看到此处反映的内容。

  1. Using standard BizTalk mapping methods, map the data you want to send to the WCF service into the request message for the WCf port. (you may want the change the message names in the orchestration designer to be something better than the default message_1, message_2...)

    使用标准BizTalk映射方法,将要发送到WCF服务的数据映射到WCf端口的请求消息中。 (您可能希望更改业务流程设计器中的消息名称,使其比默认message_1,message_2更好...)

  2. Drag Receive and Send shapes onto the orchestration designer and connect them to the right Port messages.

    将接收和发送形状拖到业务流程设计器上,并将它们连接到正确的端口消息。

  3. Wire up the rest of the BizTalk orchestration to take data from appropriate source systems (this is just basic BizTalk, not WCF)

    连接BizTalk业务流程的其余部分以从适当的源系统获取数据(这只是基本的BizTalk,而不是WCF)

  4. Deploy the BizTalk application.

    部署BizTalk应用程序。

    The application is now ready to go, you can deploy it to BizTalk.

    现在应用程序已准备就绪,您可以将其部署到BizTalk。

  5. Configure the BizTalk application

    配置BizTalk应用程序

    • Open the BizTalk Server 2006 Administration Console and find the application containing the orchestration you just deployed.
    • 打开BizTalk Server 2006管理控制台,找到包含刚刚部署的业务流程的应用程序。

    • The orchestraion will be unenlisted, you need to bind all of its ports
      For most of the ports this is just like any other BizTalk application - only the ports that deal with the WCF service differ.
    • 管弦乐将不会被列入,你需要绑定它的所有端口对于大多数端口,这就像任何其他BizTalk应用程序一样 - 只有处理WCF服务的端口不同。

For the WCF ports you have (at least to begin with) two main options:

对于WCF端口,您(至少可以开始)有两个主要选项:

  1. Import the bindings file made by the BizTalk Generate Items wizard (right click on the applicaiton and import - navigate to the .xml binding file) - Perhaps advisable until you have an idea of how Biztalk represents all the WCF binding options.
  2. 导入BizTalk Generate Items向导生成的绑定文件(右键单击应用程序并导入 - 导航到.xml绑定文件) - 在您了解Biztalk如何表示所有WCF绑定选项之前,可能是可取的。

  3. Configure your own WCF send port.

    配置您自己的WCF发送端口。

    • For this the port needs to be Solicit-Response to match the WCF service.
    • 为此,端口需要是Solicit-Response以匹配WCF服务。

    • Choose one of the WCF Send Port types to match the binding type of your WCF service.
      To begin with (for a basic Webservice) this will often be WCF-BasicHttp.
      Once you have the basics working you might want to return here and experiment with the options available in the Custom binding - there is a LOT there!
    • 选择一种WCF发送端口类型以匹配WCF服务的绑定类型。首先(对于基本的Web服务),这通常是WCF-BasicHttp。一旦你掌握了基础工作,你可能想回到这里并尝试自定义绑定中可用的选项 - 那里有很多!

    • Configure the send port.
      • In the general tab enter the url where the .svc file is specified
        e.g. http://localhost/WCF/myservice.svc
      • 在常规选项卡中,输入指定.svc文件的URL,例如HTTP://localhost/WCF/myservice.svc

      • Set the Action to match the action specified in the WCF service .wsdl file
        e.g. http://tempuri.org/IMyContract/MyMethod
      • 设置Action以匹配WCF服务.wsdl文件中指定的操作,例如http://tempuri.org/IMyContract/MyMethod

    • 配置发送端口。在常规选项卡中,输入指定.svc文件的URL,例如http://localhost/WCF/myservice.svc设置Action以匹配WCF服务.wsdl文件中指定的操作,例如http://tempuri.org/IMyContract/MyMethod

With your WCF port now created you can bind the orchestration ports to it.

现在创建了WCF端口,您可以将业务流程端口绑定到它。

Once all this is done, you should be able to start the BizTalk application and things should work.

完成所有这些后,您应该能够启动BizTalk应用程序,事情应该可行。

One thing that may help - errors will be written to the event log, they may not be helpful, but you should also be able to see any soap fault messages returned from the service in the suspended message view.

有一件事可能会有所帮助 - 错误将被写入事件日志,它们可能没有帮助,但您还应该能够在挂起的消息视图中看到从服务返回的任何soap错误消息。

Good luck!

#2


0  

BizTalk is overkill if you are just using it to orchestrate WCF services. You can use WCF services in .NET 3.5 inside of Windows Workflow Foundation a bit more easily.

如果您只是使用它来编排WCF服务,那么BizTalk就太过分了。您可以更轻松地在Windows Workflow Foundation中使用.NET 3.5中的WCF服务。

That said, here is a screencast that should help:

也就是说,这是一个应该有帮助的截屏视频:

http://www.pluralsight.com/community/blogs/aaron/archive/2007/11/15/49172.aspx

#3


0  

Its is very simple as other Service development in BizTalk. Let make it more simpler.

它与BizTalk中的其他服务开发一样非常简单。让它更简单。

  1. Just Develop you desire Work Flow (Orchestration) and Service.
  2. 只需开发您想要的工作流程(编排)和服务。

  3. Open WCF Web publishing Wizard and Check (a) Enable Metadata Endpoint , (b) Create BizTalk Receive Location in the in ur application.
  4. 打开WCF Web发布向导并检查(a)启用元数据端点,(b)在您的应用程序中创建BizTalk接收位置。

  5. Go to you BizTalk console and Enable the Receive location and Start your Application from Biztalk Console.
  6. 转到BizTalk控制台并启用接收位置并从Biztalk控制台启动应用程序。

  7. Then Browse it from IE or Fire Fox to check that either Service is running or Not. Now Service has been Develop. Lets do something for its Client.
  8. 然后从IE或Fire Fox中浏览它以检查服务是否正在运行。现在服务一直在发展。让我们为客户做点什么。

  9. Go to the Patah "c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\" and Write SVCUTL and your url of your service i.e. c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\svcutil localhost:axix//axx.svx?wsdl, this will copy the two files, one is output.config and other is BizTalkServiceInstance. cut and paste both files to your ciletn and then See you service desp for its consumption. I Think this is the most simplest which i tried to make. Thanks Abdul Aziz Farooqi.
  10. 转到Patah“c:\ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Bin \”并编写SVCUTL和您的服务URL,即c:\ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Bin \ svcutil localhost:axix // axx.svx?wsdl,这将复制两个文件,一个是output.config,另一个是BizTalkServiceInstance。将两个文件剪切并粘贴到您的ciletn然后查看服务desp以供其使用。我认为这是我试图做的最简单的。谢谢Abdul Aziz Farooqi。