You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Guillaume Sauthier <Gu...@Bull.Net> on 2003/10/01 15:19:54 UTC

Generated Class Configuration

Hello all

Maybe I don't post this question at the right place but nobody on
axis-users list answer me. And I thinks that's a question that might be
interresting for the ones who are trying to use Axis in a J2EE compliant
way.

The problem is the following :
In order to integrate Axis in JOnAS (OpenSource J2EE Application
Server), we have to follow the JSR109/921. In this spec, they add a new
element in servlet and ejb Deployment Desc (the component that can be
WebServices client) : service-ref. 
This element describe the port that the component will use (with
port-component-ref element). And the port-component-ref can specify a
port-component-link, That just say that the port used by the client is
contained in the same application unit (ear file). So the URL location
of this port is unknown when we generate the Service implementation from
WSDL (the Definition with a dummy location attribute) and so we have to
specify it when deploying in
the server (we can then calculate the URL of the port).

That's for the context :) Now, how things works ?
When we generate Class from WSDL, Service class are generated with the
endpointURL of the WSDL (dummy value). And when we request a port with
this Service class, this endpointURL is always used, and we have no way
to change it (no accessor, more the endpointURL field is final!).

Is there a correct way to tell the Service class to use another endpoint
value (the updated one, computed at time of the endpoint deployment on
the Application Server)?

The easiest way I found is to change the WSDL2Java tool for removing the
"final" attribute of the endpointURL and add a setEndpointURL(QName
port, URL newURL) for replacing the endpoint value.

I will be pleased to read your point of view on this question. 

Regards

Guillaume

Re: Generated Class Configuration

Posted by Steve Loughran <st...@iseran.com>.
Guillaume Sauthier wrote:
> Hello all
> 
> Maybe I don't post this question at the right place but nobody on
> axis-users list answer me. And I thinks that's a question that might be
> interresting for the ones who are trying to use Axis in a J2EE compliant
> way.
> 
> The problem is the following :
> In order to integrate Axis in JOnAS (OpenSource J2EE Application
> Server), we have to follow the JSR109/921. In this spec, they add a new
> element in servlet and ejb Deployment Desc (the component that can be
> WebServices client) : service-ref. 
> This element describe the port that the component will use (with
> port-component-ref element). And the port-component-ref can specify a
> port-component-link, That just say that the port used by the client is
> contained in the same application unit (ear file). So the URL location
> of this port is unknown when we generate the Service implementation from
> WSDL (the Definition with a dummy location attribute) and so we have to
> specify it when deploying in
> the server (we can then calculate the URL of the port).
> 
> That's for the context :) Now, how things works ?
> When we generate Class from WSDL, Service class are generated with the
> endpointURL of the WSDL (dummy value). And when we request a port with
> this Service class, this endpointURL is always used, and we have no way
> to change it (no accessor, more the endpointURL field is final!).
> 
> Is there a correct way to tell the Service class to use another endpoint
> value (the updated one, computed at time of the endpoint deployment on
> the Application Server)?

Do you mean client side generated code or service side? Client-side you 
can definitely change the endpoint.

Service side, hmmm, I didnt know they need to know their endpoint.


Re: Generated Class Configuration

Posted by Davanum Srinivas <di...@yahoo.com>.
ok. i see your point. Can you please submit a patch? (remove final and add setEndpoint method).
Here are the instructions for submitting a patch.
(http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatches)

Thanks,
dims

