Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX -RPC

 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was just reading web services tutorial from Sun where I noticed the following
A service endpoint interface must conform to a few rules:
� It extends the java.rmi.Remote interface.
� It must not have constant declarations, such as public final static.
Why the above restrictions?

Thanks
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
I was just reading web services tutorial from Sun where I noticed the following
A service endpoint interface must conform to a few rules:
• It extends the java.rmi.Remote interface.
• It must not have constant declarations, such as public final static.
Why the above restrictions?

Thanks

Pradeep,
I just started looking at this forum...
My understanding of these points is as follows. First, you are not actually forced to use the rmi.Remote, but you must implement it.
Second, the static final really only applies to objects (not primitives). The reason is that the interface is stateless, so there would be no assurance that your created objects will be what you expect in subsequent invokations.
I hope this helps (my experience with web services with java comes from one of my recent courses in a Masters program, by the way.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, you are not actually forced to use the rmi.Remote, but you must implement it.

To create an webserice in JAX-RPC we need to create an interface that extends java.rmi.Remote, implement that interface. Remote interface is just a signal(empty) interface .

.
the static final really only applies to objects (not primitives).

I dont agree
The reason is that the interface is stateless, so there would be no assurance that your created objects will be what you expect in subsequent invokations.

can you please explain.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think about that ...
1. JAX-RPC is created as same as Java RMI (in idea) .
When you have been created application with Java RMI, i think you will easy to create JAX-RPC application.
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:

"...interface is stateless, so there would be no assurance that your created objects will be what you expect in subsequent invokations..."
can you please explain.

Pradeep,
As I began writng my answer, I realized that this question would be a nice opportunity to invite comment from Paul. So, I am going to start a fresh thread on this (that he is more likely to notice).
PS thanks for the questions
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you have been created application with Java RMI, i think you will easy to create JAX-RPC application.

Yes it is easy but we need to know why and what we are doing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic