Skip to Main Content

Integration

Java Embedding in BPEL

3741383Jul 26 2018 — edited Feb 26 2020

Hello good day everyone,

right now I couldn't find a way to create SHA1 in BPEL using Java Embedding.

I saw a sample code of SHA1, but I couldn't understand how to read from XML element and set into XML element again.

so here is the SHA1 java code that i want to embed,

       package main;  
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

 
public class HashTextTest
{  /** * @param args * @throws NoSuchAlgorithmException
*/
public static void main(String[] args) throws NoSuchAlgorithmException
{ System.out.println(sha1("test string to sha1"));
} 
static String sha1(String input) throws NoSuchAlgorithmException
{ MessageDigest mDigest = MessageDigest.getInstance("SHA1"); byte[] result = mDigest.digest(input.getBytes());
StringBuffer sb = new StringBuffer();
for (int i = 0; i < result.length; i++)
{
sb
.append(Integer.toString((result[i] & 0xff) + 0x100, 16).substring(1));
} 
return sb.toString();
}
}

and this is the XML element that i want to use as a variable

 <xsd:element name="pwd" type="xsd:string"/>

the element itself i have set to '12345678', and after i set the variable, i want to SHA1 then put it again into that element as XML.

sir @"Martien van den Akker"

if you know, maybe you could help me please sir..

thankyou

This post has been answered by Martien van den Akker on Aug 22 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2018
Added on Jul 26 2018
14 comments
1,204 views