Mule代理客户端没有为Soap 1.2消息创建标头

时间:2013-07-16 12:14:51

标签: .net soap proxy mule

我是Mule的新手并尝试建立从.Net客户端到Mule Proxy Web服务到Mule Proxy Client到.Net服务的小流量。流是直通流,流内没有任何逻辑。我正在尝试使用Soap 1.2。使用Soap 1.1,Flow工作正常。以下是使用的配置文件:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd 
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd 
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd 
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd 
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd ">
    <cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" doc:name="CXF Configuration"/><flow name="EndToEndWebserviceFlowEmp" doc:name="EndToEndWebserviceFlowEmp">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" doc:name="HTTP" path="EmpService"/>
        <logger message="After Http Inbound: #[message.payload]" level="INFO" doc:name="Logger"/>
        <cxf:proxy-service port="BasicHttpBinding_IEmpService" namespace="http://tempuri.org/" service="EmpService" payload="body" doc:name="SOAP" wsdlLocation="endtoendflow.wsdl"/>
        <logger message="First request: #[message.payload]" level="INFO" doc:name="Logger"/>
        <set-property propertyName="SOAPAction" value="http://tempuri.org/IEmpService/GetEmp" doc:name="Property"/>
        <set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
        <cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP" soapVersion="1.2"/><!--
        <custom-interceptor class="com.mulesoft.wcfconsumer.HeaderInterceptor"/>
        --><echo-component doc:name="Echo"/>
        <http:outbound-endpoint exchange-pattern="request-response" doc:name="HTTP" address="http://localhost:50006/EmpService.svc"/>
    </flow>
</mule>

Mule Proxy服务遵循Soap 1.1。 Mule代理客户端使用wsHttpBinding与WCF客户端交互,如下所示:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="TestService.EmpService">
        <endpoint address="" binding="wsHttpBinding" contract="TestService.IEmpService" />
        <endpoint address="Mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding>
          <security mode="None"></security>
        </binding>
      </wsHttpBinding>
      <basicHttpBinding>
        <binding transferMode="Buffered">
          <security mode="None"></security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

尝试从Mule客户端调用WCF服务时,我收到了Mule中生成的关注请求。以下请求中的命名空间显示它是Soap 1.2。它没有标题。

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><tem:GetEmp xmlns:tem="http://tempuri.org/"><tem:id>10</tem:id></tem:GetEmp></soap:Body></soap:Envelope>

由于此客户返回: 在消息上指定的SOAP操作&#39;&#39;与HTTP SOAP Action&#39; http://tempuri.org/IEmpService/GetEmp&#39;不匹配。要么 To元素为空。

请使用Mule代理建议如何使用所需格式制作soap 1.2消息  客户或者是否有其他解决方案。

我已经阅读了几篇建议使用拦截器的文章,但没有多大帮助。

由于 哈里什库马尔

2 个答案:

答案 0 :(得分:1)

您需要在出站呼叫中设置SOAPAction HTTP标头。
只需在HTTP出站端点之前添加:

<set-property propertyName="SOAPAction" value="#[message.inboundProperties['SOAPAction']]"  />

答案 1 :(得分:0)

使用此

<set-property propertyName="SOAPAction" value = "#[message.inboundProperties['SOAPAction'].replace(&quot;\&quot;&quot;,&quot;&quot;)]"/>

这将移除double quotes周围的SOAPAction

修改 有关double quotes的说明,请参阅此SO post