Chapter 7. Accessing Web Services 215
When executing this method, try generating prime numbers of 20 or fewer
digits to avoid long computations. A short version of the prime number
generator is shown in Example 7-1.
Example 7-1 Primes.java - getPrime() method
package primes;
import java.math.BigInteger;
import java.util.Vector;
public class Primes {
private static final BigInteger ZERO = new BigInteger("0");
private static final BigInteger ONE = new BigInteger("1");
private static final BigInteger TWO = new BigInteger("2");
private String prime = "";
......
......
......
public static String getPrime(int numDigits) {
BigInteger start = random(numDigits);
start = nextPrime(start);
return start.toString();
}
}
Creating a Web Service
In this section, you create a Web Service in the PrimesWebService project that
you just created. You will use the wizards provided by WebSphere Studio Site
Developer to do this. Once created, the Web Service will be published and
invoked to be executed in a WebSphere Test Environment.
1. Select File -> New -> Other.