2013-07-16 31 views
0

我是Mule的新手,並試圖建立從.Net客戶端到Mule代理服務器到Mule代理客戶端到.Net服務的小流量。流程是流程內沒有任何邏輯的傳遞流程。我正在嘗試使用Soap 1.2。 Flow在Soap 1.1中運行良好。以下是使用的配置文件:Mule代理客戶端沒有爲Soap 1.2消息創建頭文件

<?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代理服務跟隨肥皂1.1。騾子代理客戶端使用的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服務。命名空間在下面的請求顯示它是肥皂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代理 客戶端或如果有其他解決方案,以所需格式製作肥皂1.2消息。

我讀過幾篇文章,建議使用攔截器,但沒有多大幫助。

感謝 哈里什·庫馬爾

+0

在攔截器的幫助下,我可以用相關的數據構建標題,因此它現在可以工作。 –

回答

0

使用此

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

這將刪除double quotes周邊SOAPAction

編輯:double quotes說明,請參閱本SO post

+0

道歉。我和其他一些我沒有機會回覆的東西綁在一起。 –

+0

看我的編輯.... –

1

您需要設置SOAPAction HTTP頭在出站呼叫。
的HTTP出站端點之前就補充一點:

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

謝謝Seba。我已將該屬性添加到我的配置中,但具有硬編碼值。當我在配置文件中使用上面的行時,我用雙引號返回數據。我使用攔截器來操縱標題,因爲我認爲屬性不能將「To」元素添加到標題。您能否建議如何從您提供的代碼返回的值中刪除'''?我正在使用以下代碼獲取此值:message.getContextualProperty(「SOAPAction」) –

+0

您是否意味着您收到一個已經具有SOAP操作的入站屬性用雙引號? – Seba

+0

道歉,我和其他一些我沒有機會回覆的東西綁在一起,我沒有明確地給出任何雙引號,我只是粘貼了你給的東西,當我試圖在Interceptor中訪問它時給出了額外的雙引號,我使用調試器進行了檢查,但是當我通過硬編碼值時,它工作正常 –