Forum Discussion

bobbaluba's avatar
14 years ago

Mock Service: Cross-domain from JavaScript

I'm trying to use my Mock Service from JavaScript, however, in order for the browser to allow me to send cross-domain requests, i have to receive one http-message containing these three headers:
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 3628800
Access-Control-Allow-Methods: POST

I know how to change the headers in the Mock Responses, but in order to get a mock response, you have to be able to send a valid requests, which is not possible before you've received the three headers above. So you see it's kind of a chicken and the egg problem.

I'm able to just send GET requests or empty POST requests or OPTIONS request, but then the mock service just returns an error.

Is it possible to change the headers on the errors? That way i could first send an invalid request, then receive the needed security info, and then send a valid request.
  • samuel_perez's avatar
    samuel_perez
    Occasional Contributor

    was this ever solved?  i have a similar issue my client is telling me that they are not abel to send the 2nd request even thought i have modified the mock response to contain the proper header...

    • GrahamH's avatar
      GrahamH
      New Contributor

      > Is it possible to change the headers on the errors?

       

      Sorry, I'm a SoapUI newbie; I don't know the answer to this specific question.

       

      However, for what it's worth, here's how I currently deal with CORS issues and SOAP/SoapUI: