Renjith
Renjith

Reputation: 1154

Replacing the deprecated https:outbound-endpoint with http:request in Mule

I was using the following configuration to hit a SOAP based service in mule 3.2, which works fine

<https:connector name="https" doc:name="HTTP\HTTPS"></https:connector>

<https:outbound-endpoint exchange-pattern="request-response" method="POST" 
            address="https://localhost:8080/CXF3Service/test" responseTimeout="15000" contentType="application/xml" 
            doc:name="HTTP Submit Request SOAP" connector-ref="https"> <message-properties-transformer 
            scope="outbound"> <add-message-property key="SOAPAction" value="https://myservice/myEndpoint" 
            /> </message-properties-transformer> </https:outbound-endpoint>

enter image description here

SOAP Binding in wsdl will look like,

<wsdl:operation name="sayHello">
<soap:operation soapAction="https://myservice/myEndpoint" style="document"/>
<wsdl:input name="sayHello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

On migrating to Mule 3.6, i replaced the code as follows. this was done to replace the deprecated https:outbound-endpoint with http:request

<http:request-config name="http" protocol="HTTPS"
        host="localhost" port="8080"
        doc:name="HTTP Request Configuration"/>

<http:request config-ref="http" path="CXF3Service/test" method="POST"
            doc:name="HTTP" responseTimeout="15000" >
            <http:request-builder>
                <http:header headerName="SOAPAction" value="https://myservice/myEndpoint" ></http:header>
            </http:request-builder>         
            <http:success-status-code-validator
                values="0..599" />
        </http:request>

enter image description here

But on hitting the service with new code, i am getting a SOAP Fault as response.

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Server did not recognize the value of HTTP Header SOAPAction: https://myservice/myEndpoint, "".</faultstring>
      <detail/>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

What could be the possible reason for this?

FYI. I am using a cxf:proxy-client with payload as envelope, which remains unchanged for both.

<cxf:proxy-client payload="envelope" doc:name="Proxy client">
    <cxf:inInterceptors>
        <spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
            <spring:property name="prettyLogging" value="true" />
        </spring:bean>
    </cxf:inInterceptors>
    <cxf:outInterceptors>
        <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
            <spring:property name="prettyLogging" value="true" />
        </spring:bean>
    </cxf:outInterceptors>
    <cxf:outFaultInterceptors>
        <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
            <spring:property name="prettyLogging" value="true" />
        </spring:bean>
    </cxf:outFaultInterceptors>
</cxf:proxy-client>

Upvotes: 2

Views: 1674

Answers (1)

Renjith
Renjith

Reputation: 1154

Small tweak did the magic!!

I set the SOAPAction before the http:request instead of setting it inside.

<cxf:proxy-client payload="envelope" doc:name="Proxy client">
<cxf:inInterceptors>
    <spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
        <spring:property name="prettyLogging" value="true" />
    </spring:bean>
</cxf:inInterceptors>
<cxf:outInterceptors>
    <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
        <spring:property name="prettyLogging" value="true" />
    </spring:bean>
</cxf:outInterceptors>
<cxf:outFaultInterceptors>
    <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
        <spring:property name="prettyLogging" value="true" />
    </spring:bean>
</cxf:outFaultInterceptors>
</cxf:proxy-client>
  <message-properties-transformer>
      <add-message-property key="SOAPAction" value="https://myservice/myEndpoint"/>
    </message-properties-transformer>
    <http:request config-ref="http" path="CXF3Service/test" method="POST"
        doc:name="HTTP" responseTimeout="15000" >        
        <http:success-status-code-validator
            values="0..599" />
    </http:request>

Upvotes: 1

Related Questions