Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it Synchronous or Asynchronous?  RSS feed

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends..

i access WebService from JSE, like this :


is that code execute WebService Synchronously or Asynchronously?..
if it accessed Synchronously, and then how to configure JAX-WS asynchronouly?..

Thanks in advance..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Synchronous.
If you want your web service client to allow for asynchronous calls, then you must supply a binding file when invoking wsimport. Such a binding file looks like this:


If you want an asynchronous web service, on the server side, then it is another story - you probably will want to use some kind of queue and place work to be processed in that queue etc. etc.
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan for your reply..


If you want your web service client to allow for asynchronous calls, then you must supply a binding file when invoking wsimport.


Could you explain this?..
I'm still don't understand about this..
How to supply a binding file when invoking wsimport?..
is it mean that i've to add some parameters while use wsimport and that binding generated automatically or we've to add that binding manually?..

Thanks in advance..

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Check this webpage: http://java.sun.com/webservices/docs/2.0/jaxws/wsimport.html
By supplying the -b flag and a path to a binding file when you invoke wsimport, you can use separately defined binding files, as I gave an example of in the earlier post.
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan for your reply..

Is That binding file should be placed in a WAR or JAR file?..
Should its deployed or no?..
is that binding file only needed when we want to generate Service class of our WebService through wsimport?..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again! :-)
Leonardo Carreira wrote:
is that binding file only needed when we want to generate Service class of our WebService through wsimport?..

Right, it is only needed when you invoke wsimport to generate the artifacts. You do NOT need to include it when deploying.
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan..

I've applied it and then i tried to execute WebService call asynchronously..
this is my code that i've applied :


i'm wondering about that..
i really doubt in this code :


is it true or no in asynchronous call implementation?..

Please correct me if i'm wrong..
Thanks in advance..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Yes, indeed, it looks like you have succeeded in implementing an asynchronous web service client.
However, there is one thing that looks quite strange in your code:

In the code above, you iterate over all the objects of the type Major in the list data. For each iteration, one object from the list is placed in the variable major. You also have a variable i that always contain 1.
BUT when you print the id, code and name, it looks like you call static methods on the Major class. The object from the list, in major, is totally ignored.
What is the result when you run the program? Does it work like expected?
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan, thanks for your reply..


In the code above, you iterate over all the objects of the type Major in the list data. For each iteration, one object from the list is placed in the variable major. You also have a variable i that always contain 1.
BUT when you print the id, code and name, it looks like you call static methods on the Major class. The object from the list, in major, is totally ignored.
What is the result when you run the program? Does it work like expected?


Yes, in that code i forgot to put the increment of variable i..
the result is the list of objects printed in the console, and it work like what i expected...
Next, perhaps i would try to integrate it with Swing..

is it good if we develop a Swing application where do data manipulation in database through WebService?.

please correct me if i'm wrong..

Thanks..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!