When using the following:
<outbound>
<pass-through-router>
<outbound-endpoint
address="http://myuserid:mypassword@somehost.example.com/myservice"
remoteSync="true" />
</pass-through-router>
</outbound>
Mule 2.1.0 does not use the user id and password specified in the address attribute. As a result, if the somehost.example.com enforces basic authentication, it results in a HTTP 401 error.
I got it to work when I add the following line to the org.mule.transport.http.HttpClientMessageDispatcher.doDispatch() method:
connector.setupClientAuthorization(event, httpMethod, client, endpoint);
After the change, the method looks like this:
protected void doDispatch(MuleEvent event) throws Exception
{
HttpMethod httpMethod = getMethod(event);
connector.setupClientAuthorization(event, httpMethod, client, endpoint);
try
{
execute(event, httpMethod);
if (httpMethod.getStatusCode() >= ERROR_STATUS_CODE_RANGE_START)
{
logger.error(httpMethod.getResponseBodyAsString());
throw new DispatchException(event.getMessage(), event.getEndpoint(), new Exception(
"Http call returned a status of: " + httpMethod.getStatusCode() + " "
+ httpMethod.getStatusText()));
}
}
finally
{
httpMethod.releaseConnection();
}
}
Now it is adding basic authentication credentials to the request to the somehost.example.com server, and it is working fine.