Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #24852 > unrolled thread

Axis2 web service How to Make Web Service Address Configurable

Started byzigzagdna@yahoo.com
First post2013-07-30 21:30 -0700
Last post2013-07-31 23:26 -0400
Articles 9 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Axis2 web service How to Make Web Service Address Configurable zigzagdna@yahoo.com - 2013-07-30 21:30 -0700
    Re: Axis2 web service How to Make Web Service Address Configurable Sebastian <news@seyweiler.dyndns.org> - 2013-07-31 07:26 +0200
      Re: Axis2 web service How to Make Web Service Address Configurable zigzagdna@yahoo.com - 2013-07-31 09:28 -0700
    Re: Axis2 web service How to Make Web Service Address Configurable Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-31 18:04 -0300
      Re: Axis2 web service How to Make Web Service Address Configurable Lew <lewbloch@gmail.com> - 2013-07-31 14:14 -0700
        Re: Axis2 web service How to Make Web Service Address Configurable zigzagdna@yahoo.com - 2013-07-31 15:07 -0700
          Re: Axis2 web service How to Make Web Service Address Configurable Lew <lewbloch@gmail.com> - 2013-07-31 17:47 -0700
            Re: Axis2 web service How to Make Web Service Address Configurable Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-31 22:04 -0300
    Re: Axis2 web service How to Make Web Service Address Configurable Arne Vajhøj <arne@vajhoej.dk> - 2013-07-31 23:26 -0400

#24852 — Axis2 web service How to Make Web Service Address Configurable

Fromzigzagdna@yahoo.com
Date2013-07-30 21:30 -0700
SubjectAxis2 web service How to Make Web Service Address Configurable
Message-ID<160ade1f-4f9c-43a9-aeb8-d9d4f600184f@googlegroups.com>
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/ws/SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS/SG910_BtB_IN0138_NonConformances_ETS_Source_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,

[toc] | [next] | [standalone]


#24853

FromSebastian <news@seyweiler.dyndns.org>
Date2013-07-31 07:26 +0200
Message-ID<kta765$gpo$1@news.albasani.net>
In reply to#24852
Am 31.07.2013 06:30, schrieb zigzagdna@yahoo.com:
> 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/ws/SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS/SG910_BtB_IN0138_NonConformances_ETS_Source_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

[toc] | [prev] | [next] | [standalone]


#24855

Fromzigzagdna@yahoo.com
Date2013-07-31 09:28 -0700
Message-ID<eaa739af-ea7d-431b-b35b-9689ee8b4d33@googlegroups.com>
In reply to#24853
On Wednesday, July 31, 2013 1:26:55 AM UTC-4, Sebastian wrote:
> Am 31.07.2013 06:30, schrieb zigzagdna@yahoo.com: > 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/ws/SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS/SG910_BtB_IN0138_NonConformances_ETS_Source_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 service URL etc are configurable in some file.  Google erach shows some information which is confusing.

[toc] | [prev] | [next] | [standalone]


#24859

FromArved Sandstrom <asandstrom2@eastlink.ca>
Date2013-07-31 18:04 -0300
Message-ID<YZeKt.101731$iM7.68974@fx05.iad>
In reply to#24852
On 07/31/2013 01:30 AM, zigzagdna@yahoo.com wrote:
> 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/ws/SG910_BtB_IN0138_NonConformances_ETS_Source_v1.webService.receiveNonConformanceWS/SG910_BtB_IN0138_NonConformances_ETS_Source_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

-- 
When a true genius appears, you can know him by this sign:
that all the dunces are in a confederacy against him.
-- Jonathan Swift

[toc] | [prev] | [next] | [standalone]


#24861

FromLew <lewbloch@gmail.com>
Date2013-07-31 14:14 -0700
Message-ID<ee19731e-d2b2-4bc8-9d04-07edb3133576@googlegroups.com>
In reply to#24859
I always used to just WSDL the URL with a "localhost/..." and just had Axis call the actual 
URL at run time. 

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#24862

Fromzigzagdna@yahoo.com
Date2013-07-31 15:07 -0700
Message-ID<a83d7f21-4c0d-48bf-910a-092147ce8f3f@googlegroups.com>
In reply to#24861
On Wednesday, July 31, 2013 5:14:52 PM UTC-4, Lew wrote:
> I always used to just WSDL the URL with a "localhost/..." and just had Axis call the actual 
> 
> URL at run time. 
> 
> 
> 
> -- 
> 
> Lew

Thanks, I will do just that.

[toc] | [prev] | [next] | [standalone]


#24863

FromLew <lewbloch@gmail.com>
Date2013-07-31 17:47 -0700
Message-ID<a9a036a4-b77a-4b58-8e9a-910d048f5bd6@googlegroups.com>
In reply to#24862
zigz...@yahoo.com wrote:
> Lew wrote:
>> I always used to just WSDL the URL with a "localhost/..." and just had Axis call the actual 
>> URL at run time. 
> 
> 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.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#24864

FromArved Sandstrom <asandstrom2@eastlink.ca>
Date2013-07-31 22:04 -0300
Message-ID<buiKt.128226$zd5.117946@fx18.iad>
In reply to#24863
On 07/31/2013 09:47 PM, Lew wrote:
> zigz...@yahoo.com wrote:
>> Lew wrote:
>>> I always used to just WSDL the URL with a "localhost/..." and just had Axis call the actual
>>> URL at run time.
>>
>> 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.
>
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

-- 
When a true genius appears, you can know him by this sign:
that all the dunces are in a confederacy against him.
-- Jonathan Swift

[toc] | [prev] | [next] | [standalone]


#24865

FromArne Vajhøj <arne@vajhoej.dk>
Date2013-07-31 23:26 -0400
Message-ID<51f9d556$0$296$14726298@news.sunsite.dk>
In reply to#24852
On 7/31/2013 12:30 AM, zigzagdna@yahoo.com wrote:
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web