Sure. In that case, when you first generate the client-side stub, modify the
generated code. Where it hard-codes the server name and port, make it call
some function that looks up a properties file. Then compile the modified
stub and hand it to your client along with instructions on how to create the
appropriate properties file.
Here's a sample:
Find MyServiceLocator.java in the generated stub code.
Go to the line that says
private java.lang.String AvakiAPIRpcEnc_address =
"http://myserver:8080/axis/services/MyService";
and change it to:
private java.lang.String AvakiAPIRpcEnc_address = "" +
com.abc.ws.client.rpcenc.BaseWSClient.WS_SERVER_PROTOCOL + "://" +
com.abc.ws.client.rpcenc.BaseWSClient.WS_SERVER_HOST + ":" +
com.abc.ws.client.rpcenc.BaseWSClient.WS_SERVER_PORT +
"/axis/services/MyService";
Then, create the class com.abc.ws.client.rpcenc.BaseWSClient.java. In it,
- create the public static String variables required above
- read in a well-known properties file to fill those variables
Next, derive each of your WS clients from BaseWSClient.java. That way all of
them can access those public static variables when the call the locator.
Compile everything.
I've done exactly this for client code that I hand to our customers gratis,
and it works.
Anand
On Tue, 3 Aug 2004, Cervi, Anthony (PCLN-NW) wrote:
:
: thanks. i'm not concerned with the server side at all though. my client is running
against a test server right now and will need to switch to a production server soon.
instead of recompiling my client code, i would like to be able to read the url from a
config file and use code to point to the new server.
:
: -----Original Message-----
: From: Anand Natrajan [mailto:[EMAIL PROTECTED]
: Sent: Tuesday, August 03, 2004 2:00 PM
: To: [EMAIL PROTECTED]
: Subject: Re: two questions...
:
:
: The classes that have the web server hard-coded in them are purely
: client-side stub classes. They are not necessary on the server side.
:
: After you deploy your services on the production server, your clients can
: get a WSDL, run wsdl2java and generate the stubs themselves. You should not
: have to hand them the stubs as well.
:
: Anand
:
: On Tue, 3 Aug 2004, Cervi, Anthony (PCLN-NW) wrote:
:
: :
: : first question might sound dumb since i'm not hip to the web service lingo but
here it goes anyway. when i generate the client classes from the wsdl, the webservice
url (endpoint?) gets hard-coded right into the classes themselves. i need to change
that address when i move to the production server. is there some way i can set that
value through code or do i need to run wsdl2java on the wsdl that has the production
url?
: :
: : second question. i'm using Stub.setTimeout and it doesn't seem to timeout even
with very small timeout specified? any known issues with this?
: :
: : thanks.
:
: