Creating a SOAP client

var sr ='<?xml version="1.0" encoding="utf-8"?>'+
            '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rxm="domain.com">'+
             '<soapenv:Header/>'+
			  '<soap:Body>'+
                 ........
			  '</soap:Body>'+
			'</soap:Envelope>';

or

var sr ='<?xml version="1.0" encoding="utf-8"?>'+
            '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://rxmpws.com/">'+
             '<soap:Header>'+
			    '<Authentication xmlns="http://domain.com/">'+
			      '<Password>password</Password>'+
			      '+<UserName>username</UserName>'+
			    '</Authentication>'+
			  '</soap:Header>'+
                        '<soapenv:Body>'+
                           ........
                        '</soapenv:Body>'+
			'</soapenv:Envelope>';

and my request code:

var xmlhttp = new XMLHttpRequest();
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4) {
                    if (xmlhttp.status == 200) {
                        //alert('done. use firebug/console to see network response');
                        alert(xmlhttp.response);
                    }
                }
            }
            xmlhttp.open('POST', 'http://domain.com', true);

            xmlhttp.setRequestHeader("Access-Control-Allow-Origin", "*");
            xmlhttp.setRequestHeader("Access-Control-Allow-Credentials", "true");
            xmlhttp.setRequestHeader("Access-Control-Allow-Headers", "...All Headers...");
            xmlhttp.setRequestHeader('Content-Type', 'text/xml charset=UTF-8');
            xmlhttp.setRequestHeader('Authorization', 'Basic ' + btoa('username:password'));
            xmlhttp.setRequestHeader("SOAPAction", "http://action.com");
            xmlhttp.responseType = "document";
			xmlhttp.send(sr);

my request:

OPTIONS http://domain.com/wsdl  HTTP/1.1
Host: www.domain.com
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://localhost:8100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.46
Access-Control-Request-Headers: access-control-allow-credentials,access-control-allow-headers,access-control-allow-origin,authorization,content-type,soapaction
Accept: */*
DNT: 1
Referer: http://localhost:8100/
Accept-Encoding: gzip, deflate
Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4

response:

HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/8.5
WWW-Authenticate: Basic realm="www.domain.com"
X-Powered-By: ASP.NET
Date: Wed, 19 Jul 2017 06:43:09 GMT
Content-Length: 1291
Via: 1.1 google
Set-Cookie: GCLB=CL3-hIuTjsSiJw; path=/; HttpOnly

<html> ... </html>

if i send request for Soap UI,it is sending 2 request (i dont know)
1st request:

POST http://domain.com/wsdl HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://action.com"
Content-Length: 547
Host: 130.211.17.101
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_112)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rxm="http:domain.com">
   <soapenv:Header/>
   <soapenv:Body>
      .........
   </soapenv:Body>
</soapenv:Envelope>

and 1st response(it is the same of my response)(failure):

HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/8.5
WWW-Authenticate: Basic realm="ip address of domain.com"
X-Powered-By: ASP.NET
Date: Wed, 19 Jul 2017 06:52:35 GMT
Content-Length: 1293
Via: 1.1 google
Set-Cookie: GCLB=CKS7g9PK-_eqEA; path=/; HttpOnly

<html>...</html>

2nd request:

POST htt://domain/wsdl HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://action.com"
Content-Length: 547
Host: 130.211.17.101
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_112)
Authorization: Basic ...string of btoa(username:password)..

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rxm="http:/domain.com/">
   <soapenv:Header/>
   <soapenv:Body>
    ............
   </soapenv:Body>
</soapenv:Envelope>

2nd response(success)

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 14564
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 19 Jul 2017 06:52:35 GMT
Via: 1.1 google
Set-Cookie: GCLB=CPaTjbS8mcTbCg; path=/; HttpOnly

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body> ... </s:Body></s:Envelope>

I don’t unterstand why it does not work for wsdl with authentication, it woks asmx without authentication but it does not work wsdl with authentication .
Thanks