Reputation: 51
I have create a Java Servlet which calls method from my Web Service. The method works fine and I've tested it. But my problem is on the Servlet side.
I dragged and drop the method from the Server Client and modified abit. Below is my code as for now.
private ArrayList<String> search(java.lang.String shopName) throws ClassNotFoundException_Exception {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
webservices.WebServices port = service.getWebServicesPort();
ArrayList<String> shops = new ArrayList<String>();
shops.add(port.search(shopName));
System.out.println(port.search(shopName));
return shops;
}
The problem I encounter right now is that it returns only a value and it is the last value but the actual output has more than one. I've tested my Web Service method and it returns all the result from the execution of the query but in this Servlet it returns the last. How do I make it count from the beginning till the end?
Upvotes: 1
Views: 122
Reputation: 26084
I think you need ArrayList.addAll().
shops.addAll(port.search(shopName));
Upvotes: 2