Thanks Jean for your reply.
I have been trying to set the Authorization info in the createRequest in my
custom marshaler as below
public void createRequest(MessageExchange exchange, NormalizedMessage
inMsg, SmxHttpExchange httpExchange) throws Exception {
String authString ="";
httpExchange.setURL(getLocationUri(exchange, inMsg));
httpExchange.addRequestHeader(HttpHeaders.HOST_BUFFER, new
ByteArrayBuffer(new URI(getLocationUri(exchange, inMsg)).getHost()));
httpExchange.setMethod(getMethod(exchange, inMsg));
httpExchange.setRequestHeader(HttpHeaders.CONTENT_TYPE,
getContentType(exchange, inMsg));
if(exchange.getEndpoint().getEndpointName().equalsIgnoreCase("reg")){
authString = "Basic somebase64string";
}
else{
authString = "Basic someotherbase64String";
}
httpExchange.addRequestHeader(HttpHeaders.AUTHORIZATION,
authString);
if (getHeaders() != null) {
for (Map.Entry<String, String> e : getHeaders().entrySet()) {
httpExchange.setRequestHeader(e.getKey(), e.getValue());
}
}
if (contentExpression != null) {
String contentToSend = applyContentExpression(exchange, inMsg);
if (contentToSend != null) {
httpExchange.setRequestContent(new
ByteArrayBuffer(contentToSend.getBytes()));
}
} else if (inMsg.getContent() != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
transformer.toResult(inMsg.getContent(), new
StreamResult(baos));
httpExchange.setRequestContent(new
ByteArrayBuffer(baos.toByteArray()));
}
}
But I am not able to still able to get it to work. Please confirm if this is
the right way of doing so.
--
View this message in context:
http://old.nabble.com/http%3Aendpoint-or-http%3Aprovider-tp27172672p27179173.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.