users@jax-rpc.java.net

Re: Service Implementation class name

From: Sang Shin <Sang_at_east.sun.com>
Date: Sun, 31 Mar 2002 07:43:28 -0700

OK. By rereading the spec, I get some some answers to my question.
The spec says the following under the section of 4.3.10 Service Interface.

"The method getPort(class) returns either an instance of generated stub
implementation class or a dynamic proxy. ... In the implementation of
this method, the JAX-RPC runtime system takes the responsibility of
selecting a protocol binding (and a port) and configure the stub accordingly.
The returned stub instance should not be reconfigured by the client."

So when you get a stub object using getPort() method, you are not
supposed to change the parameters.

The spec also says that in addition to getPort() method, the service
instance also supports get<Name_of_wsdl:port>() method which
also returns a stub object. JAX-RPC runtime system can optionally
support extra get<Name_of_wsdl:port>() methods in which
client can pass properties such as username and parameter. (I
am kind of curious why the spec does not define a set of standard
get<Name_of_wsd:port>() methods so that portability of code
can be guranteed in this case.)

So I guess the better sample code for the FCS release would be
to use get<Name_of_wsdl:port>() method in which target
endpoint address can be passed as a parameter. (This might
not be portable, however.) Comments?

-Sang

Sang Shin wrote:
>
> > So the eventual code should look like
> >
> > // pass some properties
> > Service service =
> > ServiceFactory.newInstance().createService(...);
> > HelloIF hello= (HelloIF)service.getPort(HelloIF.class);
> > hello.sayHello();
> >
> > Hope this helps
> >
>
> Thanks, Sam. That definitely helps.
>
> One remaining question on this code is then how to set the
> target
> endpoint address or other properties.
>
> In order to set the target end point address property, you
> need a Stub object,
> which is why I assume the current HelloWorld sample is
> written in the way it is
> right now. And that was why I posted another question on
> getPost()
> method. That is, the API spect says that the getPost()
> method with
> only service definition interface as a single parameter can
> return
> either Stub or Dynamic proxy object. Unless you know, which
> one it is, you would not be able to set the property. (As
> far as
> I can tell, you cannot set property with dynamic proxy
> object.
> I would love to be told otherwise.)
>
> -Sang Shin