Skip to main content

Java Web Service trouble in GlassFish

No replies
hayagreeva
Offline
Joined: 2008-08-22
Points: 0

Hello,

I have written a java web service using Eclipse Front end and GlassFish server using the Java Web Service API using annotations like @WebService etc. And it runs perfectly. This is the only problem i am facing.

I have a class called NotationReader with 3 methods exposed

1. loadXMLConfiguration() - This loads an XML and parses it and loads the information into 3 datastructures

2. getSmbolList() etc- These methods simply returns the datastructures.

This is the client i have written
-----------------------------------------------------

NotationReaderService service = new NotationReaderService();

//create proxy
NotationReader proxy = service.getNotationReaderPort();

//invoke
System.out.println(proxy.loadConfiguration());
System.out.println(proxy.getSymbolList().size());
System.out.println(proxy.getScoreList().size());
System.out.println(proxy.getRelSlotList().size());
--------------------------------------------------------------------------------------------------------------------

Now when i run the method for the first time, it returns the correct numbers 29,1,5 since the XML is read once, but if i run the client again ,it does not create a new NotationReader object but uses the same one hence the size of the datastructures double....everytime i run it.. is there any way to have the webservice so that everytime a client calls the service a new NotationReader object is created ? Any help would be appreciated.

Thanks
Ajay