How to overcome Same-Origin Policy and consume a SOAP webservice with Javascript

Asked

Viewed 111 times

3

I’m building a mobile app using Phonegap for iOS, Android and Windows Phone and need to connect to a SOAP webservice for various app features.

I have tried to do it using Ajax, but I always have the same problem: hit the Same-Origin Policy.

How can I overcome this problem? There is something I should put on my side or the server side (Java)?

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

Thank you for your attention!

  • 1

    Have you tried it enable CORS? P.S. I guess I was wrong, CORS doesn’t seem to apply to Phonegap. But the answer to the linked question gives more information on how to access external domains on this platform.

  • I enabled the CORS on the Phonegap side, but I didn’t understand how to do it on the browser side. Is that what I’m missing? And yes, how do you do it? I could not understand by the answer or the links of that question.

1 answer

1


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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.