• Post Reply Bookmark Topic Watch Topic
  • New Topic

CXF Web Service Proxy  RSS feed

 
Alaeddine Saadaoui
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a newbie to java servlet filters and I have a CXF web service A.
The address of A is: http://localhost:8080/AdditionWS/services/additioncls?wsdl
I want to implement a proxy web service B.
The address of B is: http://localhost:8080/ForwardWS/services/ForwardClsPort?wsdl
To forward the requests to A through B, I added a servlet filter to B:

I am a newbie to java servlet filters and I have a CXF web service A.

The address of A is: http://localhost:8080/AdditionWS/services/additioncls?wsdl

I want to implement a proxy web service B.

The address of B is: http://localhost:8080/ForwardWS/services/ForwardClsPort?wsdl

To forward the requests to A through B, I added a servlet filter to B:

and I updated the web address at the client code like the following:

For some reason, the client requests are not forwarded to A and I got the following errors:


I am a newbie to java servlet filters and I have a CXF web service A.

The address of A is: http://localhost:8080/AdditionWS/services/additioncls?wsdl

I want to implement a proxy web service B.

The address of B is: http://localhost:8080/ForwardWS/services/ForwardClsPort?wsdl

To forward the requests to A through B, I added a servlet filter to B:

and I updated the web address at the client code like the following:

For some reason, the client requests are not forwarded to A and I got the following errors:

Did I miss something or is there a different way to implement a proxy cxf web service that will forward client requests to A or one of its duplicates? Thank you!
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Could you please use code tags in the future? I've added them for you this time.

Alaeddine Saadaoui wrote:

It looks as if your WSDL cannot be read; the error message says there is an unexpected EOF (end-of-file) basically at the start of your WSDL. Are you sure the URL is correct? Can you open it in your browser?

It could also be the case that the deployment order is not what you need. If the ForwardWS application (WAR?) is deployed after the AdditionWS application, the latter will not be able to find the WSDL because it is simply not available yet.
 
Alaeddine Saadaoui
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Welcome to the Ranch!

Could you please use code tags in the future? I've added them for you this time.

Alaeddine Saadaoui wrote:

It looks as if your WSDL cannot be read; the error message says there is an unexpected EOF (end-of-file) basically at the start of your WSDL. Are you sure the URL is correct? Can you open it in your browser?

It could also be the case that the deployment order is not what you need. If the ForwardWS application (WAR?) is deployed after the AdditionWS application, the latter will not be able to find the WSDL because it is simply not available yet.

Thank you so much for your reply. This is the first time I post a question on this forum and I will for sure use code tags in the future. Actually, I have a web service A with dynamic endpoint urls. So I am trying to implement a proxy web service B to redirect the requests to A or one of its duplicates. When I open the URL of B on the browser, the request is redirected to A and the wsdl of A is displayed on the browser. However, B doesn't redirect the client's requests sent to A. Is there a way to programmatically achieve that?
Thank you again.
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's a simple proxy you want, with just forwarding the request to another server, you could just use an existing proxy servlet. At work we use Jetty's proxy servlet. You can configure this quite a bit, and also override it where necessary to override some of the pre-existing behavior. Just one warning: it uses asynchronous request handling, so all filters that you place in front of this servlet must have <async-supported>true</async-supported> in your web.xml file.
 
Alaeddine Saadaoui
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:If it's a simple proxy you want, with just forwarding the request to another server, you could just use an existing proxy servlet. At work we use Jetty's proxy servlet. You can configure this quite a bit, and also override it where necessary to override some of the pre-existing behavior. Just one warning: it uses asynchronous request handling, so all filters that you place in front of this servlet must have <async-supported>true</async-supported> in your web.xml file.

I will give it a try.
Thank you so much!
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!