Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2020-06-01 01:45 PM
SOAP API in javascript doesn't seem to work and what exactly am I doing wrong.
<script type="text/javascript">
function pageLoad() {
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
else {
//alert(this.status);
//alert(this.responseText);
}
};
request.open('POST', 'https://site.com/ws/search.asmx', true);
request.setRequestHeader('SOAPAction', 'http://archer-tech.com/webservices/ExecuteSearch');
request.setRequestHeader('Content-type', 'text/xml');
request.setRequestHeader('Authorization', 'Archer session-id="' + sessionToken + '"');
//request.setRequestHeader('X-Http-Method-Override', 'GET');
var searchString = '<SearchReport> ' +
'<PageSize>100</PageSize> ' +
'<DisplayFields> ' +
'<DisplayField>3906</DisplayField> ' +
'<DisplayField>3907</DisplayField> ' +
'</DisplayFields> ' +
'<Criteria> ' +
'<ModuleCriteria> ' +
'<Module>84</Module> ' +
'<IsKeywordModule>false</IsKeywordModule> ' +
'</ModuleCriteria> ' +
'<Filter> ' +
'<Conditions> ' +
'<TextFilterCondition> ' +
'<Operator>Contains</Operator> ' +
'<Field>3896</Field> ' +
'<Value>12345678</Value> ' +
'</Filter> ' +
'</Criteria> ' +
'</SearchReport>';
var xml='<?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> ' +
'<ExecuteSearch xmlns="http://archer-tech.com/webservices/"> ' +
'<sessionToken>' + sessionToken + '</sessionToken> ' +
'<searchOptions>' + searchString + '</searchOptions> ' +
'<pageNumber>1</pageNumber> ' +
'</ExecuteSearch> ' +
'</soap:Body> ' +
'</soap:Envelope>';
request.send(xml);
}
</script>
Tried using Res API, but search option isn't enabled. When I fetch using content id it works like a charm.
I get 400 bad request.......something to do with searchstring or xml.
2020-06-01 01:59 PM
Try enclosing the searchString in CDATA...check out 000012781 - When calling RSA Archer Web Service API method using SOAP the following occurs: The remote server returned an error: (400) Bad Request.
Also, check out these links.
2020-06-01 01:59 PM
Try enclosing the searchString in CDATA...check out 000012781 - When calling RSA Archer Web Service API method using SOAP the following occurs: The remote server returned an error: (400) Bad Request.
Also, check out these links.
2020-06-07 01:45 PM
Hi Jeff,
After using CDATA it worked like a charm. Thank you
2022-06-01 03:03 PM
Hello Prem, Can you please put the code with cdata? Thank you/.
2022-06-01 03:10 PM
Hello @JeffLetterman ,
Can you please share an example of Archer SOAP API call in Javascript? Also, can we use the same in Archer Javascript Transporter Datafeed to call a report, like we do in A2A datafeed? Just wanted to check this as an alternative to A2A