Two Laptop Bag*
The moose likes Servlets and the fly likes Passing parameters between 2 web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing parameters between 2 web applications" Watch "Passing parameters between 2 web applications" New topic
Author

Passing parameters between 2 web applications

James bosplhf
Greenhorn

Joined: Oct 13, 2013
Posts: 5
Hello,
I'm using Wesphere Application Server 7 and have 2 web applications.
The first application is calling the second and needs to pass some variables to it.
How should I do it ?

** Sending the session is impossible.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
What does "calling" mean, exactly? Http?
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1836
    
    7

You could use JNDI, or alternatively a database if you have on available.
Edit: oh is missed the 'calling' bit, nevermind.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
James bosplhf
Greenhorn

Joined: Oct 13, 2013
Posts: 5
yes, calling an http url of the second app.
James bosplhf
Greenhorn

Joined: Oct 13, 2013
Posts: 5
Jelle Klap wrote:You could use JNDI, or alternatively a database if you have on available.
Edit: oh is missed the 'calling' bit, nevermind.


DB - I prefer not to use DB .
JNDI - can you be more specific ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
You could pass it along as an URL parameter.
James bosplhf
Greenhorn

Joined: Oct 13, 2013
Posts: 5
But it's not secure, isn't it?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
There are many aspects to security - in which way would you consider an HTTP call that happens entirely on a single machine (in other words, no chance of network snooping) to be insecure? Or are these two web apps not running on the same machine?

You could always make the call over HTTPS, and make the call a POST instead of a GET.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1382
HTTP Session might work between two application.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
... except that James ruled that out in his post.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
What does the http url do? Are you linking to a page in the other application or invoking a method and getting back a result? Should the call be authenticated and authorized?
I would suggest using an integration solution like REST?
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 594
    
    4

kri shan wrote:HTTP Session might work between two application.

No, It doesn't work.

@OP: You can try to use JMS also..
Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33

url rewriting might be helpful....

for example...

htto://localhost:8080/jsp2.jsp?name=tom&roll=231

and you can use
request.getParameter("tom");
to get the value....


SCJP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

Sourabh Bawage wrote:url rewriting might be helpful....

There is no "rewriting" to this. Just placing a query stirng onto the URL.

request.getParameter("tom");

Not quite. You pass the name of the parameter, not the value, which is what you are trying to obtain.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33


request.getParameter("tom");

Not quite. You pass the name of the parameter, not the value, which is what you are trying to obtain.

ya....i know...wrote it by mistake....
Thanks....
Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33

Bear Bibeault wrote:
Sourabh Bawage wrote:url rewriting might be helpful....

There is no "rewriting" to this. Just placing a query stirng onto the URL.



can you please explain how url rewriting is different from "Just placing a query stirng onto the URL"??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

Rewrite engine
Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33

http://www.studytonight.com/servlet/url-rewriting-for-session-management.php

i just wanted to confirm this article about URL rewriting is not correct....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

The article is fine and talks about re-rewriting the URL to add the session info when cookies cannot be used. It has nothing at all to do with this topic that we are discussing here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing parameters between 2 web applications