Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Allow CORS for JAX-WS

 
Dooo Deee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

is there a way to allow CORS for JAX-WS?


best regards,
Donar
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by that? Where does cross-origin come into play with a WS call?
 
Dooo Deee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have to make a SOAP request from a html file which is on another domain. Since i send a xml request to the WSDL cross-origin comes into play.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WSDL? Certainly the web page doesn't access the WSDL but the actual service URL?

I don't think JAX-WS explicitly supports CORS. You'd need to read, write and react to the respective HTTP headers in your own code. I've found https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS to be a good tutorial when I implemented CORS at some point. http://www.w3.org/TR/2012/WD-cors-20120403/ also helps.

I should add that back then I found browser support for CORS to be insufficient, and put in place a REST WS instead that used JSONP to sidestep the whole issue..
 
Dooo Deee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know of another way to make that kind of Request without using CORS?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using SOAP from within the browser is kind of odd. I'd go with the REST-returning-JSONP approach I mentioned, assuming the other server is under your control.

If it needs to be SOAP, maybe your server can host a proxy servlet that takes a REST request from the browser, then makes the SOAP call to the other server, and finally returns the result to the browser?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!