0
votes

I have a requirement where I need to expose a SOAP webservice .. So I have the following Mule flow :-

<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>

<flow name="Flow1" doc:name="Flow1" >
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData"  doc:name="SOAP"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<jms:outbound-endpoint queue="NewQueue" connector-ref="Active_MQ" doc:name="JMS" exchange-pattern="request-response"/>
<logger message="Response2 :- #[message.payload]" level="INFO" doc:name="Logger"/>
<mulexml:xml-to-object-transformer doc:name="XML to Object"/>
</flow>


<flow name="flow2" doc:name="flow2" >
<jms:inbound-endpoint connector-ref="Active_MQ" address="jms://tcp:NewQueue" doc:name="JMS" exchange-pattern="request-response" disableTemporaryReplyToDestinations="true" responseTimeout="90000"/>
<set-variable variableName="SOAPRequest" value="#[message.payload]" doc:name="Variable"/>
<mulexml:xml-to-object-transformer doc:name="XML to Object"/>
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl">
<method-entry-point-resolver>
        <include-entry-point method="retrieveDataOperation"/>
        <include-entry-point method="insertDataOperation"/>
        <include-entry-point method="updateDataOperation"/>
        <include-entry-point method="deleteDataOperation"/>
</method-entry-point-resolver>
</component>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
 </flow>

Here you can see the request is getting into JMS queue from the first flow and the second flow use JMS inbound takes it from the JMS queue and the webservice implemented class proccess it .. Now the service works fine without any issue .. the only issue is it get Mule Header in the SOAP in the response like the following :-

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <mule:header xmlns:mule="http://www.muleumo.org/providers/soap/1.0">
         <mule:MULE_CORRELATION_ID>ID:ANIRBAN-PC-49483-1408719168461-1:1:10:1:1</mule:MULE_CORRELATION_ID>
         <mule:MULE_CORRELATION_GROUP_SIZE>-1</mule:MULE_CORRELATION_GROUP_SIZE>
         <mule:MULE_CORRELATION_SEQUENCE>-1</mule:MULE_CORRELATION_SEQUENCE>
      </mule:header>
   </soap:Header>
   <soap:Body>
      <deleteDataResponse xmlns="http://services.test.com/schema/MainData/V1">
         <Response>Data not exists !!! Please provide correct ID</Response>
         <Id>0</Id>
         <Age>0</Age>
      </deleteDataResponse>
   </soap:Body>
</soap:Envelope>

Now please help me to remove the Mule headers from the SOAP response .. I tried with the following :- <cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData" enableMuleSoapHeaders="false" doc:name="SOAP"/> but no use .. it's still showing the Mule headers .. Please help ..

2
I was about to suggest using enableMuleSoapHeaders="false" (which is the correct way to go, see mulesoft.org/jira/browse/MULE-5581 ), but apparently it doesn't work for you. Maybe a regression? If you're 100% sure it doesn't work, then open a bug report with MuleSoft.David Dossot
Yes David .. I tried all the way .. I set it in CXF component it doesn't worked .. then I set it at Global CXF component and referred it from CXF component at Mule flow .. but result the sameAnirban Sen Chowdhary
Worth opening a JIRA then.David Dossot

2 Answers

0
votes

You can potentially get away with a temporary workaround until the enableMuleSoapHeaders="false" issue gets solved, by either:

  • Adding a between the HTTP inbound endpoint and the CXF service ; in order to remove the undue SOAP headers but XSL-Transformation
  • Using delete-message-property to remove the MULE_* props at the end of Flow1, right after the mulexml:xml-to-object-transformer
0
votes

I also found an alternate solution off adding it to cxf:outInterceptors

 <cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData"  doc:name="SOAP">
   <cxf:outInterceptors >
      <spring:bean id="outfault" class="com.test.services.schema.SOAPOptionalData.SOAPInterceptorOutboundHeaderRemover"/>
  </cxf:outInterceptors> 
</cxf:jaxws-service>

And in the Java class :-

public class SOAPInterceptorOutboundHeaderRemover extends AbstractSoapInterceptor {

public SOAPInterceptorOutboundHeaderRemover() {
super(Phase.PRE_PROTOCOL);
}

@Override
public void handleMessage(SoapMessage arg0) throws Fault {
List<Header> headerList = arg0.getHeaders();
Header muleHeader = null;
boolean isMuleHeader = false;
for (Header header : headerList) {
ElementNSImpl element = (ElementNSImpl) header.getObject();
if ("mule:header".equals(element.getNodeName())) {
isMuleHeader = true;
muleHeader = header;
}
}
if (isMuleHeader) {
arg0.getHeaders().remove(muleHeader);
}

}
}

And this is also working fine