I am trying to read two simultaneously file in middle of the flow and combine them into one payload. To reading the files in middle of the flow I am using mule requester component. While triggering the flow (localhost:8081/requester/requester)I am getting error :
"Exception(s) were found for route(s):
0: The endpoint "src\main\resources\input1\employees.xml" is malformed and cannot be parsed. If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the "ref" attribute). Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead. (org.mule.api.endpoint.MalformedEndpointException).
1: The endpoint "src\main\resources\input2\employees2.xml" is malformed and cannot be parsed. If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the "ref" attribute). Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead. (org.mule.api.endpoint.MalformedEndpointException)."
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:mulerequester="http://www.mulesoft.org/schema/mule/mulerequester" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/mulerequester http://www.mulesoft.org/schema/mule/mulerequester/current/mule-mulerequester.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
<file:connector name="file-connector-config" autoDelete="false" streaming="true" validateConnections="true" doc:name="File" />
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" basePath="/requester" doc:name="HTTP Listener Configuration" />
<flow name="muleRequester">
<http:listener config-ref="HTTP_Listener_Configuration" path="/requester" doc:name="HTTP" />
<logger message="Invoking Mule Requester" level="INFO" doc:name="Logger" />
<scatter-gather doc:name="Scatter-Gather">
<mulerequester:request resource="src\main\resources\input1\employees.xml" returnClass="java.lang.String" doc:name="Retrieve File1"/>
<mulerequester:request resource="src\main\resources\input2\employees2.xml" returnClass="java.lang.String" doc:name="Retrieve File2"/>
</scatter-gather><dw:transform-message doc:name="Transform Message">
<dw:set-payload>< [CDATA[%dw 1.0 %output application/json
---
{
payload1: payload[0],
payload2: payload[1]
}]]></dw:set-payload>
</dw:transform-message>
<file:outbound-endpoint path="src/main/resources/output" responseTimeout="10000" doc:name="File"/>
<logger message="Payload after file requester #[payload]" level="INFO" doc:name="Logger" />
</flow>
I am not using maven. Do I need to download any other jar or where I can do the correction?
resource needs to be an Mule endpoint url. Mule requester module can work with many transports such as jms, file, ftp. So the path to the file is not enough. Here is an example of an endpoint url for reading a file:
<mulerequester:request resource="file://src/main/resources/in/ReadME.txt?connector=file-connector-config" doc:name="Retrieve File" returnClass="java.lang.String" />
You can also point to a global endpoint like you have defined like so:
<mulerequester:request config-ref="muleRequesterConfig" resource="myFileEndpoint" doc:name="Mule Requester" />
I have an Database connector from the selected data i use to create a file and I want to do HTTP post with file (created from the selected data in csv) along with other data (text) as attached in the screenshot. According to the mule documentation, the payload must be an outbound attachment which I am doing by using Set Attachment property. With this approach, I am setting the Content-Type for one of my attachment as application/CVS (as my file is of CVS type) and as text/plain for the other parameter. Any thoughts on achieving this? I have attached the screenshot of how the request looks like in Postman.
Below is the config XML..!!
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">
<spring:beans>
<spring:bean id="CSFMDataSource" name="CSFMDataSource" class="oracle.jdbc.pool.OracleDataSource">
<spring:property name="user" value="XXCCS_OSB_O"/>
<spring:property name="password" value="OrG2_BtN"/>
<spring:property name="dataSourceName" value="ds"/>
<spring:property name="URL" value="jdbc:oracle:thin:#(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=1)(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=scan-nprd-2023)(PORT=1541)))(CONNECT_DATA=(SERVICE_NAME=DV3CSF_SRVC_OTH.cisco.com)(SERVER=DEDICATED)))"/>
</spring:bean>
</spring:beans>
<db:oracle-config name="Oracle_Configuration" dataSource-ref="CSFMDataSource" doc:name="Oracle Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="tools-stage.cisco.com" port="80" doc:name="HTTP Request Configuration"/>
<flow name="testFlow">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="1" timeUnit="MINUTES"/>
<logger message="Log-1" level="INFO" doc:name="Logger"/>
</poll>
<db:select config-ref="Oracle_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[SELECT sol.SW_UPG_CONTRACT_NUMBER,
sol.service_level,
sol.BILL_TO_SITE_USE_ID,
sol.SERVICE_BEGIN_DATE,
sol.SERVICE_END_DATE,
0 Net_Price,
sol.PRODUCT_ORDER_NUMBER,
sol.SERIAL_NUMBER,
sol.SW_UPG_FULFILLMENT_PID,
sol.INSTALL_SITE_USE_ID,
sii.INSTANCE_ID,
DECODE (sii.INSTANCE_ID, 'Yes', 'No') softline,
'1232' cs_cse_number,
lg.error_message
FROM apps.XXCSS_SFM_ORDER_LINES sol,
apps.XXCSS_SFM_ERROR_LOG lg,
apps.XXCSS_SFM_INSTANCE_INTERFACE sii
WHERE 1 = 1
AND sol.order_type = 'INNVO_LINE'
AND sol.entitlement_status IN ('CSFM_ERROR', 'QA_FAILED')
--AND lg.so_header_id = sol.header_id
--AND lg.so_line_id = sol.line_id
AND lg.ERROR_TYPE = 'ERROR'
AND sol.header_id = sii.so_header_id(+)
AND sol.line_id = sii.so_line_id(+)
AND lg.sfdc_case_req = 'Y'
AND lg.sfdc_case_no IS NULL]]></db:parameterized-query>
</db:select>
<dw:transform-message doc:name="Transform Message" metadata:id="38e67a04-7f03-4261-a450-72b69ae0fff1">
<dw:set-payload><![CDATA[%dw 1.0
%output application/csv
---
payload map ((payload01 , indexOfPayload01) -> {
BILL_TO_SITE_USE_ID: payload01.BILL_TO_SITE_USE_ID as :number,
CS_CSE_NUMBER: payload01.CS_CSE_NUMBER,
ERROR_MESSAGE: payload01.ERROR_MESSAGE,
INSTALL_SITE_USE_ID: payload01.INSTALL_SITE_USE_ID as :number,
INSTANCE_ID: payload01.INSTANCE_ID,
NET_PRICE: payload01.NET_PRICE as :number,
PRODUCT_ORDER_NUMBER: payload01.PRODUCT_ORDER_NUMBER,
SERIAL_NUMBER: payload01.SERIAL_NUMBER,
SERVICE_BEGIN_DATE: payload01.SERVICE_BEGIN_DATE,
SERVICE_END_DATE: payload01.SERVICE_END_DATE,
SERVICE_LEVEL: payload01.SERVICE_LEVEL,
SOFTLINE: payload01.SOFTLINE,
SW_UPG_CONTRACT_NUMBER: payload01.SW_UPG_CONTRACT_NUMBER,
SW_UPG_FULFILLMENT_PID: payload01.SW_UPG_FULFILLMENT_PID
})]]></dw:set-payload>
</dw:transform-message>
<byte-array-to-object-transformer doc:name="Byte Array to Object"/>
<set-attachment attachmentName="filedata" value="#[payload]" contentType="application/csv" doc:name="Attachment"/>
<set-attachment attachmentName="casedata" value="{ "Origin":"Web", "CaseNumber":"33315931584", "SearchCCOID":"vimerugu"}" contentType="text/plain" doc:name="Attachment"/>
<set-payload value="#[null]" doc:name="Set Payload"/>
<http:request config-ref="HTTP_Request_Configuration" path="/cvcm/was70/pwc036/caseApi/updateCaseAttach/33315931584" method="POST" doc:name="HTTP" parseResponse="false">
<http:request-builder>
<http:header headerName="Authorization" value="Basic Q1BFQ2FzZUFQSS5nZW46Y2FzZTFnZW4="/>
</http:request-builder>
</http:request>
<logger message="#[flowVars.varCaseUpdate]" level="INFO" doc:name="Logger"/>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<db:insert config-ref="Oracle_Configuration" doc:name="Log_DB">
<db:parameterized-query><![CDATA[insert into XXCSS_SFM_OSB_EXECUTION_LOG (PROCESS_STATUS) values ('SFDCCaseCreationService-Exception')]]></db:parameterized-query>
</db:insert>
<db:insert config-ref="Oracle_Configuration" doc:name="SFDCCaseCreation- Exception">
<db:parameterized-query><![CDATA[insert into XXCSS_SFM_CESB_LOG_ERROR ( LOG_ERROR_ID,SERVICE_NAME,SERVICE_TYPE,SERVICE_ACTIVITY,SERVICE_PAYLOAD,LOG_ERROR_STATUS,
LOG_ERROR_MESSAGE,ERROR_CODE,ERROR_MESSAGE,ERROR_DETAILS,LOG_ERROR_SEVERITY,SUGGESTED_ACTION,NOTIFY_MAIL,NOTIFY_COUNT,ATTRIBUTE_1,
ATTRIBUTE_2,ATTRIBUTE_3,ATTRIBUTE_4,ATTRIBUTE_5,ATTRIBUTE_6,ATTRIBUTE_7,ATTRIBUTE_8,ATTRIBUTE_9,ATTRIBUTE_10,CREATED_BY,CREATION_DATE,LAST_UPDATED_BY,LAST_UPDATE_DATE,BATCH_ID)
values ('1000','SFDCCaseCreationService','SFDCCaseCreationServiceType','SFDCCaseCreationServiceActivity','SFDCCaseCreationServicePayload','ERROR','','Error_Code','Error_Message',
#[exception.getSummaryMessage()],'Critical','','NA',3,'','','','','','','','','','','SFDCCaseCreationService',sysdate,'SFDCCaseCreationService',sysdate,'1000')]]></db:parameterized-query>
</db:insert>
</catch-exception-strategy>
</flow>
</mule>
Please check if below link helps you.It tells how to read multiple files and process them.You can send them to required endpoint instead of FTP
How send a file in an HTTP request and upload it to file server via FTP in Mule
I am trying to copy file from one local folder to another when invoked via some http url but it is not working. In my destination folder some garbage file is getting created with .dat extension
Source folder - so1
Destination folder - so2
This is the message i get in the mule console on invoking the http endpoint
INFO 2017-10-27 14:02:45,346 [[each].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'File.dispatcher.33168380'. Object is: FileMessageDispatcher
INFO 2017-10-27 14:02:45,467 [[each].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'File.dispatcher.33168380'. Object is: FileMessageDispatcher
INFO 2017-10-27 14:02:45,488 [[each].HTTP_Listener_Configuration.worker.01] org.mule.transport.file.FileConnector: Writing file to: D:\so2\681cebe0-baf1-11e7-9534-0c7b20524153.dat
Here is the configuration XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:http="http://www.mulesoft.org/schema/mule/http" 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration" />
<file:connector name="File" writeToDirectory="D:\so2" readFromDirectory="D:\so1" autoDelete="false" streaming="true" validateConnections="true" doc:name="File" />
<flow name="eachFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/copy" doc:name="HTTP" />
<file:outbound-endpoint path="D:\so1" connector-ref="File" responseTimeout="10000" doc:name="File" />
<set-payload value="files copied" doc:name="Set Payload" />
</flow>
</mule>
No where your are reading the file in your configuration.
In your scenario, the file outbound endpoint just creates a new file with null payload with unknown file extension.
You can do in two ways,
1) Instead of HTTP inbound, you can use file inbound to read the file and then copy.
2) If you have to use HTTP inbound to copy the file on demand, use mule requester component in middle of configuration to read the file and then copy.
How to use mule requester, you can check here https://www.ricston.com/blog/reading-file-middle-flow-mule-requester/
UPDATE:
See the below configuration to read all the files from one folder and to copy to another folder using Mule requester.
<http:listener-config name="HTTP_Listener_Configuration"
host="localhost" port="8086" doc:name="HTTP Listener Configuration" />
<file:connector name="File"
autoDelete="true" streaming="false"
validateConnections="true" doc:name="File" moveToDirectory="C:\FilePOC\so2"/>
<flow name="Flow1">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/copy" doc:name="HTTP" />
<mulerequester:request-collection resource="file:///C:/FilePOC/so1?connector=File" doc:name="Mule Requester"/>
<set-payload value="File copy has been successful." doc:name="Set Payload"/>
</flow>
Here, no need to use the File outbound component to copy the files. The moveToDirectory option on File connector moves the file once the file has been read.
The other example on how to use Mule requester with JMS can be found here https://www.slideshare.net/anir37/using-mule-requester-for-jms
I have mule flow look like below
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8111" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="api.bonanza.com" port="443" doc:name="HTTP Request Configuration" protocol="HTTPS"/>
<flow name="bonanza_fetchtoken_ceFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/add" allowedMethods="GET,POST" doc:name="HTTP" />
<flow-ref name="bonanza_addfixedpriceitemSub_Flow" doc:name="bonanza_addfixedpriceitemSub_Flow"/>
</flow>
<sub-flow name="bonanza_addfixedpriceitemSub_Flow">
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="X-BONANZLE-API-DEV-NAME" value="t******I"/>
<add-message-property key="X-BONANZLE-API-CERT-NAME" value="l*****F"/>
</message-properties-transformer>
<set-property propertyName="Content-Type" value="application/x-www-form-urlencoded" doc:name="Property"/>
<set-property propertyName="Accept" value="application/json" doc:name="Property"/>
<set-variable variableName="sim" value="{requesterCredentials:{bonanzleAuthToken:nWn1a9l3NT}}" doc:name="Variable"/>
<scripting:transformer returnClass="java.util.Map" doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[import groovy.json.JsonBuilder
m = [addFixedPriceItemRequest:'{requesterCredentials:{bonanzleAuthToken:n*****T}}']
builder = new JsonBuilder()
builder(m)
]]></scripting:script>
</scripting:transformer>
<logger message="payload :#[payload]" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Request_Configuration" path="/api_requests/secure_request" method="POST" followRedirects="true" parseResponse="false" doc:name="HTTP">
<http:success-status-code-validator values="0..599"/>
</http:request>
<logger message="resp :#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
</sub-flow>
</mule>
I am able to receiving successful response from API using postman tool. I try to simulate same thing using above ESB mule flow. But API throws me an error as like below. Hence i have used requestb.in to compare the requests going from esb mule and postman tool. i found differences in the HTTP headers alone.
RAW body from postman to requestb.in -
addFixedPriceItemRequest={requesterCredentials:{bonanzleAuthToken:nW*****NT}}
RAW Body from ESB mule to requestb.in
addFixedPriceItemRequest=%7BrequesterCredentials%3A%7BbonanzleAuthToken%3AnW****NT%7D%7D
It seems that i have to serialize the json content before sending as content type - application/x-www-form-urlencoded. I found this info in this mule doc
How can i serialize json payload in groovy and sending as map payload?
API Error Response
{
"ack": "Failure",
"version": "1.0beta",
"timestamp": "2016-03-15T07:18:11.000Z",
"errorMessage": {
"message": "Cannot determine what type of request you are making. Often this can be the result of data that has not been escaped before being passed to the API. If you are passing data with quotation marks or other special characters, you should translate it to JSON, then escape it, before sending it over the API."
}
}
Please let me know for any additional info. Thanks in advance!
The flow got worked by adding key value pair in query parms in the http component. The flowVariable requestpayload has json string. So my Mule http component looks like below.
<http:request config-ref="HTTP_Request_Configuration" path="/api_requests/secure_request" method="POST" followRedirects="true" parseResponse="false" doc:name="HTTP">
<http:request-builder>
<http:query-param paramName="addFixedPriceItemRequest" value="#[flowVars.requestpayload]"/>
</http:request-builder>
<http:success-status-code-validator values="0..599"/>
</http:request>
Hi I'm playing around with a SOAP request, I am having trouble with the cxf proxy client. I'm basically sending a soap request to the http endpoint, removing the SOAP envelope, then trying to add it back it back on with the proxy client.
I'm expecting to get an unathorized response (as I'm removing the wsse headers).
However, I get the following soap response: "Response code 500 mapped as failure. Message payload is of type: BufferInputStream"
and the console logs the following (Note this is only the start of it)
WARN 2015-05-13 12:38:28,886 [[sandbox2].HTTP_Listener_Configuration.worker.01] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://support.cxf.module.mule.org/}ProxyService#{http://support.cxf.module.mule.org/}invoke has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Response code 500 mapped as failure. Message payload is of type: BufferInputStream
at org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:194) ~[mule-module-cxf-3.6.1.jar:3.6.1]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) ~[cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531) ~[cxf-rt-core-2.5.9.jar:2.5.9]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:462) ~[cxf-rt-core-2.5.9.jar:2.5.9]
Here is my flow
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/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.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8086" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="localhost" port="8080" basePath="my-app/RetrieveAct.svc" doc:name="HTTP Request Configuration"/>
<flow name="myFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<logger message="message received #[payload] " level="INFO" doc:name="Logger"/>
<cxf:proxy-service namespace="PfPolicyService" payload="body" doc:name="CXF"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<cxf:proxy-client payload="body" doc:name="CXF"/>
<response>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</response>
<http:request config-ref="HTTP_Request_Configuration1" path="http://localhost:8080/my-app/RetrieveAct.svc" method="POST" doc:name="HTTP">
<http:request-builder>
<http:header headerName="soapAction" value="getUserAcct"/>
</http:request-builder>
</http:request>
</flow>
</mule>
Can anyone explain what I am doing wrong and how to correct the issue?
Thanks
The issue you're experiencing is because your modification of the SOAP request is ending up as an invalid SOAP request, therefore the server cannot parse it and it is returning a 500 http status code.
You can use CXF's logging interceptors to be able to inspect the final result of what you're sending.
Your mule flow seems okey to me, the proxied service might blow up for all sorts of reasons.
Add logging interceptors to the proxy client and see whether this enables you to pinpoint the issue:
<cxf:proxy-client payload="body">
<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:proxy-client>
Or alternatively, use TPCMon to capture network traffic.
Setting up a service mock and proper test case first would be a good sanity check, before doing integration testing.