Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP call from programmatically (JS) --- Status = 0

matthancock
Contributor III

Attempting to get a session token, but I am not getting any data back. I am using below xml call in a JavaScript node.js setup.

When I run in POSTMAN I get the token as expected.

I am getting a status 0 in the script.

 

<?xml version="1.0" encoding="utf-8"?>
  <soap:Body>
    <CreateUserSessionFromInstance xmlns="http://archer-tech.com/webservices/">
      <userName>username</userName>
      <instanceName>50000</instanceName>
      <password>password</password>
    </CreateUserSessionFromInstance>
  </soap:Body>
</soap:Envelope>
12 REPLIES 12

This is what I used in the past.  The only difference is for the POST it's on the open and not setting a request header.

var xmlObj = getXMLHttpRequest();
xmlObj.open ( "POST", "/ws/general.asmx", false) 
xmlObj.setRequestHeader("Content-Type", "text/xml");
xmlObj.setRequestHeader("SOAPAction", "http://archer-tech.com/webservices/CreateUserSessionFromInstance");
xmlObj.send("<?xml version='1.0' encoding='utf-8'?> \
     <soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
          <soap:Body> \
               <CreateUserSessionFromInstance xmlns='http://archer-tech.com/webservices/'> \
                    <userName>**USERNAME**</userName> \
                    <instanceName>**INSTANCE**/instanceName> \
                    <password>**PASSWORD**</password> \
               </CreateUserSessionFromInstance> \
          </soap:Body> \
     </soap:Envelope> \
");
xmlObj.close;

   

 Advisory Consultant

I get the same result status = 0.

The only difference I see is that I require 'xhr2' for the XMLHttpRequest

and the open is set to true vs false - if set to false like yours I get an error.

xmlhttp.open ( "POST", "/ws/general.asmx", true);

Anonymous
Not applicable

Out of curiosity, I copied David's code and executed. it run fine and returned 200 with session token response.

1 comment I can make, maybe your /ws node is located under /RSAarcher? So your full URL would be https://cms-uatw2019.bankofamerica.com/RSAarcher/ws/general.asmx

However, if the same exact URL is working for you in POSTMAN, then it should not be the case. Nevertheless, David's code is certainly working.