You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sandeep Gupta <sa...@gmail.com> on 2006/12/27 10:09:08 UTC

Newbie Ques: A way not to hardcode the URL

Hi,

We are consuming a web-service in our project, and for this we use Axis
WSDL2JAVA tool to build skeletons and stubs. Now the webservice URL we use
for development and production are different. The skeletons generated
contain the hard-coded URL. Is there a way that we could not hard-code the
URL and pick-up from another source at runtime.... we wish not to modify the
generated skeletons, for the build process to remain automated.

Every suggestion/hint are most most welcome.

Thanks in advance.

Regards,
Sandeep Gupta

Re: Newbie Ques: A way not to hardcode the URL

Posted by Sandeep Gupta <sa...@gmail.com>.
Hi Vaclav,

Thanks for you suggestion. I externalized the URL using the explicit
constructor call while making the web-service client, passing in the URL as
one of the parameters.

Thanks again.

Regards,
Sandeep Gupta

On 12/27/06, Vyacheslav Yakovenko <ya...@gmail.com> wrote:
>
> There are simple decisions:
>
>    1. Extend you XXXSkeleton, for example: class XXX extends
>    XXXSkeleton;
>    2. Make changes into your services.xml, for example change
>    From:
>
> <parameter locked="false" name="ServiceClass">
> com.webtair.sessionman.example.SessionManExampleServiceSkeleton
> </parameter>
> To:
> <parameter locked="false" name="ServiceClass">
> com.webtair.sessionman.example.SessionManExampleService
> </parameter>
>
> Make your changes only into your class!
> 3.Hardcoded URI      contains in the XXXStub not in the XXXSkeleton, but
> there is another method public SessionManExampleServiceStub(
> java.lang.String targetEndpoint)  that allows to specify concrete
> endpoint. You can extract this information into properties file of course.
>
> Vaclav
>
> On 12/27/06, Sandeep Gupta <sa...@gmail.com> wrote:
> >
> > Hi,
> >
> > We are consuming a web-service in our project, and for this we use Axis
> > WSDL2JAVA tool to build skeletons and stubs. Now the webservice URL we use
> > for development and production are different. The skeletons generated
> > contain the hard-coded URL. Is there a way that we could not hard-code the
> > URL and pick-up from another source at runtime.... we wish not to modify the
> > generated skeletons, for the build process to remain automated.
> >
> > Every suggestion/hint are most most welcome.
> >
> > Thanks in advance.
> >
> > Regards,
> > Sandeep Gupta
> >
> >
> --
> Vaclav
> _________________________
> Sun Certified Programmer for Java 2 Platform
> gTalk, msn: yakovenko@gmail.com
> cv: http://www.vaclav.kiev.ua/cv
> http://www.vaclav.kiev.ua
> http://www.wtg.kiev.ua
> icq: 196335325

Re: Newbie Ques: A way not to hardcode the URL

Posted by Vyacheslav Yakovenko <ya...@gmail.com>.
There are simple decisions:

   1. Extend you XXXSkeleton, for example: class XXX extends XXXSkeleton;
   2. Make changes into your services.xml, for example change
   From:

<parameter locked="false" name="ServiceClass">
com.webtair.sessionman.example.SessionManExampleServiceSkeleton
</parameter>
To:
<parameter locked="false" name="ServiceClass">
com.webtair.sessionman.example.SessionManExampleService
</parameter>

Make your changes only into your class!
3.Hardcoded URI      contains in the XXXStub not in the XXXSkeleton, but
there is another method public
SessionManExampleServiceStub(java.lang.StringtargetEndpoint)  that
allows to specify concrete endpoint. You can extract
this information into properties file of course.

Vaclav

On 12/27/06, Sandeep Gupta <sa...@gmail.com> wrote:
>
> Hi,
>
> We are consuming a web-service in our project, and for this we use Axis
> WSDL2JAVA tool to build skeletons and stubs. Now the webservice URL we use
> for development and production are different. The skeletons generated
> contain the hard-coded URL. Is there a way that we could not hard-code the
> URL and pick-up from another source at runtime.... we wish not to modify the
> generated skeletons, for the build process to remain automated.
>
> Every suggestion/hint are most most welcome.
>
> Thanks in advance.
>
> Regards,
> Sandeep Gupta
>
>
-- 
Vaclav
_________________________
Sun Certified Programmer for Java 2 Platform
gTalk, msn: yakovenko@gmail.com
cv: http://www.vaclav.kiev.ua/cv
http://www.vaclav.kiev.ua
http://www.wtg.kiev.ua
icq: 196335325