sending a validator result as http-message

hi again :slight_smile: !
i am using the http-gateway to send monitoring messages to a GUI component.
i use the “xbd.http.request” property of the http-gateway to do this.

for example:


my webserver listening on port 5050 extracts the property “request” from the http message and displays it. this works fine.

now i want to monitor the result of a validator.
in the log-file i find the message:
xbd.validator.rejection.reason = Validator detected ERROR error at line number 1: cvc-datatype-valid.1.2.1: ‘abc’ is not a valid ‘decimal’ value.

i want this message to be monitored, so i must set the http-property “xbd.http.request” to the value of “xbd.validator.rejection.reason”.
the following does’nt work:


how can this be done?
the doku says to use “$” to access the value of a property, but that doesn’t work.

thx
-hannes

Hi Hannes,

Two things I want to tell you on this subject:

First, the property xbd.http.request. is expecting you to finish the property name. I.E.
Add a property of the name xbd.http.request.MyProperty and then set it to the value “monitor this message”. This creates a name value pair for the header. What you are doing may work but it isn’t generally accepted in the HTTP protocol.
Secondly, the correct way to evaluate the property as in your case is by putting it in curly braces. Example: {‘$xbd.validator.rejection.reason’}
or more completely…

xbd.http.request.MyProperty=“{‘$xbd.validator.rejection.reason’}”

Regards,
:wink:

- Matthew G.

hi matthew,
h
i thought to use curly braces for xpath expressions.
o.k, this means, that mediator regards properties as xpath?

i changed my sequence to




and this works fine, but when i change it to:



i’m getting the error:
[slf5s.start]07 M

Hi Hannes,

You should specify an “on_error” sequence on the HTTPGateway step. That will allow you to get control when any exception occurs in the Gateway.

Hope this helps.

Best regards,
Mike

hi,

thx, i have done this - and now the sequence is executet till the end.
but still i can’t monitor the reason, why f.e. sending an email failed.
i use:






in the <defaultcomponent.message.log> file i see the reson:

xbd.validator.rejection.reason = Validator detected ERROR error at line number 1: cvc-datatype-valid.1.2.1: ‘abc’ is not a valid ‘decimal’ value.
Validator detected ERROR error at line number 1: cvc-type.3.1.3: The value ‘abc’ of element ‘birdamount’ is not valid.
xbd.validator.schemaused = http://hicoetwst001045:8080/slide/files/MediatorRepository/FlightCockpitReport/MailSample.xsd

it seems like, the sequence stopps after the “monitoring the reaseon” logger.
i think the reason for this is, because the httpGateway causes an error.

i set the property to be <xbd.http.request.LogMessage=“{‘$xbd.validator.rejection.reason’}”>, and no message is monitired - when i change this property to <xbd.http.request.LogMessage=“test”> it works and my message is monitored.

whats wrong with <xbd.http.request.LogMessage=“{‘$xbd.validator.rejection.reason’}”> ?

fg
-hannes

Hi Hannes,

I suspect that the HTTP Gateway problem you are seeing is caused by the xbd.validator.rejection.reason property containing a character or characters that are invalid in an HTTP header - most likely a CR or NL character, since those are important to the HTTP protocol.

If you really want to send this value, it could be sent as the payload or as an attachment, rather than a header.

Hope this helps.

Best regards,
Mike

hi,

thx!
o.k., seems like i have to change the sequence to send the ‘xbd.validator.rejection.reason’ property as an atachment.
i will try this next.

fg
-hannes