You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by rickthemick <sj...@gmail.com> on 2011/11/30 09:33:33 UTC

base-address for CXF

Hi!

Because of our network setup (I guess), CXF is generating a correct (based
on the server IP) but not desired URL for our services when listing them at
http://server/cxf.

For this reason I want to force the base address for our services. We are
running CXF on a OSGi runtime and uses Spring to configure the services,
like this:

  
  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

  
  <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
    address="/myservice" />

I have found fragments of information about a config property called
"base-address" but I fail to apply it to our services. I cant find any
information about it on the cxf.apache.org pages.

Can somebody please direct me how to use this property? Or is there some
other way to do this? 

What I have done so far is to have the property set in the OSGi config admin
services (by following the example for changing the alias "/cxf" here
http://fusesource.com/issues/browse/ESB-813), from Apache Felix web console:
PID = org.apache.cxf.osgi.cfg
  BundleLocation = Unbound
  base-address = myserver
  org.apache.cxf.servlet.base-address = myserver
  service.pid = org.apache.cxf.osgi.cfg

... but this doesnt seem to help me!

Hope for you help, thanks Rickard!




--
View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5034937.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: base-address for CXF

Posted by William Tam <em...@gmail.com>.
Finally, I got a chance to follow up.   Thanks Freeman for creating a 
Jira and addressing the issue.

On 01/16/2012 01:08 AM, Freeman Fang wrote:
> Hi William,
>
> Sorry for the late response, last week I was on travel so can't catch 
> email in time.
>
> Your suggestion looks good for me, could you please raise a jira and 
> append a patch?
>
> Thanks
> Freeman
> On 2012-1-14, at 上午3:40, William Tam wrote:
>
>> Anyone else can response, too.   (Perhaps, Freeman is unavailable).
>>
>> Thanks.
>>
>> On 01/11/2012 06:20 PM, William Tam wrote:
>>> Hi Freeman,
>>>
>>> I think I see an issue that can prevent publishedEndpointUrl 
>>> property to be set on EndpointInfo object if the endpoint is created 
>>> by a non-jaxws frontend.  (it is done when 
>>> org.apache.cxf.jaxws.EndpointImp.doPublish() is  called)
>>>
>>> In AbstractWSDLBasedEndpointFactory, the following snippet will set 
>>> publishedEndpointUrl property which is inside createEndpointInfo()  
>>> method.
>>>
>>>        if (publishedEndpointUrl != null && 
>>> !"".equals(publishedEndpointUrl)) {
>>>            ei.setProperty("publishedEndpointUrl", 
>>> publishedEndpointUrl);
>>>        }
>>>
>>> However, the EndpointInfo object could be created by other factories 
>>> (e.g. SoapTransportFactory) and so the 
>>> AbstractWSDLBasedEndpointFactory.createEndpointInfo() method may not 
>>> be called at all.  As a result, the publishedEndpointUrl may not be 
>>> set.
>>>
>>> I would suggest moving the snippet to the createEndpoint() need line 
>>> 159.  (see diff from trunk below). That way, the 
>>> publishedEndpointUrl is set on EndpointInfo regardless how it was 
>>> created.
>>>
>>> Index: 
>>> src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
>>> ===================================================================
>>> --- 
>>> src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java    
>>> (revision 1229797)
>>> +++ 
>>> src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java    
>>> (working copy)
>>> @@ -157,6 +157,10 @@
>>>             ei.setAddress(getAddress());
>>>         }
>>>
>>> +        if (publishedEndpointUrl != null && 
>>> !"".equals(publishedEndpointUrl)) {
>>> +            ei.setProperty("publishedEndpointUrl", 
>>> publishedEndpointUrl);
>>> +        }
>>> +
>>>         if (endpointReference != null) {
>>>             ei.setAddress(endpointReference);
>>>         }
>>> @@ -294,10 +298,6 @@
>>>         ei.setAddress(getAddress());
>>>         ei.setBinding(bindingInfo);
>>>
>>> -        if (publishedEndpointUrl != null && 
>>> !"".equals(publishedEndpointUrl)) {
>>> -            ei.setProperty("publishedEndpointUrl", 
>>> publishedEndpointUrl);
>>> -        }
>>> -
>>>         if (wsdlEndpointFactory != null) {
>>>             wsdlEndpointFactory.createPortExtensors(ei, service);
>>>         }
>>>
>>> Thanks.
>>>
>>> On 11/30/2011 07:59 PM, Freeman Fang wrote:
>>>>
>>>> On 2011-11-30, at 下午9:30, rickthemick wrote:
>>>>
>>>>> I cant see that it works like you describe it.
>>>>>
>>>>> Adding publishedEndpointUrl in my Spring conf:
>>>>>
>>>>> <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
>>>>>   address="/myservice" >
>>>>> <jaxws:properties>
>>>>> <entry key="publishedEndpointUrl" value="myserver" />
>>>>> </jaxws:properties>
>>>>> </jaxws:endpoint>
>>>> Hi,
>>>>
>>>> You need change the publishedEndpointUrl value to 
>>>> http://myserver/cxf/myservice
>>>> Also in the Service List Page, you can find the wsdl URL there is 
>>>> http://myserver/cxf/myservice?wsdl.
>>>> I just tested it with 2.4.4, it works for me.
>>>>
>>>> Freeman
>>>>>
>>>>> - Does not affect the service listing, I dont get "myserver" as 
>>>>> host for the
>>>>> services.
>>>>> - And in the WSDL, it affects the whole service URL, not just the
>>>>> host/server part:
>>>>> <wsdl:port binding="tns:ConfigDbServiceImplServiceSoapBinding"
>>>>> name="ConfigDbServiceImplPort">
>>>>> <soap:address location="myserver"/>
>>>>> </wsdl:port>
>>>>>
>>>>> It should be: http://myserver/cxf/myservice I believe.
>>>>> - Even if it would work, I dont want to control this in the "code" 
>>>>> (the
>>>>> spring config in the service bundle).
>>>>>
>>>>> In my understanding its still base-address that would solve my 
>>>>> problem, but
>>>>> I dont know how to make it affective and I havent found the 
>>>>> definition of it
>>>>> either.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> View this message in context: 
>>>>> http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035493.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>> ---------------------------------------------
>>>> Freeman Fang
>>>>
>>>> FuseSource
>>>> Email:ffang@fusesource.com
>>>> Web: fusesource.com
>>>> Twitter: freemanfang
>>>> Blog: http://freemanfang.blogspot.com
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>
> ---------------------------------------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
>
>
>
>
>
>
>
>
>
>

Re: base-address for CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi William,

Sorry for the late response, last week I was on travel so can't catch  
email in time.

Your suggestion looks good for me, could you please raise a jira and  
append a patch?

Thanks
Freeman
On 2012-1-14, at 上午3:40, William Tam wrote:

> Anyone else can response, too.   (Perhaps, Freeman is unavailable).
>
> Thanks.
>
> On 01/11/2012 06:20 PM, William Tam wrote:
>> Hi Freeman,
>>
>> I think I see an issue that can prevent publishedEndpointUrl  
>> property to be set on EndpointInfo object if the endpoint is  
>> created by a non-jaxws frontend.  (it is done when  
>> org.apache.cxf.jaxws.EndpointImp.doPublish() is  called)
>>
>> In AbstractWSDLBasedEndpointFactory, the following snippet will set  
>> publishedEndpointUrl property which is inside createEndpointInfo()   
>> method.
>>
>>        if (publishedEndpointUrl != null  
>> && !"".equals(publishedEndpointUrl)) {
>>            ei.setProperty("publishedEndpointUrl",  
>> publishedEndpointUrl);
>>        }
>>
>> However, the EndpointInfo object could be created by other  
>> factories (e.g. SoapTransportFactory) and so the  
>> AbstractWSDLBasedEndpointFactory.createEndpointInfo() method may  
>> not be called at all.  As a result, the publishedEndpointUrl may  
>> not be set.
>>
>> I would suggest moving the snippet to the createEndpoint() need  
>> line 159.  (see diff from trunk below). That way, the  
>> publishedEndpointUrl is set on EndpointInfo regardless how it was  
>> created.
>>
>> Index: src/main/java/org/apache/cxf/frontend/ 
>> AbstractWSDLBasedEndpointFactory.java
>> ===================================================================
>> --- src/main/java/org/apache/cxf/frontend/ 
>> AbstractWSDLBasedEndpointFactory.java    (revision 1229797)
>> +++ src/main/java/org/apache/cxf/frontend/ 
>> AbstractWSDLBasedEndpointFactory.java    (working copy)
>> @@ -157,6 +157,10 @@
>>             ei.setAddress(getAddress());
>>         }
>>
>> +        if (publishedEndpointUrl != null  
>> && !"".equals(publishedEndpointUrl)) {
>> +            ei.setProperty("publishedEndpointUrl",  
>> publishedEndpointUrl);
>> +        }
>> +
>>         if (endpointReference != null) {
>>             ei.setAddress(endpointReference);
>>         }
>> @@ -294,10 +298,6 @@
>>         ei.setAddress(getAddress());
>>         ei.setBinding(bindingInfo);
>>
>> -        if (publishedEndpointUrl != null  
>> && !"".equals(publishedEndpointUrl)) {
>> -            ei.setProperty("publishedEndpointUrl",  
>> publishedEndpointUrl);
>> -        }
>> -
>>         if (wsdlEndpointFactory != null) {
>>             wsdlEndpointFactory.createPortExtensors(ei, service);
>>         }
>>
>> Thanks.
>>
>> On 11/30/2011 07:59 PM, Freeman Fang wrote:
>>>
>>> On 2011-11-30, at 下午9:30, rickthemick wrote:
>>>
>>>> I cant see that it works like you describe it.
>>>>
>>>> Adding publishedEndpointUrl in my Spring conf:
>>>>
>>>> <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
>>>>   address="/myservice" >
>>>> <jaxws:properties>
>>>> <entry key="publishedEndpointUrl" value="myserver" />
>>>> </jaxws:properties>
>>>> </jaxws:endpoint>
>>> Hi,
>>>
>>> You need change the publishedEndpointUrl value to http://myserver/cxf/myservice
>>> Also in the Service List Page, you can find the wsdl URL there is http://myserver/cxf/myservice?wsdl 
>>> .
>>> I just tested it with 2.4.4, it works for me.
>>>
>>> Freeman
>>>>
>>>> - Does not affect the service listing, I dont get "myserver" as  
>>>> host for the
>>>> services.
>>>> - And in the WSDL, it affects the whole service URL, not just the
>>>> host/server part:
>>>> <wsdl:port binding="tns:ConfigDbServiceImplServiceSoapBinding"
>>>> name="ConfigDbServiceImplPort">
>>>> <soap:address location="myserver"/>
>>>> </wsdl:port>
>>>>
>>>> It should be: http://myserver/cxf/myservice I believe.
>>>> - Even if it would work, I dont want to control this in the  
>>>> "code" (the
>>>> spring config in the service bundle).
>>>>
>>>> In my understanding its still base-address that would solve my  
>>>> problem, but
>>>> I dont know how to make it affective and I havent found the  
>>>> definition of it
>>>> either.
>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035493.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------
>>> Freeman Fang
>>>
>>> FuseSource
>>> Email:ffang@fusesource.com
>>> Web: fusesource.com
>>> Twitter: freemanfang
>>> Blog: http://freemanfang.blogspot.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: base-address for CXF

