I am working on a project to send an SOAP request using XmlHttpRequest in JavaScript.
I want to create custom headers in my request like this:
POST https://www.toto.com/soap HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Password: "toto1"
Content-Length: 621
Host: www.toto.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Now, I am using the method : xmlHttp.setRequestHeader("PASSWORD", "toto1"); And the result is this one (The POST request is also modified to OPTIONS):
Request Method:OPTIONS
Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.8,fr;q=0.6,en-GB;q=0.4,es;q=0.2,en-NZ;q=0.2
Access-Control-Request-Headers: password
Access-Control-Request-Method:POST
Content-Length: 621
Host: www.toto.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
My question is: how to have the custom header as Password: "toto1" and not as: Access-Control-Request-Headers: password
And how can I keep the POST method which is replace with a OPTIONS method ?
Thanks