BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Follow BOB on Twitter! 
Follow BOB on Twitter! (Opens a new window)  

General Notice: BOB is going to retire...please see details here.
General Notice: No events within the next 45 days.

RESTful services and javascript help


 
Search this topic... | Search SDK (VBA/ASP/JSP)... | Search Box
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Author Message
kevlray
Forum Associate
Forum Associate



Joined: 23 Jun 2010

Posts: 977
Location: California


flag
PostPosted: Mon Jun 17, 2019 12:07 pm 
Post subject: RESTful services and javascript help

So I am kinda of a newbie on this, so bear with me. I have have found some javascript code that I can use for login credentials to logon to our BI application (BI 4.2 SP 7). But even though the code appears to work. I have not been able to figure out how to extract the logon token so that I can use it with OpenDocument.

The strange part is the header for the response appears to be blank (the response is there). I do see a session in the CMC. Below is the code I am using. Any insight on this would be appreciated.

var invocation = new XMLHttpRequest();
var url = 'http://host:8080/biprws/logon/long';


var body = "<?xml version=\"1.0\"?><attrs xmlns=\"http://www.sap.com/rws/bip\"><attr name=\"password\" type=\"string\">password</attr><attr name=\"clientType\" type=\"string\"></attr><attr name=\"auth\" type=\"string\" possibilities=\"secEnterprise,secLDAP,secWinAD,secSAPR3\">secEnterprise</attr><attr name=\"userName\" type=\"string\">username</attr></attrs>";
var xmlDoc = null;

var response;

var logonToken;

invocation.open("POST",url);
invocation.setRequestHeader("X-PINGARUNER", "pingpong");
invocation.setRequestHeader("Content-Type", "application/xml");
invocation.setRequestHeader("Accept", "application/xml");

invocation.send(body);

invocation.onreadystatechange = function() {
if (invocation.readyState == 4 && invocation.status == 200) {
console.log("Response Text " + invocation.response);
console.log("Status " + invocation.status);
}
}
Back to top
kevlray
Forum Associate
Forum Associate



Joined: 23 Jun 2010

Posts: 977
Location: California


flag
PostPosted: Mon Jun 17, 2019 1:12 pm 
Post subject: Re: RESTful services and javascript help

Never mind. My code to check to see if the header had been received was logically incorrect. Fixed now. I was 'defining' the same function twice, the second definition was overwriting the first one. Rookie mistake.
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0350 seconds using 18 queries. (SQL 0.0112 Parse 0.0008 Other 0.0230)
CCBot/2.0 (https://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo