KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So, I can successfully make a GET call to my service using CORS. However, something must be going wrong at the preflight level for the POST, PUT, and DELETE operations. However, from what I can tell, the header responses my server is returning in response to the OPTIONS query are correct and match those described in Here is my javascript code, using $.ajax in JQuery 1.6.4. $.ajax({ url: 'http://myhome:8080/TaskApproval/resources/tasks/2', context: this, data: '<?xml version="1.0" encoding="UTF-8"?> <task> <description>Get carrots from the grocery store</description><originator>Chris</originator><subject>Get Carrots !!</subject><taskId>2</taskId> </task> ', timeout: 30000, type: 'PUT', contentType: 'application/xml', success: function(response) { alert(response); result = response; }, error: function(xhr) { alert('Error! Status = ' + xhr.status + " Message = " + xhr.statusText); } }); Now, this is what my HTTP Trail looks like, courtesy of Firebug. Request: OPTIONS /TaskApproval/resources/tasks/2 HTTP/1.1 Host: widgethome:8080 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive Origin: http://localhost:8080 Access-Control-Request-Method: PUT Access-Control-Request-Headers: content-type Response: HTTP/1.1 200 OK X-Powered-By: Servlet/3.0 Server: GlassFish v3 Allow: OPTIONS,GET,DELETE,HEAD,PUT, POST Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE Access-Control-Max-Age: 1000 Access-Control-Allow-Headers: * Content-Type: application/xml Content-Length: 2792 Date: Wed, 28 Sep 2011 18:21:11 GMT <
Tags (comma-separated)
Save Edits
Cancel