Skip to Content

How to pass dynamic Password(Pwd+Current Timestamp) ,Timestamp along with Username in SOAP header.

I have have a require to pass dynamic Password(Password+Current Timestamp) ,Timestamp along with Username and Source system(static value) in SOAP header.

Scenario : Proxy to webservice

> I am using soap Receiver Adapter as i have to pass through Proxy/firewall

Data format of Header parameter should be as below?

Headers:

USERNAME: ABCDEF

PASSWORD: md5(123456+TIMESTAMP) eg:123456201806151224350001

TIMESTAMP:201806151224350001

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 01, 2019 at 08:24 AM

    Hi Ayush,

    You can use User defined function (set Adapter Specific Message Attributes) and map it to the root node in the message mapper which indeed passes Header parameters dynamically.

    In the User defined function (set Adapter Specific Message Attributes) you can pass the variables appropriately.

    for example:

    DynamicConfiguration conf2 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP", "XAmzDate");

    conf2.put(key3,dateStamp);

    Below is the source code to generate MD5 password and you can concatenate the output of this with current Timestamp.

    import java.math.BigInteger;

    import java.security.MessageDigest;

    import java.security.NoSuchAlgorithmException;

    public class MD5 { public static String getMd5(String input)

    {

    try {

    MessageDigest md = MessageDigest.getInstance("MD5");

    byte[] messageDigest = md.digest(input.getBytes());

    on BigInteger no = new BigInteger(1, messageDigest);

    String hashtext = no.toString(16); while (hashtext.length() < 32)

    {

    hashtext = "0" + hashtext; } return hashtext;

    }

    catch (NoSuchAlgorithmException e)

    {

    throw new RuntimeException(e);

    }

    }

    public static void main(String args[]) throws NoSuchAlgorithmException

    {

    String s = ""; System.out.println("Your HashCode Generated by MD5 is: " + getMd5(s));

    }

    }

    Eventually In the SOAP receiver communication channel ensure ASMA is set and header name are provided correctly.

    Thanks and Regards- Rajesh PS

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.