I found the solution myself today by adding a groovy in-line script as 
described here:
http://old.nabble.com/Re%3A-how-to-use-groovy-script-to-mediate-in-synapse-p15189519.html

<syn:script language="groovy">
  byte[] username =  mc.getProperty("username").getBytes();
  byte[] password = mc.getProperty("password").getBytes();
  byte[] authString = new byte[username.length + password.length + 1];
  System.arraycopy(username, 0, authString, 0, username.length);
  authString[username.length] = (byte) ':';
  System.arraycopy(password, 0, authString, username.length+1, password.length);
  mc.setProperty("Authorization", "Basic " + 
org.apache.axiom.om.util.Base64.encode(authString));
</syn:script>

and writing the value as described here:
http://mail-archives.apache.org/mod_mbox/synapse-user/200803.mbox/%[email protected]%3E

<property name="Authorization"  expression="get-property('basicAuth')" 
scope="transport"/>


From: Wright, Peter
Sent: Mittwoch, 27. Juni 2012 16:50
To: [email protected]
Subject: Synapse: SOAP with HTTP basic auth

Hi,

I'm trying to send a SOAP request to a SOAP server that requires basic 
authorization.

If I understand it correctly, the username:password must be sent in the HTTP 
header
(and not in the SOAP header) as:
Authorization: Basic xxxxxx
where xxxxxx is the encoded string.

How can I configure Synapse to send e.g. "myUser:myPW" in the header?
and correctly encoded too.

I'm using Synapse 2.1.0 installed on Sun Solaris 10.

Thanks,
Peter

The content of this e-mail is intended only for the confidential use of the 
person addressed. 
If you are not the intended recipient, please notify the sender and delete this 
email immediately.
Thank you.

Reply via email to