*
The moose likes Web Services and the fly likes Access webservices in Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Access webservices in Thread" Watch "Access webservices in Thread" New topic
Author

Access webservices in Thread

Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Friends,
I have one design question for you. We have webservice running in Dev.Server.
IT takes a string at a tiem and return complex type.
Let us assume string is the MOBILENUMBER

Now, In the website- reporting module, the user selects multiple mobile number,
For each selected mobile number a call has to be done to the above mentioned webservice.
My question, how to design this in client.

1. Can i have looping of selected m.number list and call the webservice
2. Can i have multithreading here?
If threading can be done, can anyone advise some walkthrough how to proceed with this?


SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
2. Can i have multithreading here?
If threading can be done, can anyone advise some walkthrough how to proceed with this?


If you want the client to remain responsive to user input, it will be essential to have a separate Thread attempt to make the call.

Before tackling this project you should review some tutorials on Threads in Java and perhaps create an off-line simulation of your client first. There are many traps for the unwary.

Bill
Manhar Puri
Ranch Hand

Joined: Aug 23, 2005
Posts: 41
Karthik,

Its been sometime since I worked with Web Services, but as far as I remember you could collect these phone number in an array and send them across to the Web Service.

Process the array over there and return back an array containing whatever the result is. Most probably you will face issues with declaring type of the Array and its contents on the response. Look into Castor in achieving this.

Let me know if you have some doubts.

Oh forgot to mention, the above can be achieved only if the both the Web Service itself and the client is being created by you. If the Web Service is already existing then looping can some problems in performance. Again depends on the number of calls made to the Web Service.

-Manhar.
[ April 04, 2007: Message edited by: Manhar Puri ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access webservices in Thread