Berty
Berty

Reputation: 1178

allow cross origin from javascript to a soap webservice on glassfish

I'm trying to use a SOAP-webservice from javascript. Both the server and client are in the same LAN and i control both.

when i try to send a request i get:

XMLHttpRequest cannot load . 
Origin  is not allowed by Access-Control-Allow-Origin.

this is probably because of cross-origin-scripting? I would like to fix this on the server side. that means: adding extra headers on outgoing messages: Access-Control-Allow-Origin: *

how can I add these response headers? I'm using Netbeans to manage the web service in Glassfish

Upvotes: 0

Views: 627

Answers (1)

Erlend
Erlend

Reputation: 4416

There is a hint in the error message. The server running on a different host needs to return the Access-contol-allow-origin header and possibly also Access-control-include-credential. Note that this only works in newer browsers, so if there are older browsers in your network, you may need to lookk at something like proxying or using eadyXDM.

Btw, use "cross origin" instead of cross site scripting". Cross site scripting is a vulnerability, and using this term makes the question a bit confusing.

Upvotes: 1

Related Questions