0
votes

I am new to Mule and trying to establish a small flow from .Net Client to Mule Proxy web service to Mule Proxy Client to .Net Service. Flow is pass-through flow without any logic inside the flow. I am trying to use Soap 1.2. Flow is working fine with Soap 1.1. Following is the Configuration file used:

<?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 service is following Soap 1.1. Mule Proxy client is interacting with WCF client using wsHttpBinding as follows:

<?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>

While trying to invoke WCF service from Mule client I am getting following request generated in Mule. Namespace in below request shows it is of Soap 1.2. There are no headers in it.

<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>

Due to this client returns: The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IEmpService/GetEmp'. Or The To element is empty.

Please suggest how to make soap 1.2 message in required format using Mule proxy client or if some other solution is there.

I have read couple of articles suggesting using interceptor but did not help much.

Thanks Harish Kumar

2
With the help of interceptor I am able to build the header with relevant data so it is working now.Harish Kumar

2 Answers

0
votes

Use this

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

This will remove the double quotes surrounding SOAPAction

EDIT: For double quotes explanation, see this SO post

1
votes

You need to set the SOAPAction HTTP header in the outbound call.
Just add this before the HTTP outbound endpoint:

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