Posted by William Tam <em...@gmail.com>.
Anyone else can response, too.   (Perhaps, Freeman is unavailable).

Thanks.

On 01/11/2012 06:20 PM, William Tam wrote:
> Hi Freeman,
>
> I think I see an issue that can prevent publishedEndpointUrl property 
> to be set on EndpointInfo object if the endpoint is created by a 
> non-jaxws frontend.  (it is done when 
> org.apache.cxf.jaxws.EndpointImp.doPublish() is  called)
>
> In AbstractWSDLBasedEndpointFactory, the following snippet will set 
> publishedEndpointUrl property which is inside createEndpointInfo()  
> method.
>
>         if (publishedEndpointUrl != null && 
> !"".equals(publishedEndpointUrl)) {
>             ei.setProperty("publishedEndpointUrl", publishedEndpointUrl);
>         }
>
> However, the EndpointInfo object could be created by other factories 
> (e.g. SoapTransportFactory) and so the 
> AbstractWSDLBasedEndpointFactory.createEndpointInfo() method may not 
> be called at all.  As a result, the publishedEndpointUrl may not be set.
>
> I would suggest moving the snippet to the createEndpoint() need line 
> 159.  (see diff from trunk below). That way, the publishedEndpointUrl 
> is set on EndpointInfo regardless how it was created.
>
> Index: 
> src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
> ===================================================================
> --- 
> src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java    
> (revision 1229797)
> +++ 
> src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java    
> (working copy)
> @@ -157,6 +157,10 @@
>              ei.setAddress(getAddress());
>          }
>
> +        if (publishedEndpointUrl != null && 
> !"".equals(publishedEndpointUrl)) {
> +            ei.setProperty("publishedEndpointUrl", 
> publishedEndpointUrl);
> +        }
> +
>          if (endpointReference != null) {
>              ei.setAddress(endpointReference);
>          }
> @@ -294,10 +298,6 @@
>          ei.setAddress(getAddress());
>          ei.setBinding(bindingInfo);
>
> -        if (publishedEndpointUrl != null && 
> !"".equals(publishedEndpointUrl)) {
> -            ei.setProperty("publishedEndpointUrl", 
> publishedEndpointUrl);
> -        }
> -
>          if (wsdlEndpointFactory != null) {
>              wsdlEndpointFactory.createPortExtensors(ei, service);
>          }
>
> Thanks.
>
> On 11/30/2011 07:59 PM, Freeman Fang wrote:
>>
>> On 2011-11-30, at 下午9:30, rickthemick wrote:
>>
>>> I cant see that it works like you describe it.
>>>
>>> Adding publishedEndpointUrl in my Spring conf:
>>>
>>> <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
>>>    address="/myservice" >
>>> <jaxws:properties>
>>> <entry key="publishedEndpointUrl" value="myserver" />
>>> </jaxws:properties>
>>> </jaxws:endpoint>
>> Hi,
>>
>> You need change the publishedEndpointUrl value to 
>> http://myserver/cxf/myservice
>> Also in the Service List Page, you can find the wsdl URL there is 
>> http://myserver/cxf/myservice?wsdl.
>> I just tested it with 2.4.4, it works for me.
>>
>> Freeman
>>>
>>> - Does not affect the service listing, I dont get "myserver" as host 
>>> for the
>>> services.
>>> - And in the WSDL, it affects the whole service URL, not just the
>>> host/server part:
>>> <wsdl:port binding="tns:ConfigDbServiceImplServiceSoapBinding"
>>> name="ConfigDbServiceImplPort">
>>> <soap:address location="myserver"/>
>>> </wsdl:port>
>>>
>>>  It should be: http://myserver/cxf/myservice I believe.
>>> - Even if it would work, I dont want to control this in the "code" (the
>>> spring config in the service bundle).
>>>
>>> In my understanding its still base-address that would solve my 
>>> problem, but
>>> I dont know how to make it affective and I havent found the 
>>> definition of it
>>> either.
>>>
>>>
>>>
>>>
>>> -- 
>>> View this message in context: 
>>> http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035493.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------
>> Freeman Fang
>>
>> FuseSource
>> Email:ffang@fusesource.com
>> Web: fusesource.com
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

