You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jimpo <ja...@gofore.com> on 2008/06/24 10:10:04 UTC

cxf behind load balancer, services point to localhost:8080 instead of server:80

We're using JAXWS endpoints that are configured like:

    <jaxws:endpoint
        id="someservice"
        address="/someservice"
        implementor="#someserviceProvider" />

CXF servlet is mapped to /ws/*

  <servlet-mapping>
      <servlet-name>CXFServlet</servlet-name>
      <url-pattern>/ws/*</url-pattern>
  </servlet-mapping>


In dev environment this works nicely, http://devserver/app/ws/ lists the
different ports nicely and the links take to the wsdl which has the correct
soap:address inside wsdl:port.

In prod we have Apache load balancer at http://prod/app/ws/ which moves the
requests to the actual prod servers at http://prod1:8080/app/ws and
http://prod2:8080/app/ws.

When I go to http://prod/app/ws the links point to
http://localhost:8080/app/ws/someservice?wsdl and naturally do not work. If
I manually go to http://prod/app/ws/someservice?wsdl I get the wsdl, but the
soap:address has the localhost -address.

I tried to configure CXF to use a given address for my end point as in:

    <jaxws:endpoint
        id="someservice"
        address="http://server/app/ws/someservice"
        implementor="#someserviceProvider" />

I can't get this working even at my local env (no load balancers or
anything, just trying to make it work on localhost). The end point listing
at http://server/app/ws/ looks fine but the link
http://server/app/ws/someservice?wsdl just results in "No service was
found."

When I try to deploy service like this (using a static, non-relative
address) the log looks like it would go ok:

24.6.2008 10:43:44
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://www.some.com/some/schemas}SomeService from
WSDL: wsdl/someservice.wsdl
24.6.2008 10:43:44 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be
http://localhost:8080/app/ws/service3

But when I go to http://localhost:8080/app/ws/service3?wsdl

24.6.2008 11:08:04 org.apache.cxf.transport.servlet.ServletController invoke
WARNING: Can't find the the request for
http://localhost:8080/app/ws/service3's Observer
-- 
View this message in context: http://www.nabble.com/cxf-behind-load-balancer%2C-services-point-to-localhost%3A8080-instead-of-server%3A80-tp18086037p18086037.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf behind load balancer, services point to localhost:8080 instead of server:80

Posted by jimpo <ja...@gofore.com>.
Thanks...this did not help me though. 

Also SOAP client settings do not help me since the problem is solely on the
server side. I am trying to create a service with a proper WSDL and so far
that is failing. My clients are external and I have no control over them.

I will create a new thread with a better subject and try to explain the
problem more clearly there.


-- 
View this message in context: http://www.nabble.com/cxf-behind-load-balancer%2C-services-point-to-localhost%3A8080-instead-of-server%3A80-tp18086037p18195392.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf behind load balancer, services point to localhost:8080 instead of server:80

Posted by Glen Mazza <gl...@gmail.com>.
Step 7, 8, and Note #4 at the bottom of
http://www.jroller.com/gmazza/date/20080417#WFstep7 are all I know of URLs
with web services.  Question:  Would changing the URL (via
ENDPOINT_ADDRESS_PROPERTY) being used by the SOAP client help you
(http://www.jroller.com/gmazza/date/20070817, Step #7)?

Glen


jimpo wrote:
> 
> * bump* this up, help desperately needed....
> 
> If my server runs at localhost:8080, war is in localhost:8080/webapp, and
> cxf servlet is mapped to localhost:8080/webapp/ws/, should I be able to
> use JAXWS endpoint definition with absolute url like:
> 
>     <jaxws:endpoint
>         id="someservice"
>         address="localhost:8080/webapp/ws/someservice"
>         implementor="#someserviceProvider" />
> 
> ? When I try this, and access localhost:8080/webapp/ws/someservice?wsdl I
> just get 
> 
> "No service was found."
> 
> and log: 
> 
> 24.6.2008 11:08:04 org.apache.cxf.transport.servlet.ServletController
> invoke
> WARNING: Can't find the the request for
> localhost:8080/webapp/ws/someservice's Observer
> 
> 

-- 
View this message in context: http://www.nabble.com/cxf-behind-load-balancer%2C-services-point-to-localhost%3A8080-instead-of-server%3A80-tp18086037p18159588.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf behind load balancer, services point to localhost:8080 instead of server:80

Posted by jimpo <ja...@gofore.com>.
* bump* this up, help desperately needed....

If my server runs at localhost:8080, war is in localhost:8080/webapp, and
cxf servlet is mapped to localhost:8080/webapp/ws/, should I be able to use
JAXWS endpoint definition with absolute url like:

    <jaxws:endpoint
        id="someservice"
        address="localhost:8080/webapp/ws/someservice"
        implementor="#someserviceProvider" />

? When I try this, and access localhost:8080/webapp/ws/someservice?wsdl I
just get 

"No service was found."

and log: 

24.6.2008 11:08:04 org.apache.cxf.transport.servlet.ServletController invoke
WARNING: Can't find the the request for
localhost:8080/webapp/ws/someservice's Observer

-- 
View this message in context: http://www.nabble.com/cxf-behind-load-balancer%2C-services-point-to-localhost%3A8080-instead-of-server%3A80-tp18086037p18130621.html
Sent from the cxf-user mailing list archive at Nabble.com.


mapping from complex response objects to custom value objects - is it worth it? what is the clearest/easiest/most maintainable way to do it?

Posted by Gary Weaver <ga...@duke.edu>.
Hello,

Though this isn't really a CXF question, I thought it might be good to 
ask here to see people's thoughts...

In short, my question is "What is the easiest and most maintainable way 
(and able to handle a small but not unsignificant load) of mapping 
cxf-codegen-plugin v2.1 + JAXB generated client request and response 
value objects (or even the SOAP response itself) to custom-written value 
objects? (or is it even worth it?)"

Background:

Have been using Apache CXF cxf-codegen-plugin v2.1 in a project to 
generate client code (using the default JAXB data binding) and currently 
I have an overly complex and ugly response coming back from one service 
that I've integrated with.

Several years ago, I had thought to myself that I would never write 
another unnecessary layer of value objects on top of client value 
objects autogenerated by a tool like wsdl2java. The reason being that 
you have to typically would have to change things in more places when 
the service interface changed, despite initial efforts to the contrary 
to "buffer" from service interface changes.

However, I'm currently integrating with a few services that 
nasty-enough-looking and overly-complicated-enough that I really 
couldn't help but to write my own value objects to map to the 
cxf-codegen-plugin v2.1 + JAXB generated value objects.

For the first few services, they were fairly simple (comparatively) so I 
just mapped these manually in the code (several gets here, several sets 
there, and presto). However, the current service I'm working on has a 
real bear of a response. If the service interface changes, it is going 
to be a good deal of work to redo the additional layer of value objects 
in addition to the autogenerated ones.

I looked briefly into using Dozer, but the response classes (because of 
the way the service is defined) are so ugly and hard to read that unless 
IDea supports auto-completion in the dozer mapping file (like it does 
for Spring configs), I don't think I want to go there.

I've also thought about spending more time looking into how I could 
configure CXF (or whichever data binding- JAXB, Aegis, MTOM, even though 
I'm using JAXB at the moment) to possibly unmarshal the response to my 
custom classes, in an attempt to clarify the request/response value 
objects by ignoring the fluff and simplifying structure. However, I 
don't know if this is the best use of time, and the resulting code would 
likely be even less clear, would it not?

Thanks in advance for any advice you can provide,

Gary

Re: cxf behind load balancer, services point to localhost:8080 instead of server:80

Posted by Daniel Kulp <dk...@apache.org>.
With the latest versions, the jaxws:endpoint element has a  
publishedEndpointUrl attribute that can be used to specify the actual  
public URL that it's exposed on.   That should solve the problem.

Dan



On Jun 24, 2008, at 4:10 AM, jimpo wrote:

>
> We're using JAXWS endpoints that are configured like:
>
>    <jaxws:endpoint
>        id="someservice"
>        address="/someservice"
>        implementor="#someserviceProvider" />
>
> CXF servlet is mapped to /ws/*
>
>  <servlet-mapping>
>      <servlet-name>CXFServlet</servlet-name>
>      <url-pattern>/ws/*</url-pattern>
>  </servlet-mapping>
>
>
> In dev environment this works nicely, http://devserver/app/ws/ lists  
> the
> different ports nicely and the links take to the wsdl which has the  
> correct
> soap:address inside wsdl:port.
>
> In prod we have Apache load balancer at http://prod/app/ws/ which  
> moves the
> requests to the actual prod servers at http://prod1:8080/app/ws and
> http://prod2:8080/app/ws.
>
> When I go to http://prod/app/ws the links point to
> http://localhost:8080/app/ws/someservice?wsdl and naturally do not  
> work. If
> I manually go to http://prod/app/ws/someservice?wsdl I get the wsdl,  
> but the
> soap:address has the localhost -address.
>
> I tried to configure CXF to use a given address for my end point as  
> in:
>
>    <jaxws:endpoint
>        id="someservice"
>        address="http://server/app/ws/someservice"
>        implementor="#someserviceProvider" />
>
> I can't get this working even at my local env (no load balancers or
> anything, just trying to make it work on localhost). The end point  
> listing
> at http://server/app/ws/ looks fine but the link
> http://server/app/ws/someservice?wsdl just results in "No service was
> found."
>
> When I try to deploy service like this (using a static, non-relative
> address) the log looks like it would go ok:
>
> 24.6.2008 10:43:44
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromWSDL
> INFO: Creating Service {http://www.some.com/some/schemas}SomeService  
> from
> WSDL: wsdl/someservice.wsdl
> 24.6.2008 10:43:44 org.apache.cxf.endpoint.ServerImpl initDestination
> INFO: Setting the server's publish address to be
> http://localhost:8080/app/ws/service3
>
> But when I go to http://localhost:8080/app/ws/service3?wsdl
>
> 24.6.2008 11:08:04  
> org.apache.cxf.transport.servlet.ServletController invoke
> WARNING: Can't find the the request for
> http://localhost:8080/app/ws/service3's Observer
> -- 
> View this message in context: http://www.nabble.com/cxf-behind-load-balancer%2C-services-point-to-localhost%3A8080-instead-of-server%3A80-tp18086037p18086037.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog