-
md5
Hello everybody!I would like some help with something!I'm working with eclipse (helios), apache tomcat 6 and axis 2 and i'm trying to create a web service that takes a string as an input and generates an md5 hush. I have done the web service part using the following code:
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class AeSimpleMD5 {
private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
buf.append((char) ('0' + halfbyte));
else
buf.append((char) ('a' + (halfbyte - 10)));
halfbyte = data[i] & 0x0F;
} while(two_halfs++ < 1);
}
return buf.toString();
}
public static String MD5(String text)
throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash);
}
}
and it works great. The probleme is that i want to create the client for this and i can't understand the code that i'm must write. I have found many tutorials so I don't thing that i will have a probleme on what i must do. Just the code! Please help! Thanx in advance!!! :)
-
Is this what are you trying to achive:
Eclipse WTP Tutorials - Creating Bottom Up Web Service via Apache Axis2
So after wizard in eclipse creates everything for you,
you cannot understand client code with stubs, proxies...that you got from WSDL?
-
First of all thanx a lot for answering me!!I have found this tutorial too. My problem is that on step 27 the tutorial sais to import a .java file. In my case I didn't do the converter case so i can't import the converterclient.java. What do i need to do there? Thanx again for answering me!!
-
You are welcome.
I suggest you spend some time studying concepts behind this,
and have some basic understanding of web services and then move to tutorials.
Your tutorial is to big and should not be your first.
You better take a look at
"Creating Bottom Up Web Service"
So just create simple interface, with few methods,
and use wizard to create web service.
Pay very close attention java classes that wizard created.
Use some good web service tutorial to understand concepts of stub, proxy, and SOAP messages, WSDL.
After this create client.
Use debugger to run through methods on see how web service operation is invoked.
take your time, this is not just another click and forget issue.
-
Yeah i know I've been studing for quite a while and i have searched the web A LOT. I have found many tutorials too. I'll just keep trying. Thanx a lot again! :)