No announcement yet.

Which is the .class that generates the HTTP response

  • Filter
  • Time
  • Show
Clear All
new posts

  • Which is the .class that generates the HTTP response

    Hi all,

    We have deployed a WebService in our Mirth service, and due to a problem with the HTTP response header that Mirth is responding, we need to modify it. We need to change the Java that is constructing the header, but we don't know where is it.

    Does anyone can help us? thank you very much!

  • #2
    I know it's in the package com.webreach.mirth.connectors.http.transformers and the class is UMOMessageToHttpResponse, but i can't find in which .jar is.


    • #3
      Out of curiosity what does the current header look like? What needs to be changed? Is this an error or is this something custom that you need to work in your environment?
      Jon Bartels

      Zen is hiring!!!!
      Talented healthcare IT professionals wanted. Engineers to sales to management.
      Good benefits, great working environment, genuinely interesting work.


      • #4

        is in order to add the OK after the HTTP/200. The missing of the OK is making our integration not working.


        • #5
          That may be part of the apache commons http-client. What would your app do with a second HTTP/1.1 200 OK ? like:
          SUCCESS: HTTP/1.1 200
          Connection: close
          Date: Tue, 26 Jan 2010 12:02:51 EST
          Server: Mule/1.2
          Expires: Tue, 26 Jan 2010 12:02:51 EST
          Content-Type: text/html
          Content-Length: 15
          X-MULE_CORRELATION_ID: a34099ab-0a9c-11df-bb6b-8b3855ecaeea
          HTTP/1.1 200 OK

          adding that could be done using responseMap.put


          • #6
            Yes! That's what I need.

            I am new on Mirth, could you explain me what is responseMap.put and how to change it?

            Thank you very much!


            • #7
              responseMap is typically used to check the the response of a destination for example you can test the "status" of SUCCESS, FILTERED etc. You can also formulate your own responses. In your model you could simply change the HTTP listener connector property "Respond From" to a destination (Destination2 in my example) that you create that is a Channel writer then in the postprocessor script of the connector simply add the following:
              responseMap.put("Destination 2", ResponseFactory.getSuccessResponse("HTTP/1.1 200 OK"));


              • #8
                I tried it but didn't work. My listener isn't HTTP, is SOAP.

                By doing as you said, I get the HTTP/1.1 200 OK as the response's payload, not the HTTP header.


                • #9
                  This problem smells wrong. Theres a fairly common HTTP library generating headers and a SOAP interaction. Its a common task.

                  What is the basis for the other applications SOAP stack? .NET? Ruby? Java?
                  What library is it using for SOAP?
                  What library is it using for HTTP?
                  Is the error you get originating from your SOAP library or are you making a manual call to check the HTTP code? If you're making the call, what function are you using?

                  I suspect that there is either a bad call or a bad test for HTTP codes. Something is looking at the text for the code ('OK', 'BAD REQUEST', 'FORBIDDEN') instead of just reading the numeric code.
                  Jon Bartels

                  Zen is hiring!!!!
                  Talented healthcare IT professionals wanted. Engineers to sales to management.
                  Good benefits, great working environment, genuinely interesting work.


                  • #10
                    I agree with JB

                    The "Reason Phrase" is not required by the client. See:

                    6.1.1 Status Code and Reason Phrase
                    The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request. These codes are fully defined in section 10. The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason- Phrase.

                    The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:

                    - 1xx: Informational - Request received, continuing process
                    - 2xx: Success - The action was successfully received,
                    understood, and accepted


                    • #11
                      The other applications is SAP-PI 7.10 based on Java, and not modifiable. And in its log they received the message as INVALID HTTP RESPONSE, and resend again the same message several time, so we process it more then one time, and this could be very dangerous.

                      SAP has told that is not possibly to modify so.

                      JBARTELS, we are making an standard mirth soap call, we have not made anything manually. And as you said, SAP PI 7.10 is expecting something after the HTTP 200.


                      • #12
                        Mirth works pretty fine with all kind of http and soap clients, so I think the problem is other. What is your Locale? in which server are you running Mirth ?

                        Anyway, I think the class you're searching is under the connector/axis (there are other class with the same name under the http connector, but that one doesn't apply to your case).


                        • #13
                          We've just faced this problems wiht mirth 1.8.2 and SAP. The changes needed are well documented here:


                          But theer're two affected classes:

                          com.webreach.mirth.connectors.soap.axis.transport. http.transformers.UMOMessageToHttpResponse


                          com.webreach.mirth.connectors.http.transformers.UM OMessageToHttpResponse

                          Anyway, this only apply to mirth 1.8.2 as 2.0 has all this stuff changed