PS: Is your JSR 109 Impl tightly integrated to JONAS? We need an 109 impl for Geronimo
(http://wiki.codehaus.org/geronimo/Architecture/WebServices)

--- Guillaume Sauthier <Gu...@Bull.Net> wrote:
> Thanks for the response :)
> 
> Ok, Maybe this time I'll success to explain my problem :) 
> 
> In fact, what I want to do is to use the generated classes (for the
> client side) with a different Endpoint URL.
> Because I am integrating Axis in an Application Server, and the user
> must get an already configured interface when he perform a lookup on the
> service, I have some constraints :
> 
> I cant say to the client : "If you use a webservices endpoint from a
> module in the same application unit, you have to set the URL by hand in
> your code!" It's impossible!
> Here is a code snippet from the spec :
> <snippet>
> InitialContext ic = new InitialContext();
> AddressBookService abf = (AddressBookService)  
> ic.lookup("java:comp/env/service/AddressBookService");
> </snippet>
> 
> So I have to preconfigure the service objects he will retrieve from the
> lookup call.
> When the user have a generated service class binded in the JNDI, the
> endpoint URL of the Ports he might access are hardcoded! So I cannot
> change them ! (no setEndpoint methods !).More, the generated Service
> class construct a new **SoapBinding for each <service>.get<PortName>()
> call (with the hardcoded endpointURL :'( ).
> 
> That why the only solution I find is to modify WSDL2Java!
> 
> Regards
> Guillaume
> 
> Davanum Srinivas wrote:
> > 
> > Guillaume,
> > 
> > Am confused. Are you talking about the **BindingStub.java class? It's not needed on the
> > server-side. It's used from a client when the client wants to invoke the service. That's the
> only
> > class that has a endpointURL param, note that **BindingStub.java classes have additional
> > constructors where you can pass in the endpoint url as well.
> > 
> > Thanks,
> > -- dims
> > 
> > --- Guillaume Sauthier <Gu...@Bull.Net> wrote:
> > > Hello all
> > >
> > > Maybe I don't post this question at the right place but nobody on
> > > axis-users list answer me. And I thinks that's a question that might be
> > > interresting for the ones who are trying to use Axis in a J2EE compliant
> > > way.
> > >
> > > The problem is the following :
> > > In order to integrate Axis in JOnAS (OpenSource J2EE Application
> > > Server), we have to follow the JSR109/921. In this spec, they add a new
> > > element in servlet and ejb Deployment Desc (the component that can be
> > > WebServices client) : service-ref.
> > > This element describe the port that the component will use (with
> > > port-component-ref element). And the port-component-ref can specify a
> > > port-component-link, That just say that the port used by the client is
> > > contained in the same application unit (ear file). So the URL location
> > > of this port is unknown when we generate the Service implementation from
> > > WSDL (the Definition with a dummy location attribute) and so we have to
> > > specify it when deploying in
> > > the server (we can then calculate the URL of the port).
> > >
> > > That's for the context :) Now, how things works ?
> > > When we generate Class from WSDL, Service class are generated with the
> > > endpointURL of the WSDL (dummy value). And when we request a port with
> > > this Service class, this endpointURL is always used, and we have no way
> > > to change it (no accessor, more the endpointURL field is final!).
> > >
> > > Is there a correct way to tell the Service class to use another endpoint
> > > value (the updated one, computed at time of the endpoint deployment on
> > > the Application Server)?
> > >
> > > The easiest way I found is to change the WSDL2Java tool for removing the
> > > "final" attribute of the endpointURL and add a setEndpointURL(QName
> > > port, URL newURL) for replacing the endpoint value.
> > >
> > > I will be pleased to read your point of view on this question.
> > >
> > > Regards
> > >
> > > Guillaume
> > 
> > =====
> > Davanum Srinivas - http://webservices.apache.org/~dims/


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

Re: Generated Class Configuration

Posted by Guillaume Sauthier <Gu...@Bull.Net>.
Thanks for the response :)

Ok, Maybe this time I'll success to explain my problem :) 

In fact, what I want to do is to use the generated classes (for the
client side) with a different Endpoint URL.
Because I am integrating Axis in an Application Server, and the user
must get an already configured interface when he perform a lookup on the
service, I have some constraints :

I cant say to the client : "If you use a webservices endpoint from a
module in the same application unit, you have to set the URL by hand in
your code!" It's impossible!
Here is a code snippet from the spec :
<snippet>
InitialContext ic = new InitialContext();
AddressBookService abf = (AddressBookService)  
ic.lookup("java:comp/env/service/AddressBookService");
</snippet>

