sangram mhatre

Greenhorn
+ Follow
since Apr 02, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sangram mhatre

I am using JPA(Hibernate implementation) to store entities in database .

I have a scenario wherein i need to save values to database and also some part of it to
a properties file(maintain preferences for some component). I am using commons configuration
for this .

I want that the transaction consists of both the saves to database and properties file as well .
There is a method in PropertiesConfiguration(commons config object) , save , what i want is
Spring to either call commit on connection and save on PropertiesConfiguration both or none .

How can this be achieved ?

Thanks in advance .
12 years ago

This is how had done it


But i have used simple bean , not the generated code by java2wsdl .


12 years ago
You can do something like this ,

//Look-up the client (it is the one which will have @Webservice annotation
//If not using spring just create the instance
IMyService client = (IMyService) context.getBean("client");
.........

Then call the ws .

// Invoke the Service
logger.info("Client invoking WS:");
ObjectFactory factory = new ObjectFactory();
NameDataContract name = factory.createNameDataContract();
name.setFirstName( factory.createNameDataContractFirstName("Java"));
name.setLastName(factory.createNameDataContractLastName("Client"));
String response = client.sayHello(name);
logger.info("Response: " + response);

Cheers,
Sangram M
12 years ago
Posting a message over http is what you already know .

Webservice is, createing a message in a specific protocol(SOAP envelope which defines an xml format) and then post
it over the http . On the serverside the soap envelope recieved is decoded and then call the corresponding service (maybe
anything not only java) and then again send the response in the xml format to the client .

The advantage is since you are using a predefined xml format , you can communicate between different platforms i.e. a java
program can communicate to a c# program whithout even needing to know that it is talking to a c# program.
Cheers,
Sangram
12 years ago
Are you aware what an interface in java is ?
13 years ago
You can write your file to root directory of your web app .

and then respond back to your client as below ,
which will prompt the user to select the location to save his file .

response.setContentType("application/ms-excel");
InputStream is = ctx.getResourceAsStream("/<urfilename>");
int read = 0 ;
byte[] bytes = new byte[1024];
OutputStream os = response.getOutputStream();
while ((read = is.read(bytes)) != -1) {
os.write(bytes, 0 ,read);
}

os.flush();
os.close();
13 years ago
You can store the value in an attribute in ServletContext object and in each of the service method , extract this value and increment it and again
store in same attribute .
13 years ago
Please check setreadOnly() method.
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#setReadOnly(java.lang.Object,%20boolean)

Else you can write you own wrapper class to control the dirty checking .
No , you dont have to .
you can refer the api at , http://www.jscape.com/secureinetfactory/docs/javadoc/index.html

Check for ssh constructor .
Are you able to connect to the database xe with user name scott and password tiger externally using sqlplus ? Also can you provide your tnsnames entry ?
I have used a third party api from jscape and it works fine
and is simple to use . You can try the same .
http://www.jscape.com/articles/ssh_using_java.html
Every container implements the HttpServletRequest and HttpServletResponse
interfaces , a container actually creates objects of these implementation
objects ,

HttpServletRequest httpServletRequestImpl = new HttpServletRequestImpl();
HttpServletResponse httpServletResponseImpl = new HttpServletResponseImpl();

and populates these and then calls the service method .
13 years ago
Are you able to connect to the database xe with user name scott and password tiger externally using sqlplus ? Also can you provide your tnsnames entry ?
Try using proper combination of
session.evict() and session.clear() before session.update() or session.save()
Please check , if the database is running and listener is running and the details you have provided in connection url are correct .