Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8710133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:32:47+00:00 2026-06-13T04:32:47+00:00

I’d like to return a 401 HTTP_response after a failed authentication. I am trying

  • 0

I’d like to return a 401 HTTP_response after a failed authentication. I am trying to do this through the use of a http:response-builder component with the configuration below. I don’t care about anything previous within the flow, once it reaches this point all it needs to do is this.

<flow name="main" doc:name="main">
<http:inbound-endpoint exchange-pattern="request-response"
    address="http://localhost:8081/example" doc:name="HTTP" />
<byte-array-to-string-transformer
    doc:name="Byte Array to String" />
<cxf:proxy-service namespace=""
        service="" payload="envelope"
        wsdlLocation=""
        enableMuleSoapHeaders="false" doc:name="ProxyService"/>
<cxf:proxy-client payload="envelope" enableMuleSoapHeaders="true" doc:name="ProxyClient" />
<http:outbound-endpoint exchange-pattern="request-response"
        address=""
        doc:name="request" />
<byte-array-to-string-transformer
    doc:name="Byte Array to String" />
<logger message="The payload after the request is:#[payload]"
    level="INFO" doc:name="Logger" />
<choice doc:name="Choice">
...
<otherwise>
    <processor-chain>
        <logger message="Failed authentication is:#[payload]" level="INFO"
            doc:name="Logger" />
        <http:response-builder status="401"
            doc:name="HTTP Response Builder">
            <set-payload value="Authentication Failed" />
        </http:response-builder>
    </processor-chain>
</otherwise>

The error that I’m receiving through soapUI

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Could not find a transformer to transform "SimpleDataType{type=org.mule.transport.http.HttpResponse, mimeType='text/xml'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}". (org.mule.api.transformer.TransformerException). Message payload is of type: PostMethod</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>.

To me this says my current message is of text/xml, and it’s trying to return a unknown type. I’ve tried setting the content type of the builder to text/xml with the same results

Edit: The current status is HTTP/1.1 500 Internal Server Error

Many thanks for your time reading, and any replies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:32:49+00:00Added an answer on June 13, 2026 at 4:32 am

    You can’t use the http:response-builder where you use it because its output will not be directly dealt with by the HTTP inbound endpoint but by the cxf:proxy-service. When the response is coming downstream the flow towards the inbound endpoint it hits the cxf:proxy-service which takes care of preparing the SOAP response: it can only deal with a message that has a SOAP payload and will control strictly the status code, overriding any attempt to set it up elsewhere in the flow. Moreover, in your case, you’re building a non-SOAP response which will make the cxf:proxy-service even unhappier when it’ll deal with the response.

    So the trick is to separate the detection of the failed login from the building of the HTTP response, and locate the HTTP response building in the response phase of the flow. This gives:

    <flow name="main" doc:name="main">
        <http:inbound-endpoint exchange-pattern="request-response"
            address="http://localhost:8081/example" doc:name="HTTP" />
        <response>
            <expression-filter expression="#[flowVars.authenticationFailed]" />
            <http:response-builder status="401"
                doc:name="HTTP Response Builder">
                <set-payload value="Authentication Failed" />
            </http:response-builder>
        </response>
        <byte-array-to-string-transformer
            doc:name="Byte Array to String" />
        <cxf:proxy-service namespace=""
                service="" payload="envelope"
                wsdlLocation=""
                enableMuleSoapHeaders="false" doc:name="ProxyService"/>
        <cxf:proxy-client payload="envelope" enableMuleSoapHeaders="true" doc:name="ProxyClient" />
        <http:outbound-endpoint exchange-pattern="request-response"
                address=""
                doc:name="request" />
        <byte-array-to-string-transformer
            doc:name="Byte Array to String" />
        <logger message="The payload after the request is:#[payload]"
            level="INFO" doc:name="Logger" />
        <set-variable variableName="authenticationFailed" value="false" />
        <choice doc:name="Choice">
        ...
        <otherwise>
            <processor-chain>
                <logger message="Failed authentication is:#[payload]" level="INFO"
                    doc:name="Logger" />
                <set-variable variableName="authenticationFailed" value="true" />
            </processor-chain>
        </otherwise>
    

    Notice the use of a flow variable (named authenticationFailed) to control the response.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.