Biztalk WCF适配器如何从biztalk发送空消息体响应

时间:2011-07-04 14:43:31

标签: wcf biztalk

我通过请求响应WCF端口消耗了Biztalk业务流程。由于客户端对回复不感兴趣(即火灾和遗忘),我只想在响应中发送肥皂消息正文。    

因为我知道Biztalk WCF适配器不支持真正的单向操作。 我尝试发送一个空的XML文档,但我收到一个EmptyPartException XLANG错误。有关如何发送邮件正文的任何​​建议吗?

2 个答案:

答案 0 :(得分:1)

我之前通过使用IIS和BizTalk接收位置与WCF-CustomIsolated适配器完成了此操作。

在WCF-CustomIsolated的接收位置的传输配置中,Binding应设置为httpTransport。那里没有其他配置。如果你想使用基本身份验证(确保它通过SSL!)并启用HTTP GET来提供WCF元数据(在生产中不是一个好主意),那么导出的配置看起来像这样(对于BizTalk 2010):

<?xml version="1.0"?>
<configuration>
  <enterpriseLibrary.ConfigurationSource selectedSource="ESB File Configuration Source" />
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="BizTalk">
        <endpoint address="http://localhost/MyAwesomeService/SuperiorEndpoint.svc" behaviorConfiguration="EndpointBehavior" binding="customBinding" bindingConfiguration="88BC0BD4-A7DD-11E0-86EF-DF374824019B" name="WcfService_AwesomeService/SuperiorEndpoint" contract="BizTalk" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="EndpointBehavior" />
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="" httpsGetEnabled="true" httpsGetUrl="" />
          <serviceDebug />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <customBinding>
        <clear />
        <binding name="88BC0BD4-A7DD-11E0-86EF-DF374824019B">
          <httpTransport authenticationScheme="Basic" />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>
</configuration>

我使用BizTalk WCF服务发布向导生成实际的WCF服务,传输类型设置为WCF-CustomIsolated。用于创建WCF服务的方法是“将架构发布为WCF服务”。当然,您必须首先将BizTalk架构编译到程序集中。

对于 Web服务描述,我删除了默认的Operation / web方法,并为该服务添加了一个新的单向Web方法。要为输入消息设置架构,请右键单击它,选择“选择架构”,然后浏览到BizTalk架构的程序集。当然,你应该恰当地命名一切。发布服务后,跳转到IIS(或新创建的web.config)以配置闪亮的新Web应用程序(即其身份验证和授权)。

您可能需要更多地调整它以使所有内容完全按照您的需要工作,但我能够为BizTalk创建WCF服务以接受非常简单的HTTP Post。然后响应如下:

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 84
Content-Type: application/soap+xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 06 Jul 2011 14:16:58 GMT

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body/></s:Envelope>

只需确保调用者可以理解HTTP状态代码,就好像出现问题一样,这就是表明问题的原因(即HTTP 501等)。您也可以尝试

答案 1 :(得分:0)

如果您只对异步发送感兴趣,请使用WCF-NetMsmq适配器。或者我错过了什么?

相关问题