Mule request-response outbound endpoint and inbound properties - request

While I am reading the Mule in Action book to understand message properties' scopes, I encounter that Request-response outbound endpoints create inbound properties. More over, I came to know that message sources like inbound endpoints create inbound properties.
How can I know which inbound property is created by which endpoint, inbound or outbound?
How the inbound properties created by request-response outbound endpoints are helpful?
Thanks in advance.

How can I know which inbound property is created by which endpoint, inbound or outbound?
You can't, you have to deal with the inbound properties of your inbound endpoint before calling a request-response outbound endpoint. For example, you can copy interesting inbound properties in flow variables to preserve them.
How the inbound properties created by request-response outbound endpoints are helpful?
Supposed you hit a request-response HTTP endpoint amid flow, you'll want to get the status code of the HTTP response. That's when such properties are handy.

The response from calling an outbound-endpoint will be placed in the payload(if any) and the inbound property scope.
For example calling:
<http:outbound-endpoint address="http://google.com" />
Will return a HTTP Status code. THis will be stored in the inbound property #[message.inboundProperties['http.status']] as well as many other http properties, such as the Content-type etc.
Different transports add different properties, you will need to check each transports documentation etc to find info on them.
You can log the message properties to investigate yourself what properties are added.
This will log the entire message and its properties.
<logger level="INFO" />

Related

Auto propogate traces in envoy

Based on the Documentation envoy is capable of generating and propagating the traces to the Jaeger service cluster.
It also states that
in order to fully take advantage of tracing, the application has to propagate trace headers that Envoy generates while making calls to other services.
So assuming if a client calls -> service A -> calls Service B, service A being proxied behind envoy.
If service A calls service B, this call from A to B would also have to go through envoy right. So the traced Id that was originally generated by envoy when the client called Service A, wouldn't this be propagated to Service B.
Why does the application (Service A) need to forward these headers?
When doing tracing in a service mesh, behind proxies, the traceID generated upon the initial client call is propagated automatically only so long as the call goes from proxy->proxy.
So:
Client sends request
Request hits some ingress proxy. A trace ID is generated
Request is routed to proxy A in front of Service A. The trace ID is propagated from the ingress proxy to proxy A
Request hits microservice A. The trace ID is propagated to here in the headers.
Microservice A now has full control over the request. If the service discards all the HTTP headers when making it's outgoing request to Service B, then the traceID will also be discarded.
To get around this, Microservice A just needs to know which headers represent the traceIDs, how to append into it, and some state to make sure it makes it to outgoing requests. Then you'll get a full transaction chain.
Without the service propagating the headers, tracing basically gives you each path that ends in a microservice. Still useful, but not as complete of a picture.
My interpretation of this is that We need to keep in mind that communication between services needs to support forwarding/"passing along" the trace ID's so that the tracing works correctly.
So it warns us against situations where:
Client calls -> Service A #using http request with trace ID in header.
Service A -> Service B #using tcp request that does not support headers and the trace ID header is lost.
This situation could break or limit tracing functionality.
On the other hand If we have situation where:
Client calls -> Service A #using http request with trace ID in header.
Service A -> Service B #using http request the trace ID is forwarded to service B.
This situation allows for the trace ID header to be present in both connections so the tracing can be logged and then viewed in tracing service dashboard. Then We can explore the path taken by the request and view the latency incurred at each hop.
Hope it helps.

Salesforce send Outbound Message as PUT

I am sending outbound messages from Salesforce. They are always sending as POST, though. Is there a way to change the method they are using?
I'd like to send some of them as PUT, instead (and, eventually, some DELETE). I'm not finding anything from Google searches.
Outbound Messages are SOAP 1.1 based, and as such are required to use POST by the SOAP 1.1 spec, so there are no options to use other HTTP methods for the Outbound Message requests.
If you want to send HTTP requests instead of SOAP messages, you'll need to write an Apex trigger and use a future method to make the HTTP request from apex.

How to hide data received via HTTP requests?

I am currently designing a web application using AngularJS. In this I am fetching and posting data via Rest API(s) with different methods. The data I retrieving is fetched in the form of JSON.
Problem:
Issue here is, while I am using https, the data sent and received via HTTP requests can still be seen in proxy tool or traffic monitors. All the JSON can be easily read from this.
Each of my request has a token attached in it's header which takes care of authentication. However, once authorized, there is some part I don't want to be displayed in/ caught in such monitoring tools.
Question:
This data is stored in an encrypted way in database and all, however while coming via HTTP request, it is first decrypted and then sent. How can I hide/protect this data?
You can't.
If you give it to the client, then the client has to be able to see it.
If the user has configured their browser to proxy requests, then the proxy is the client.
Once the data leaves your server in an HTTP response then anyone/anything thing the user of the client wants to trust with that data can access it. You don't have control at that point.
proxy tool or traffic monitors will see https data only if the client has accepted the man-in-the-middle (MITM) by installing the ssl certificate used by the MITM:
To see the content (other than the host name) of an https connection, someone who is neither the client or the server must do a MITM.
If someone do a MITM with a certificate not trusted by the client, the client will reject the connection.
WARNING: If the server do NOT use HSTS, the person doing the MITM can do an SSLSTRIP attack if the first connection is http. In that case, the MITM do not need a trusted certificate because the connection will stay in plain text (http)

What is the Endpoint URL in Mule?

I want to integrate salesforce with mule. In Salesforce i am using Outbound message. In outbound Message asking Endpoint URL. but i need integrate with salesforce to mule. so How i can give the Endpoint URL Address. Which Endpoint URL is suitable for connect with Mule. how can i connect and Which Endpoint Component will go to use in mule. how i receive the Outbound message in mule from salesforce. In salesforce i know the outbound message creation. I don't know the Endpoint URL. Normal Salesforce Endpoint URL link to some other Webpage. but here i should need Mule Endpoint URL. How i can give this. Please Suggest it. Thanks.
you need to create a http-endpoint in your mule flow, and specify to which URL it should listen to.
example of such endpoint declaration is:
<http:endpoint name="myEndpoint" address="http://myExample.info/exampleAddress" exchange-pattern="request-response"/>
update
set the address for endpoint to the available port, so if 80 is not occupied - it's ok to have it for example address="http://localhost:80/exampleAddress/"

Spring integration | How to preserve message context when using HTTP outbound gateway?

I need to POST a JSON structure to a REST endpoint and process the data it returns (all of this is with JSON).
I am planning to use a HTTP outbound gateway for this purpose. Now the thing is that after I have transformed my object (payload of the message) into a JSON format and before I transmit it to the endpoint the payload should be dropped into a database so that in case the endpoint is not available the call can be retried.
As I want to
a) set the status accordingly after the call`
b) update the
respective row with a uuid from the REST endpoint
I need to somehow relate the uuid from my object (the business key) as part of the outbound message to the response of the REST endpoint that is placed on the reply channel. As I cannot ask the provider to return my uuid as part of the response how can I achieve this purely on the client side?
You can add a custom advice to the outbound endpoint using the request-handler-advice-chain. Simply subclass AbstractRequestHandlerAdvice. It's effectively an 'around' advice so you can store it in the DB before invoking the handler and update the status afterwards.
See 'Adding Behavior to Endpoints'
and specifically 'Custom Advice Classes'

Resources