How to Invoke Basic Auth Secured Backend Service from WSO2ESB

In my previous post, we discussed how we can invoke a user name token secured BE service. Let see, how we could invoke a Basic auth secured service using ESB.   This is more easier as we just want to configure ESB property mediator to add Basic authentication header in to out going messages.  However I recommend for you to read my first blog post to get better idea on extracting user name and password.

You can add following configuration in the synapse config before sending message to endpoint.

<property xmlns:ns="http://org.apache.synapse/xsd"
 expression="fn:concat('Basic ', base64Encode('username:password'))"

You can see here,  you just configure the username password in synapse configuration. Please refer this blog about more advance way to configure the username and password using secure way.