Skip to main content

#Vars.httpStatus Default 2000 discussing

I would like to create an endpoint for uploading files with different Media/Content-Types (csv,jpg,xlsx... etc).

 

preferably using 1 flow.

How do I change a header value in the attributs 

In my main flow I would like to store the original Content-Type Header value and then replace it with "application/*" so the APIkit will route it to the postfile flow.main flowBut I can't get it to work.

 

This is what I have so far:

 

<flow name="test-main">

<http:listener config-ref="test-httpListenerConfig" path="/*">

<http:response statusCode="#vars.httpStatus default 200">

<http:headers><![CDATA[#vars.outboundHeaders default {}]]></http:headers>

</http:response>

<http:error-response statusCode="#vars.httpStatus default 500">

<http:body><![CDATA[#payload]]></http:body>

<http:headers><![CDATA[#vars.outboundHeaders default {}]]></http:headers>

</http:error-response>

</http:listener>

<set-variable value='#attributes.headers."content-type"' doc:name="Save Content-Type" variableName="headerContentType"/>

<ee:transform doc:name="Override Content-Type" >

<ee:message >

<ee:set-attributes ><![CDATA[%dw 2.0

import * from dw::util::Values

---

if (lower(attributes.method) == "post"

and

lower(attributes.headers."content-type") != "application/json"

)

// A file is POSTed, force the content-type to the correct API Kit Route

attributes update ["headers", field("content-type")] with "application/*"

//as Object {

// class: "org.mule.extension.http.api.HttpRequestAttributes"

//}

else

attributes

]]></ee:set-attributes>

</ee:message>

</ee:transform>

<apikit:router config-ref="test-config" />

</flow>

 

This is my test application

 

In Mule 3 I did this with a custom-transformer and a Java class, but that doesn't work anymore in Mule 4.

 

I hope someone here can help me with this problem.

2 answers
  1. Jul 21, 2021, 3:10 PM

    I found a solution by building the whole attributes object from scratch

     

    <ee:transform doc:name="Override Content-Type">

    <ee:message >

    <ee:set-attributes ><![CDATA[%dw 2.0

    output application/java

    fun updAttr(headers) =

    headers update {

    case ."content-type" -> "application/*"

    }

    ---

    if (lower(attributes.method) == "post"

    and

    lower(attributes.headers."content-type") != "application/json"

    )

    {

    listenerPath: attributes.listenerPath,

    rawRequestPath: attributes.rawRequestPath,

    relativePath: attributes.relativePath,

    version: attributes.version,

    scheme: attributes.scheme,

    method: attributes.method,

    requestUri: attributes.requestUri,

    rawRequestUri: attributes.rawRequestUri,

    queryString: attributes.queryString,

    localAddress: attributes.localAddress,

    remoteAddress: attributes.remoteAddress,

    queryParams: attributes.queryParams,

    uriParams: attributes.uriParams,

    requestPath: attributes.requestPath,

    headers: updAttr(attributes.headers)

    }

    as Object {

    class: "org.mule.extension.http.api.HttpRequestAttributes"

    }

    else 

    attributes]]></ee:set-attributes>

    </ee:message>

    <ee:variables >

    </ee:variables>

    </ee:transform>

     

    I left out items:

    • maskedRequestPath (resulted in "Invalid property name: `maskedRequestPath` on class `org.mule.extension.http.api.HttpRequestAttributesBuilder`")
    • clientCertificate (resulted in "Errors while creating org.mule.runtime.api.util.SerializableLazyValue by reflection, even when class in on classpath")
0/9000

I tried to use <on-error ref="test-error-handler"/> to reference the error handling strategy in the Mule Application. I created new test application using Anypoint Studio v7.17 and I encountered that this element causes compilation errors. Has anyone also encountered such a problem and know how to resolve this?

 

<app.runtime>4.6.2</app.runtime>

<mule.maven.plugin.version>4.2.0</mule.maven.plugin.version>

 

Error Message:

[ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:4.2.0:process-classes (default-process-classes) on project common-extend-test: Fail to compile: Cannot invoke "org.mule.runtime.ast.api.ComponentParameterAst.getRawValue()" because the return value of "org.mule.runtime.config.internal.validation.AbstractErrorValidation.getErrorTypeParam(org.mule.runtime.ast.api.ComponentAst)" is null -> [Help 1]

 

Configuration XML:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd ">

<flow name="test-raml-main">

<http:listener config-ref="test-raml-httpListenerConfig" path="/api/*">

<http:response statusCode="#vars.httpStatus default 200">

<http:headers>#vars.outboundHeaders default {}</http:headers>

</http:response>

<http:error-response statusCode="#vars.httpStatus default 500">

<http:body>#[payload]</http:body>

<http:headers>#vars.outboundHeaders default {}</http:headers>

</http:error-response>

</http:listener>

<apikit:router config-ref="test-raml-config" />

<error-handler >

<on-error ref="test-error-handler"/>

<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="4a2c18e6-d4a4-4659-afb3-0108f1074b3c" >

<logger level="INFO" doc:name="Logger" doc:id="318a7585-7926-4dc6-b76a-5ffe72f392b2" />

</on-error-continue>

</error-handler>

</flow>

<error-handler name="test-error-handler" doc:id="c849264d-d1d4-4a06-b3a0-3b4e3cbf1e35">

<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="19e4b41a-b088-4d78-b40a-b6370718e943" type="EXPRESSION">

<logger level="INFO" doc:name="Logger" doc:id="f8acc841-b047-44ac-88fc-cfbc0b33e40f" />

</on-error-continue>

</error-handler>

<flow name="get:\test:test-raml-config">

<logger level="INFO" message="get:\test:test-raml-config" />

</flow>

</mule>

5 answers
  1. Jun 11, 2024, 1:50 PM

    Hi ,

    It looks like there is a reference to a common error handler and another 'on error continue' statement present, which is causing the error. Please remove it.

     

    current inside main flow test-raml-main

    <on-error ref="test-error-handler"/>

    <on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="4a2c18e6-d4a4-4659-afb3-0108f1074b3c" >

    <logger level="INFO" doc:name="Logger" doc:id="318a7585-7926-4dc6-b76a-5ffe72f392b2" />

     

    </on-error-continue>

    </error-handler>

     

    instead only have this

    <error-handler ref="test-error-handler" />

     

    Hi ,It looks like there is a reference to a common error handler and another 'on error continue' statement present, which is causing the error. Please remove it. 

0/9000
  1. The mule 3 expression component code is :

 

if (flowVars.activityInstanceName == "Provision Device"){

flowVars.rng = randomNumber(10, 5);

Thread.sleep(flowVars['rng']);

}

 

Need to achieve this in mule 4.

 

2 I have migrated mule 3 code to mule using MMA.

The migrated code is:

mel:json:Notification

 

Instead of this can i use this payload.Notification?

21 answers
  1. Feb 2, 2024, 8:16 AM

    I have a mule 3 code flow as below:

    I have a mule 3 code flow as below:Here we are getting a data from get activity instance details and then we are converting the code hashmap.Here we are getting a data from get activity instance details and then we are converting the code hashmap.

     

    Now the get activity instance code we have converted from mule 3 to mule 4. So, for the mule 3 it was working fine and for mule 4 it was failing.

    what i observerd is change in response for mule 3 and mule 4 check below:

    Get activity instance details mule 3 response:

    {"CreatedBy":{"Wifi_ProfileName__c":"PT1","Username":"ys1","Id":null,"type":"User"},"Activity__c":"a2360000"}

     

    Get activity instance details mule 4 response:

    [

     {

      "CreatedBy": {

       "Wifi_ProfileName__c": "PT1",

       "Username": "ys11",

       "Id": null,

       "type": "User"

      },

      "Activity__c": "a23600" }

    ]

     

    Mule 3 and mule 4 code images:

     

    image 

    image 

    image 

    Here at the mule 4 end of flow i added transform message as application json and i think because of that it is not working

0/9000

15:53:24.604   06/12/2023   Worker-0   [MuleRuntime].uber.23: [orl-adtech-sys-api-v1-dev].global-error-handler/0/processors/3.ps.BLOCKING @3f034df3    ERROR

event:1c68bb20-090b-11ee-900f-06e03f45f0b5

********************************************************************************

Message : Client connection was closed

Element : main/source @ orl-adtech-sys-api-v1-dev:interface.xml:4 (listener)

Element DSL : <http:listener doc:name="listener" doc:id="ffc4fb0e-fb9a-45f9-93b2-21a500ac2e1d" config-ref="http-listener-config" path="${http.basePath}">

<http:response statusCode="#vars.httpStatus default 200"></http:response>

<http:error-response statusCode="#vars.httpStatus default 500">

<http:body><![CDATA[

#payload

]]></http:body>

</http:error-response>

</http:listener>

Error type : MULE:SOURCE_RESPONSE_SEND

FlowStack :

Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider

--------------------------------------------------------------------------------

Root Exception stack trace:

java.io.EOFException

at org.glassfish.grizzly.nio.transport.TCPNIOTransport.read(TCPNIOTransport.java:611)

at org.glassfish.grizzly.nio.transport.TCPNIOTemporarySelectorReader.readNow0(TCPNIOTemporarySelectorReader.java:65)

at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read0(TemporarySelectorReader.java:171)

at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read0(TemporarySelectorReader.java:141)

at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read(TemporarySelectorReader.java:113)

at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read(TemporarySelectorReader.java:75)

at org.glassfish.grizzly.AbstractReader.read(AbstractReader.java:72)

at org.glassfish.grizzly.nio.transport.TCPNIOTransportFilter.handleRead(TCPNIOTransportFilter.java:78)

at org.glassfish.grizzly.filterchain.TransportFilter.handleRead(TransportFilter.java:173)

at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.read(DefaultFilterChain.java:352)

at org.glassfish.grizzly.filterchain.FilterChainContext.read(FilterChainContext.java:736)

at org.glassfish.grizzly.http.io.InputBuffer.blockingRead(InputBuffer.java:1103)

at org.glassfish.grizzly.http.io.InputBuffer.fill(InputBuffer.java:1127)

at org.glassfish.grizzly.http.io.InputBuffer.read(InputBuffer.java:348)

at org.mule.service.http.impl.service.server.grizzly.BlockingTransferInputStream.read(BlockingTransferInputStream.java:65)

at org.mule.runtime.core.internal.streaming.bytes.AbstractInputStreamBuffer.consumeStream(AbstractInputStreamBuffer.java:111)

at com.mulesoft.mule.runtime.core.internal.streaming.bytes.FileStoreInputStreamBuffer.consumeForwardData(FileStoreInputStreamBuffer.java:239)

at com.mulesoft.mule.runtime.core.internal.streaming.bytes.FileStoreInputStreamBuffer.consumeForwardData(FileStoreInputStreamBuffer.java:202)

at com.mulesoft.mule.runtime.core.internal.streaming.bytes.FileStoreInputStreamBuffer.doGet(FileStoreInputStreamBuffer.java:125)

at org.mule.runtime.core.internal.streaming.bytes.AbstractInputStreamBuffer.get(AbstractInputStreamBuffer.java:93)

at org.mule.runtime.core.internal.streaming.bytes.BufferedCursorStream.assureDataInLocalBuffer(BufferedCursorStream.java:126)

at org.mule.runtime.core.internal.streaming.bytes.BufferedCursorStream.doRead(BufferedCursorStream.java:101)

at org.mule.runtime.core.internal.streaming.bytes.AbstractCursorStream.read(AbstractCursorStream.java:124)

at org.mule.runtime.core.internal.streaming.bytes.BufferedCursorStream.read(BufferedCursorStream.java:26)

at java.io.InputStream.read(InputStream.java:101)

at org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamDecorator.read(ManagedCursorStreamDecorator.java:96)

at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1158)

at org.apache.commons.io.IOUtils.copy(IOUtils.java:878)

at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1135)

at org.apache.commons.io.IOUtils.copy(IOUtils.java:854)

at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:2240)

at org.mule.module.apikit.helpers.PayloadHelper.getPayloadAsByteArray(PayloadHelper.java:37)

at org.mule.module.apikit.helpers.PayloadHelper.getPayloadAsString(PayloadHelper.java:28)

at org.mule.module.apikit.validation.BodyValidator.validateAsString(BodyValidator.java:131)

at org.mule.module.apikit.validation.BodyValidator.validate(BodyValidator.java:88)

at org.mule.module.apikit.validation.RestRequestValidator.validate(RestRequestValidator.java:60)

at org.mule.module.apikit.api.validation.RequestValidator.validate(RequestValidator.java:44)

at org.mule.module.apikit.api.validation.RequestValidator.validate(RequestValidator.java:29)

at org.mule.module.apikit.Router.doRoute(Router.java:165)

at org.mule.module.apikit.Router.processEvent(Router.java:150)

at org.mule.module.apikit.Router.processWithExtension(Router.java:138)

at org.mule.runtime.core.internal.util.rx.RxUtils.lambda$flatMap$13(RxUtils.java:340)

at reactor.core.publ

2 answers
  1. Jun 13, 2023, 5:26 AM

    Hi,

    This happens typically happens when an HTTP listener attempts to stream a response but the client had already closed the connection.

    Please go through below link :MULE-SOURCE-RESPONSE-SEND

    Best,

    Prathamesh K.

    Mulesoft Mentor

0/9000

I'm having a problem with an integration once deployed, but it works locally. The structure of the integration looks like this

 

Database SAPI <-> PAPI <-> SFTP SAPI

 

The PAPI calls the Database SAPI and the Database SAPI calls a stored procedure and compresses the result. Then, the PAPI sends data to the SFTP SAPI, which writes the data to an SFTP file location.

 

Once I deploy, I'm getting this error in response from the SFTP SAPI midway through execution of the integration. Can anyone help me narrow my issue down?

 

HTTP response sending task failed with error: java.util.concurrent.TimeoutException

********************************************************************************

Message               : java.util.concurrent.TimeoutException

Element               : sftp-sapi-main/source @ sftp-sapi:interface.xml:4

Element DSL           : <http:listener config-ref="sftp-sapi-httpListenerConfig" path="/api/*">

<http:response statusCode="#vars.httpStatus default 200">

<http:headers><![CDATA[

#vars.outboundHeaders default {}

]]></http:headers>

</http:response>

<http:error-response statusCode="#vars.httpStatus default 500">

<http:body><![CDATA[

#payload

]]></http:body>

<http:headers><![CDATA[

#vars.outboundHeaders default {}

]]></http:headers>

</http:error-response>

</http:listener>

Error type            : MULE:SOURCE_RESPONSE_SEND

FlowStack             :

Payload Type          : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider

--------------------------------------------------------------------------------

6 answers
  1. Jan 10, 2023, 4:37 PM

    Hi Shyram,

     

    I've seen that article before, but the HTTP request connector I'm using doesn't have that as an option. I've included a screenshot of the general and the advance tab. The advance tab leads me to believe there's already a streaming strategy in place. Do you have any advice for configuring the streaming strategy?Hi Shyram, I've seen that article before, but the HTTP request connector I'm using doesn't have that as an option. I've included a screenshot of the general and the advance tab.Capture2

0/9000

I have deployed application on cloud hub after deployment it has generated App url = flightdetails.us-e2.cloudhub.io. I have modified the URL per my implementation i.e. http://flightdetails.us-e2.cloudhub.io/api/flights, but its giving error 502 Bad Gateway. Can someone please suggest what could be the root cause. Please note that I can see in the logs that application has started successfully.

There are no errors in implementation, I have tested locally. In main process its just sending the dummy response back.

And I am directly using the app url and not via gateway

5 answers
  1. Sep 26, 2022, 3:42 PM

    I had the same issue. My browser was forcing me to use https and when I changed it to HTTP it worked perfectly

0/9000

Hi Team,

 

I am trying to use parallel for-each to publish the data into Anypoint MQ. I am able to publish the data successfully but in logs i can see some error.

 

Can any one help me on this.

 

Error

ERROR 2021-06-23 18:53:51,795 [[MuleRuntime].uber.04: [eapi-customer-rocky-oem].patch:\consents:application\json:eapi-customer-rocky-oem-config.BLOCKING @5f1f8d95] [processor: ; event: 3ed40460-d426-11eb-8f90-14f6d87d8107] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 

********************************************************************************

Message        : Could not serialize object

Element        : eapi-customer-rocky-oem-main/source @ eapi-customer-rocky-oem:eapi-customer-rocky-oem.xml:9

Element DSL      : <http:listener config-ref="eapi-customer-rocky-oem-httpListenerConfig" path="/v1/*">

<http:response statusCode="#vars.httpStatus default 200">

<http:headers>#vars.outboundHeaders default {}</http:headers>

</http:response>

<http:error-response statusCode="#vars.httpStatus default 500">

<http:body>#payload</http:body>

<http:headers>#vars.outboundHeaders default {}</http:headers>

</http:error-response>

</http:listener>

Error type      : MULE:SOURCE_RESPONSE_SEND

FlowStack       : 

 

 (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

1 answer
  1. Jun 23, 2021, 1:54 PM

    MULE:SOURCE_RESPONSE_SEND means that an error occurred in the source of the flow processing a successful response.

     

    Did you check if you are responding to the HTTP Request with a valid response?

0/9000

<?xml version="1.0" encoding="UTF-8"?>

 

<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">

<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="3e081917-1381-4106-a2fa-a9c4d8180881" >

<http:listener-connection host="0.0.0.0" port="8081" />

</http:listener-config>

<db:config name="Database_Config" doc:name="Database Config" doc:id="4be42af6-7e1c-4b97-b5ed-6718d5aaf398" >

<db:my-sql-connection host="mudb.learn.mulesoft.com" port="3306" user="mule" password="mule" database="training"/>

</db:config>

<flow name="training4-american-wsFlow" doc:id="0fe44c96-8928-4eed-83ae-937a742fc24e" >

<http:listener doc:name="Listener" doc:id="43e1d8fb-4de1-4173-8ec9-5666c480529b" config-ref="HTTP_Listener_config" path="/flights"/>

<db:select doc:name="Select" doc:id="74c0406a-9130-445f-95f5-5a4ff5b01fee" config-ref="Database_Config">

<db:sql >SELECT *

FROM american</db:sql>

</db:select>

</flow>

</mule>

12 answers
  1. Jan 16, 2021, 9:07 AM

    Hello @Srinivas Pachari​ ,

     

    your welcome, just for other developers I am describing the fix of your issue.

     

    1. recreated the HTTP configurations
    2. added new HTTP listener with some more configurations for response
    3. in transform message just after db connector used output application/json

     

    Thanks,

    Anurag Sharma

0/9000

Hi guys, I got an Issue. In runtime 4.1.4 is fine but upgrading to to 4.2.2-hf2 got some error even success update or insert in DB. Both local or cloudhub runtime has same issue. Errors are No value present. org.mule.extension.db.api.StatementResult.Message              : No value present.

Element              : wh-slave-data-process-main/source @ wh-slave-data-process:wh-slave-data-process.xml:7 (Listener-HTTPS)

Element XML          : <http:listener config-ref="wh-slave-data-process-httpListenerConfig" path="/api/v1/*" doc:name="Listener-HTTPS">

                       <http:response statusCode="#vars.httpStatus default 200"></http:response>

                       <http:error-response statusCode="#vars.httpStatus default 500">

                       <http:body>#payload</http:body>

                       </http:error-response>

                       </http:listener>

Error type           : MULE:SOURCE_RESPONSE_SEND

Payload Type         : org.mule.extension.db.api.StatementResult

--------------------------------------------------------------------------------

Root Exception stack trace:

java.util.NoSuchElementException: No value present

   at java.util.Optional.get(Optional.java:135)

   at org.mule.runtime.core.internal.context.DefaultMuleContext.getDefaultErrorHandler(DefaultMuleContext.java:868)

   at org.mule.runtime.core.privileged.client.MuleClientFlowConstruct.getExceptionListener(MuleClientFlowConstruct.java:60)

   at org.mule.runtime.core.internal.event.DefaultEventContext.<init>(DefaultEventContext.java:159)

   at org.mule.runtime.core.api.event.EventContextFactory.create(EventContextFactory.java:87)

   at org.mule.runtime.core.api.event.EventContextFactory.create(EventContextFactory.java:46)

   at (more) .....

********************************************************************************

3 answers
  1. Oct 22, 2020, 8:10 AM

    org.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation

    {

     payload=org.mule.extension.db.api.StatementResult@6f58bfb5

     mediaType=application/java; charset=UTF-8

     attributes=<not set>

     attributesMediaType=*/*

     exceptionPayload:

       message=No value present.

       exception=org.mule.runtime.core.internal.exception.MessagingException: No value present.; ErrorType: MULE:SOURCE_RESPONSE_SEND

    }

0/9000

I have a listener listening for soap request:

 

<flow name="application-main">

<http:listener config-ref="storis-httpListenerConfig"

path="${application.path}">

<http:response

statusCode="#vars.httpStatus default 200">

<http:body>#payload</http:body>

<http:headers>#attributes.protocolHeaders default {}</http:headers>

</http:response>

<http:error-response

statusCode="#vars.httpStatus default 500">

<http:body>#payload</http:body>

<http:headers>#attributes.protocolHeaders default {}</http:headers>

</http:error-response>

 

</http:listener>

<apikit-soap:router

config-ref="application-soapkit-config">

<apikit-soap:message>#payload</apikit-soap:message>

<apikit-soap:attributes>#[

%dw 2.0

output application/java

---

{

headers: attributes.headers,

method: attributes.method,

queryString: attributes.queryString

}]

</apikit-soap:attributes>

</apikit-soap:router>

</flow>

 

I have a validation check in the main flow, like following

 

<validation:is-null

message="UUID cannot be null or empty string"

value="#vars.application.UUID" doc:name="Validation" />

 

Then I have error handler handling the validation error:

 

<on-error-propagate enableNotifications="true"

logException="true" type="VALIDATION:NOT_NULL">

<ee:transform

xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"

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/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"

doc:id="cdafca59-789a-4ed5-873b-f593dedf12c5"

doc:name="Validation Error">

<ee:message>

<ee:set-payload><![CDATA[%dw 2.0

output application/java

ns soap http://schemas.xmlsoap.org/soap/envelope

---

{

  body: {

    soap#Fault: {

      faultcode: "soap:Server",

      faultstring: "VALIDATION FAILED"

    }

  } write "application/xml"

}]]></ee:set-payload>

</ee:message>

<ee:variables>

<ee:set-variable variableName="httpStatus"><![CDATA[400

]]></ee:set-variable>

</ee:variables>

</ee:transform>

<logger level="INFO" doc:name="Logger" doc:id="1f617926-b084-4cd6-86b5-cf8864219963" message="After Validation error handling: #payload"/>

</on-error-propagate>

 

I saw the error handling payload but it is not thrown to the client, the response client got is still the request. Can't figure out why the error payload is not returning back to the calling client.

1 answer
  1. Sep 8, 2020, 4:19 PM

    You cannot set a payload with On Error Propagate , if you want your payload to be sent to your client you have to go with on error continue and set an error payload there.

0/9000