0

我是 Mule 的新手,并试图建立一个从 .Net 客户端到 Mule 代理 Web 服务到 Mule 代理客户端到 .Net 服务的小流程。流是直通流,流内部没有任何逻辑。我正在尝试使用肥皂 1.2。Flow 在 Soap 1.1 上运行良好。以下是使用的配置文件:

<?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 Proxy 客户端使用 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 操作“”与 HTTP SOAP 操作“ http://tempuri.org/IEmpService/GetEmp ”不匹配。或 To 元素为空。

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

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

谢谢哈里什库马尔

4

2 回答 2

1

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

<set-property propertyName="SOAPAction" value="#[message.inboundProperties['SOAPAction']]"  />
于 2013-07-16T13:52:10.663 回答
0

用这个

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

这将删除double quotes周围SOAPAction

编辑: 有关double quotes解释,请参阅此SO 帖子

于 2013-07-16T17:01:42.323 回答