Re: base-address for CXF

Posted by William Tam <em...@gmail.com>.
Hi Freeman,

I think I see an issue that can prevent publishedEndpointUrl property to 
be set on EndpointInfo object if the endpoint is created by a non-jaxws 
frontend.  (it is done when org.apache.cxf.jaxws.EndpointImp.doPublish() 
is  called)

In AbstractWSDLBasedEndpointFactory, the following snippet will set 
publishedEndpointUrl property which is inside createEndpointInfo()  method.

         if (publishedEndpointUrl != null && 
!"".equals(publishedEndpointUrl)) {
             ei.setProperty("publishedEndpointUrl", publishedEndpointUrl);
         }

However, the EndpointInfo object could be created by other factories 
(e.g. SoapTransportFactory) and so the 
AbstractWSDLBasedEndpointFactory.createEndpointInfo() method may not be 
called at all.  As a result, the publishedEndpointUrl may not be set.

I would suggest moving the snippet to the createEndpoint() need line 
159.  (see diff from trunk below). That way, the publishedEndpointUrl is 
set on EndpointInfo regardless how it was created.

Index: 
src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
===================================================================
--- 
src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java    
(revision 1229797)
+++ 
src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java    
(working copy)
@@ -157,6 +157,10 @@
              ei.setAddress(getAddress());
          }

