How to bypass the Same-Origin Policy and consume a SOAP webservice with JavaScript


I'm building a mobile app using PhoneGap for iOS, Android and Windows Phone and I need to connect to a SOAP webservice for various features of the app.

I've been trying to do it using Ajax, but I always have the same problem: it hits the Same-Origin Policy.

How can I overcome this problem? Is there something I should put on my side or server side (Java)?

Switching to REST is not an option here. It really has to be SOAP and the call really has to be in JavaScript because of PhoneGap.

Thank you for your attention now!


I managed to solve the problem. To achieve this we had to make a change to the webservice project, allowing CORS on JBoss. You can read about the change we made here .

Scroll to Top