Hi Arun,
your tutorial (Screencast #29: Web service using NetBeans 6.8 and
GlassFish v3 (Accessing database in business method) is simpley superb
I have some questions regarding pulling information, I am invoking
webservice as a action event when a user enter there name and hit ok,
WebService should pull info basic on user name from DB and display I dont
know why its not doing that I did exactly as you did in that video tutorial
actually this is my first java program could you please help me if you can
*ActionEvent*
try { // Call Web Service Operation
Barcode_Info.ShippingAddressService service = new
Barcode_Info.ShippingAddressService();
Barcode_Info.ShippingAddress port =
service.getShippingAddressPort();
// TODO initialize WS operation arguments here
java.lang.String bcode = Bcode; //Bcode is user input
// TODO process result here
java.lang.String result = port.pullInfo(bcode);
System.out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
*WEBSERVICE*
@WebService()
public class Shipping_Address {
@PersistenceUnit
EntityManagerFactory enf;
/**
* Web service operation
*/
@WebMethod(operationName = "Pull_Info")
public String Pull_Info(@WebParam(name = "Bcode") //I am passing
userinput here into WEBSERVICE to perform a query
String Bcode) {
Info I =
(Info)enf.createEntityManager().createNamedQuery("Info.findByName").getResultList();
//TODO write your implementation code here:
return "Address" +I.getAddress();
}
}
Dinesh Rachala