+        if (publishedEndpointUrl != null && 
!"".equals(publishedEndpointUrl)) {
+            ei.setProperty("publishedEndpointUrl", publishedEndpointUrl);
+        }
+
          if (endpointReference != null) {
              ei.setAddress(endpointReference);
          }
@@ -294,10 +298,6 @@
          ei.setAddress(getAddress());
          ei.setBinding(bindingInfo);

-        if (publishedEndpointUrl != null && 
!"".equals(publishedEndpointUrl)) {
-            ei.setProperty("publishedEndpointUrl", publishedEndpointUrl);
-        }
-
          if (wsdlEndpointFactory != null) {
              wsdlEndpointFactory.createPortExtensors(ei, service);
          }

Thanks.

On 11/30/2011 07:59 PM, Freeman Fang wrote:
>
> On 2011-11-30, at 下午9:30, rickthemick wrote:
>
>> I cant see that it works like you describe it.
>>
>> Adding publishedEndpointUrl in my Spring conf:
>>
>> <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
>>    address="/myservice" >
>> <jaxws:properties>
>> <entry key="publishedEndpointUrl" value="myserver" />
>> </jaxws:properties>
>> </jaxws:endpoint>
> Hi,
>
> You need change the publishedEndpointUrl value to 
> http://myserver/cxf/myservice
> Also in the Service List Page, you can find the wsdl URL there is 
> http://myserver/cxf/myservice?wsdl.
> I just tested it with 2.4.4, it works for me.
>
> Freeman
>>
>> - Does not affect the service listing, I dont get "myserver" as host 
>> for the
>> services.
>> - And in the WSDL, it affects the whole service URL, not just the
>> host/server part:
>> <wsdl:port binding="tns:ConfigDbServiceImplServiceSoapBinding"
>> name="ConfigDbServiceImplPort">
>> <soap:address location="myserver"/>
>> </wsdl:port>
>>
>>  It should be: http://myserver/cxf/myservice I believe.
>> - Even if it would work, I dont want to control this in the "code" (the
>> spring config in the service bundle).
>>
>> In my understanding its still base-address that would solve my 
>> problem, but
>> I dont know how to make it affective and I havent found the 
>> definition of it
>> either.
>>
>>
>>
>>
>> -- 
>> View this message in context: 
>> http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035493.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>
> ---------------------------------------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
>
>
>
>
>
>
>
>
>
>

Re: base-address for CXF

Posted by rickthemick <sj...@gmail.com>.
Yes, sure, I guess it will work if I put the full URL there. But, I dont want
to configure this inside the application itself. I just want it to change
the host/server part of the address (base-address?)

Again, thats why config admin and "base-address" was so attractive... but
base-address seems not to be the way to go. 

BR
Rickard

--
View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5039547.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: base-address for CXF

Posted by Freeman Fang <fr...@gmail.com>.
On 2011-11-30, at 下午9:30, rickthemick wrote:

> I cant see that it works like you describe it.
>
> Adding publishedEndpointUrl in my Spring conf:
>
> <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
>    address="/myservice" >
>    <jaxws:properties>
>      <entry key="publishedEndpointUrl" value="myserver" />
>    </jaxws:properties>
> </jaxws:endpoint>
Hi,

You need change the publishedEndpointUrl value to http://myserver/cxf/myservice
Also in the Service List Page, you can find the wsdl URL there is http://myserver/cxf/myservice?wsdl 
.
I just tested it with 2.4.4, it works for me.

Freeman
>
> - Does not affect the service listing, I dont get "myserver" as host  
> for the
> services.
> - And in the WSDL, it affects the whole service URL, not just the
> host/server part:
>  <wsdl:port binding="tns:ConfigDbServiceImplServiceSoapBinding"
> name="ConfigDbServiceImplPort">
>    <soap:address location="myserver"/>
>  </wsdl:port>
>
>  It should be: http://myserver/cxf/myservice I believe.
> - Even if it would work, I dont want to control this in the  
> "code" (the
> spring config in the service bundle).
>
> In my understanding its still base-address that would solve my  
> problem, but
> I dont know how to make it affective and I havent found the  
> definition of it
> either.
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035493.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: base-address for CXF