So I have to preconfigure the service objects he will retrieve from the
lookup call.
When the user have a generated service class binded in the JNDI, the
endpoint URL of the Ports he might access are hardcoded! So I cannot
change them ! (no setEndpoint methods !).More, the generated Service
class construct a new **SoapBinding for each <service>.get<PortName>()
call (with the hardcoded endpointURL :'( ).

That why the only solution I find is to modify WSDL2Java!

Regards
Guillaume

Davanum Srinivas wrote:
> 
> Guillaume,
> 
> Am confused. Are you talking about the **BindingStub.java class? It's not needed on the
> server-side. It's used from a client when the client wants to invoke the service. That's the only
> class that has a endpointURL param, note that **BindingStub.java classes have additional
> constructors where you can pass in the endpoint url as well.
> 
> Thanks,
> -- dims
> 
> --- Guillaume Sauthier <Gu...@Bull.Net> wrote:
> > Hello all
> >
> > Maybe I don't post this question at the right place but nobody on
> > axis-users list answer me. And I thinks that's a question that might be
> > interresting for the ones who are trying to use Axis in a J2EE compliant
> > way.
> >
> > The problem is the following :
> > In order to integrate Axis in JOnAS (OpenSource J2EE Application
> > Server), we have to follow the JSR109/921. In this spec, they add a new
> > element in servlet and ejb Deployment Desc (the component that can be
> > WebServices client) : service-ref.
> > This element describe the port that the component will use (with
> > port-component-ref element). And the port-component-ref can specify a
> > port-component-link, That just say that the port used by the client is
> > contained in the same application unit (ear file). So the URL location
> > of this port is unknown when we generate the Service implementation from
> > WSDL (the Definition with a dummy location attribute) and so we have to
> > specify it when deploying in
> > the server (we can then calculate the URL of the port).
> >
> > That's for the context :) Now, how things works ?
> > When we generate Class from WSDL, Service class are generated with the
> > endpointURL of the WSDL (dummy value). And when we request a port with
> > this Service class, this endpointURL is always used, and we have no way
> > to change it (no accessor, more the endpointURL field is final!).
> >
> > Is there a correct way to tell the Service class to use another endpoint
> > value (the updated one, computed at time of the endpoint deployment on
> > the Application Server)?
> >
> > The easiest way I found is to change the WSDL2Java tool for removing the
> > "final" attribute of the endpointURL and add a setEndpointURL(QName
> > port, URL newURL) for replacing the endpoint value.
> >
> > I will be pleased to read your point of view on this question.
> >
> > Regards
> >
> > Guillaume
> 
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/

Re: Generated Class Configuration

Posted by Davanum Srinivas <di...@yahoo.com>.
Guillaume,

Am confused. Are you talking about the **BindingStub.java class? It's not needed on the
server-side. It's used from a client when the client wants to invoke the service. That's the only
class that has a endpointURL param, note that **BindingStub.java classes have additional
constructors where you can pass in the endpoint url as well.

Thanks,
-- dims 

--- Guillaume Sauthier <Gu...@Bull.Net> wrote:
> Hello all
> 
> Maybe I don't post this question at the right place but nobody on
> axis-users list answer me. And I thinks that's a question that might be
> interresting for the ones who are trying to use Axis in a J2EE compliant
> way.
> 
> The problem is the following :
> In order to integrate Axis in JOnAS (OpenSource J2EE Application
> Server), we have to follow the JSR109/921. In this spec, they add a new
> element in servlet and ejb Deployment Desc (the component that can be
> WebServices client) : service-ref. 
> This element describe the port that the component will use (with
> port-component-ref element). And the port-component-ref can specify a
> port-component-link, That just say that the port used by the client is
> contained in the same application unit (ear file). So the URL location
> of this port is unknown when we generate the Service implementation from
> WSDL (the Definition with a dummy location attribute) and so we have to
> specify it when deploying in
> the server (we can then calculate the URL of the port).
> 
> That's for the context :) Now, how things works ?
> When we generate Class from WSDL, Service class are generated with the
> endpointURL of the WSDL (dummy value). And when we request a port with
> this Service class, this endpointURL is always used, and we have no way
> to change it (no accessor, more the endpointURL field is final!).
> 
> Is there a correct way to tell the Service class to use another endpoint
> value (the updated one, computed at time of the endpoint deployment on
> the Application Server)?
> 
> The easiest way I found is to change the WSDL2Java tool for removing the
> "final" attribute of the endpointURL and add a setEndpointURL(QName
> port, URL newURL) for replacing the endpoint value.
> 
> I will be pleased to read your point of view on this question. 
> 
> Regards
> 
> Guillaume


=====
Davanum Srinivas - http://webservices.apache.org/~dims/