1
votes

I have a flow which is exposing a webservice :-

<flow name="ServiceFlow" doc:name="ServiceFlow">

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

<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl"/>

</flow>

This web service have a operation insertDataOperation which takes all the input from SOAP request and insert it in Database... My SOAP request is as follow :-

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://services.test.com/schema/MainData/V1">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:insertDataRequest>
         <v1:Id>311</v1:Id>
         <v1:Name>ttttt</v1:Name>
         <v1:Age>56</v1:Age>
         <v1:Designation>eeeee</v1:Designation>
      </v1:insertDataRequest>
   </soapenv:Body>
</soapenv:Envelope>

Now I have another web service client flow which is consuming this webservice and the flow is :-

<flow name="ClientFlow" doc:name="ClientFlow">
 <file:inbound-endpoint responseTimeout="10000" connector-ref="File_Global" doc:name="File"  path="E:\backup\test">
            <file:filename-regex-filter pattern="SoapRequestInsert.xml" caseSensitive="false"/>
    </file:inbound-endpoint>
    <file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/>
<cxf:jaxws-client doc:name="SOAP" serviceClass="com.test.services.schema.maindata.v1.MainData" operation="insertDataOperation" port="MainDataPort" />
        <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP"/>
</flow>

Now here I am trying to consume the webservice by using a file inbound endpoint and passing the SOAP request in the file SoapRequestInsert.xml .. But the issue is that I don't get any error but the data is not inserted in database.. I checked the log .. where I found it enters the insert method of webservice implementation class but it doesn't get the input value ... Please help ... I have taken the reference from the following :- Consuming a JAX-WS in a Mule ESB flow

But It's not working .. what should I do to make it consume successfully and insert into DB ??? Pls help

2
What does com.test.services.schema.SOAPOptionalData.AddAttachmentMessageProcessor do? What is the format of the file? - David Dossot
It is used for adding custom attachment... Please ignore that line .. I forgot to remove that .. The service is actually working fine and I have tested with SOAPUI ... The issue is with Client flow ... - Anirban Sen Chowdhary
Updated the flow .. removed that line of code :-com.test.services.schema.SOAPOptionalData.AddAttachmentMessageProcessor - Anirban Sen Chowdhary
What is the format of the file? - David Dossot
I am passing a request from an xml file named SoapRequestInsert.xml to the Client flow as you can see the client flow has a file inbound endpoint that takes SoapRequestInsert.xml as request .. In log I can see it's entering into insertDataOperation() method of MainDataImpl but it is unable to get the iput data ... no errors are there but nothing happens and data is not getting inserted in DB ... I am using jdbcTemplate in Service to insert the data into DB - Anirban Sen Chowdhary

2 Answers

3
votes

Because the file you are posting contains the whole SOAP envelope you can HTTP POST it as is:

<flow name="ClientFlow" doc:name="ClientFlow"> <file:inbound-endpoint responseTimeout="10000" connector-ref="File_Global" doc:name="File" path="E:\backup\test"> <file:filename-regex-filter pattern="SoapRequestInsert.xml" caseSensitive="false"/> </file:inbound-endpoint> <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP"/> </flow>

Note that you may need to add the SOAP action header, before the http:outbound-endpoint:

<set-property name="SOAPAction"
     value="http://services.test.com/schema/MainData/V1/insertDataOperation" />
1
votes

The final working solution is as David suggested the flow and by setting SOAPAction before outbound endpoint :-

<set-property name="SOAPAction"
     value="http://services.test.com/schema/MainData/V1/insertDataOperation" />