Posted by rickthemick <sj...@gmail.com>.
Btw, I'm using CXF 2.4.2. 

--
View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035500.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: base-address for CXF

Posted by rickthemick <sj...@gmail.com>.
I cant see that it works like you describe it.

Adding publishedEndpointUrl in my Spring conf:

<jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
    address="/myservice" >
    <jaxws:properties>    
      <entry key="publishedEndpointUrl" value="myserver" />
    </jaxws:properties>
</jaxws:endpoint>

- Does not affect the service listing, I dont get "myserver" as host for the
services. 
- And in the WSDL, it affects the whole service URL, not just the
host/server part:
  <wsdl:port binding="tns:ConfigDbServiceImplServiceSoapBinding"
name="ConfigDbServiceImplPort">
    <soap:address location="myserver"/>
  </wsdl:port>

  It should be: http://myserver/cxf/myservice I believe.
- Even if it would work, I dont want to control this in the "code" (the
spring config in the service bundle).

In my understanding its still base-address that would solve my problem, but
I dont know how to make it affective and I havent found the definition of it
either.




--
View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035493.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: base-address for CXF

Posted by Freeman Fang <fr...@gmail.com>.
On 2011-11-30, at 下午8:41, rickthemick wrote:

> Hi!
>
> Actually not, the myserver DNS name is routed through a reverse  
> proxy I
> believe, this causes CXF to generate service URLs with the IP  
> address of the
> machine instead of the DNS name "myserver" that the client uses.
>
> For example., a client browser browse to "http://myserver/cxf" but the
> services he founds in the service listing there has address like:
> http://10.0.0.23:8080/cxf/myservice
>
> And because of the network setup he cant reach
> http://10.0.0.23:8080/cxf/myservice since that request is not ruoted  
> through
> the reverse proxy, and thus, it works if he uses
> http://myserver/cxf/myservice.
>
> This is the reason why I want to force the "base-address" used by  
> CXF when
> generating the service URLs. And I want to do it outside the service  
> code
> (that is, outside the spring configuration). Thats why the config  
> admin is
> very attractive to me to use to set "base-address". But I dont know  
> if its
> the correct way to do it.
>
> The publishedEndpointUrl affects the endpoint URL to the service  
> within the
> WSDL not the URL to the WSDL itself listed by CXF. The optimal  
> situtation
> would be if "base-address" affects both the service listing URLs and  
> the
> endpoint URLs within the WSDLs.
>

Hi,

Actually it's exactly what publishedEndpointUrl can offer you, the  
correct behavior is that it's not only affect the soap:address within  
the wsdl, but also affect the WSDL URL in SerivceList.

You may use some old version CXF which has some bugs with  
publishedEndpointUrl, after CXF 2.4.0 several bugs with  
publishedEndpointUrl get fixed, could you try with more recent version?

Also, the configuration in org.apache.cxf.osgi.cfg only affect the  
real address the service published,  change it can't help for your case.

Freeman

> BR
> /Rickard
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035389.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: base-address for CXF

Posted by rickthemick <sj...@gmail.com>.
Hi!

Actually not, the myserver DNS name is routed through a reverse proxy I
believe, this causes CXF to generate service URLs with the IP address of the
machine instead of the DNS name "myserver" that the client uses.

For example., a client browser browse to "http://myserver/cxf" but the
services he founds in the service listing there has address like:
http://10.0.0.23:8080/cxf/myservice

And because of the network setup he cant reach
http://10.0.0.23:8080/cxf/myservice since that request is not ruoted through
the reverse proxy, and thus, it works if he uses
http://myserver/cxf/myservice. 

This is the reason why I want to force the "base-address" used by CXF when
generating the service URLs. And I want to do it outside the service code
(that is, outside the spring configuration). Thats why the config admin is
very attractive to me to use to set "base-address". But I dont know if its
the correct way to do it.

The publishedEndpointUrl affects the endpoint URL to the service within the
WSDL not the URL to the WSDL itself listed by CXF. The optimal situtation
would be if "base-address" affects both the service listing URLs and the
endpoint URLs within the WSDLs.

BR
/Rickard

--
View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035389.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: base-address for CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

