Axis2 web service How to Make Web Service Address Configurable

Z

zigzagdna

Subject: Axis2 web service How to Make Web Service Address Configurable

I am generating client and web service code from a wsdl file. Now my wsdl file has following for web service end point address:
<wsdl:service name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS">
- <wsdl:port name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Port" binding="tns:SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Binder">
<soap:address location="http://itsusmpl00082.jnj.com:7996/w...ce_v1_webService_receiveNonConformanceWS_Port" />
</wsdl:port>
</wsdl:service>


Now location is here is hardcoded to refer to some address. Now I am using wsdl2java to generate code. But code has address hardcoded. Since this address can change from dev to qa to prod. How can I make generated code independent of address; i.e., generated code will work across all environments.

I am new to axis2 and this code generation, so appreciate any guidance,
 
S

Sebastian

Am 31.07.2013 06:30, schrieb (e-mail address removed):
Subject: Axis2 web service How to Make Web Service Address Configurable

I am generating client and web service code from a wsdl file. Now my wsdl file has following for web service end point address:
<wsdl:service name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS">
-<wsdl:port name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Port" binding="tns:SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Binder">
<soap:address location="http://itsusmpl00082.jnj.com:7996/w...ce_v1_webService_receiveNonConformanceWS_Port" />
</wsdl:port>
</wsdl:service>


Now location is here is hardcoded to refer to some address. Now I am using wsdl2java to generate code. But code has address hardcoded. Since this address can change from dev to qa to prod. How can I make generated code independent of address; i.e., generated code will work across all environments.

I am new to axis2 and this code generation, so appreciate any guidance,
if the endpoints are different, I guess there would be multiple wsdl's,
each appropriate to the environment. So you could
a) generate the code for each environment separately
b) use Ant or Maven to deploy the code appropriate for each environment.

Alternatively, perhaps you could do the code generation in each of the
environments (perhaps even at runtime) and load the artifacts dynamically.

-- Sebastian
 
Z

zigzagdna

Am 31.07.2013 06:30, schrieb (e-mail address removed): > Subject: Axis2 web service How to Make Web Service Address Configurable > > I am generating client and web service code from a wsdl file. Now my wsdl file has following for web service end point address: > <wsdl:service name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS"> > -<wsdl:port name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Port" binding="tns:SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Binder"> > <soap:address location="http://itsusmpl00082.jnj.com:7996/w...ce_v1_webService_receiveNonConformanceWS_Port" /> > </wsdl:port> > </wsdl:service> > > > Now location is here is hardcoded to refer to some address. Now I am using wsdl2java to generate code. But code has address hardcoded. Since this address can change from dev to qa to prod. How can I make generated code independent of address; i.e., generated code will work across all environments. > > I am new to axis2 and this code generation, so appreciate any guidance, > > if the endpoints are different, I guess there would be multiple wsdl's, each appropriate to the environment. So you could a) generate the code for each environment separately b) use Ant or Maven to deploy the code appropriate for each environment. Alternatively,perhaps you could do the code generation in each of the environments (perhaps even at runtime) and load the artifacts dynamically. -- Sebastian

Thanks, but there has to be a better way, so code is generated only once and then modified so it becomes independentof the environment and web serviceURL etc are configurable in some file. Google erach shows some information which is confusing.
 
A

Arved Sandstrom

Subject: Axis2 web service How to Make Web Service Address Configurable

I am generating client and web service code from a wsdl file. Now my wsdl file has following for web service end point address:
<wsdl:service name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS">
- <wsdl:port name="SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Port" binding="tns:SG910_BtB_IN0138_NonConformances_ETS_Source_v1_webService_receiveNonConformanceWS_Binder">
<soap:address location="http://itsusmpl00082.jnj.com:7996/w...ce_v1_webService_receiveNonConformanceWS_Port" />
</wsdl:port>
</wsdl:service>


Now location is here is hardcoded to refer to some address. Now I am using wsdl2java to generate code. But code has address hardcoded. Since this address can change from dev to qa to prod. How can I make generated code independent of address; i.e., generated code will work across all environments.

I am new to axis2 and this code generation, so appreciate any guidance,
It's been quite a while since I used Axis, I've preferred CXF for years,
but it doesn't much matter since it's all about conforming to JAX-WS.

When I use CXF and generate client code, for example, I do get that
annoying hardcoded @WebServiceClient annotation. Point being, that's
information for the default javax.xml.ws.Service constructor...but there
is another constructor where you can provide a different WSDL URL.

AHS
 
L

Lew

I always used to just WSDL the URL with a "localhost/..." and just had Axis call the actual
URL at run time.
 
L

Lew

Thanks, I will do just that.

One caveat - this was an old version of Axis a few years ago. I can't guarantee the behavior is the
same now.

In those days, at least, the system somehow figured out the right URL at run time.
 
A

Arved Sandstrom

One caveat - this was an old version of Axis a few years ago. I can't guarantee the behavior is the
same now.

In those days, at least, the system somehow figured out the right URL at run time.
I think we're all talking the same approach here. For WSDL-first the
generated @WebServiceClient annotation is more documentation and tools
support than anything else; the code that calls the client stub can
choose what actual endpoint URL and QName to supply. The WSDL URL can be
externally configured; the annotation can be reflected to manufacture
the QName...after all, if this latter changes then the WSDL itself
changed and you have generated new client code.

AHS
 
A

Arne Vajhøj

Subject: Axis2 web service How to Make Web Service Address Configurable
Now location is here is hardcoded to refer to some address. Now I am
using wsdl2java to generate code. But code has address hardcoded. Since
this address can change from dev to qa to prod. How can I make generated
code independent of address; i.e., generated code will work across all
environments.

I am new to axis2 and this code generation, so appreciate any guidance,

If you use stub generated by Java SE wsimport, then you can specify the
URL of the WSDL in the service constructor.

If you make a manual call using standard JAX-WS, then you specify
the URL of the WSDL in the service create method.

If you use stub generated by Axis2 WSDL2Java or codegen ant task, then
you can specify the URL of the service itself in the service
constructor.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top