So myserver is the machine like a proxy which your client can access,  
and myserver will relay any request to the real machine  which you  
actually publish the webservice, right?  The flow is like
clients===>myserver==>the machine publish services
In this case you just need add a publishedEndpointUrl property for  
jaxws endpoint, the publishedEndpointUrl could be anything you want.
You needn't configure org.apache.cxf.osgi.cfg at all.

Freeman
On 2011-11-30, at 下午5:18, rickthemick wrote:

> Hi!
>
> What I want to do is to change the server part of the URLs to my  
> services
> listed under /cxf, that is:
> force a change of "your_host_address:8181" to "myserver".
> (CXF resolves the server base address ("your_host_address") but I'm  
> not
> happy with it since its just an IP address in my case, I want to  
> force it to
> a DNS-name which points to this server which the clients need to  
> use, they
> cant use the raw IP address because firewalls between the server and  
> the
> clients)
>
> As I understand it, the base-address property can do this!?
>
> And I can get Apache Felix config admin to list:
> PID = org.apache.cxf.osgi.cfg
>  BundleLocation = Unbound
>  base-address = myserver
>  org.apache.cxf.servlet.base-address = myserver
>  service.pid = org.apache.cxf.osgi.cfg
>
> But it doesnt have any affect on the services listed under /cxf. Do  
> you see
> my problem?
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035048.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: base-address for CXF

Posted by rickthemick <sj...@gmail.com>.
Hi!

What I want to do is to change the server part of the URLs to my services
listed under /cxf, that is:
force a change of "your_host_address:8181" to "myserver".
(CXF resolves the server base address ("your_host_address") but I'm not
happy with it since its just an IP address in my case, I want to force it to
a DNS-name which points to this server which the clients need to use, they
cant use the raw IP address because firewalls between the server and the
clients)

As I understand it, the base-address property can do this!?

And I can get Apache Felix config admin to list:
PID = org.apache.cxf.osgi.cfg
  BundleLocation = Unbound
  base-address = myserver
  org.apache.cxf.servlet.base-address = myserver
  service.pid = org.apache.cxf.osgi.cfg 

But it doesnt have any affect on the services listed under /cxf. Do you see
my problem?


--
View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5035048.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: base-address for CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I'm not sure what you exactly mean here, could you elaborate?

Per your server configuration, the webservice address is
http://your_host_address:8181/cxf/myservice

The 8181 is default osgi http service listening port, you can change it.
Also you can change the cxf part in the address, it's  called  
org.apache.cxf.servlet.context, so you can
add/edit org.apache.cxf.osgi.cfg in etc folder
add
org.apache.cxf.servlet.context=/myserver
so the address could be
http://your_host_address:8181/myserver/myservice

You can also edit this property from console or webconsole, they  
actually use same mechanism, they leverage OSGi configAdmin service  
underlying.

Freeman

On 2011-11-30, at 下午4:33, rickthemick wrote:

> Hi!
>
> Because of our network setup (I guess), CXF is generating a correct  
> (based
> on the server IP) but not desired URL for our services when listing  
> them at
> http://server/cxf.
>
> For this reason I want to force the base address for our services.  
> We are
> running CXF on a OSGi runtime and uses Spring to configure the  
> services,
> like this:
>
>
>  <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import resource="classpath:META-INF/cxf/osgi/cxf-extension- 
> osgi.xml" />
>
>
>  <jaxws:endpoint id="MyServiceEndpoint" implementor="#myService"
>    address="/myservice" />
>
> I have found fragments of information about a config property called
> "base-address" but I fail to apply it to our services. I cant find any
> information about it on the cxf.apache.org pages.
>
> Can somebody please direct me how to use this property? Or is there  
> some
> other way to do this?
>
> What I have done so far is to have the property set in the OSGi  
> config admin
> services (by following the example for changing the alias "/cxf" here
> http://fusesource.com/issues/browse/ESB-813), from Apache Felix web  
> console:
> PID = org.apache.cxf.osgi.cfg
>  BundleLocation = Unbound
>  base-address = myserver
>  org.apache.cxf.servlet.base-address = myserver
>  service.pid = org.apache.cxf.osgi.cfg
>
> ... but this doesnt seem to help me!
>
> Hope for you help, thanks Rickard!
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/base-address-for-CXF-tp5034937p5034937.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com