cancel
Showing results for 
Search instead for 
Did you mean: 

Convert .Net logon token to REST logon token?

first_last
Participant
0 Kudos

Is there a way to convert (or generate) a logon token that was generated using the BI Platform .Net SDK to a format that I can be used by the BI Platform RESTful SDK?

Accepted Solutions (1)

Accepted Solutions (1)

daniel_paulsen
Active Contributor

Hi Craig,

Yes, you can do this. You create a REST token by logging in to REST web services with the SDK token.

One thing to be aware of is that as soon as the SDK token is invalidated (logged off, timed out etc) the REST token is invalidated as well.

https://help.sap.com/viewer/db6a17c0d1214fd6971de66ea0122378/4.2.5/en-US/45f5abf06e041014910aba7db0e...

Dan

first_last
Participant
0 Kudos

Thanks for the reply. I don't appear to have access to that page.

** edit 0 **

Looks like I need to POST to `http://localhost:6405/biprws/logon/token` with an XML body of:

<attrs xmlns="http://www.sap.com/rws/bip">
  <attr name="tokenType" type="string" possibilities="token,serializedSession">token</attr>
  <attr name="logonToken" type="string" null="true">[.Net logon token]</attr>
</attrs>

What is a serializedSession?

** edit 1 **

This PowerShell code returns an `Enter a valid input (RWS 000079)` exception:

$token = 'server.domain.tld:6400@...' # .net sdk token
$server=($token-split':')[0] # grab 'server.domain.tld' from token
$url="http://$server`:6405/biprws/logon/long"

$headers= @{}
$headers.Add("Content-Type","application/xml") # sending 
$headers.Add("Accept","application/xml") # receiving

$payload=`
@"
<attrs xmlns="http://www.sap.com/rws/bip">
<attr name="tokenType" type="string" possibilities="token,serializedSession">token</attr>
<attr name="logonToken" type="string">$token</attr>
</attrs>
"@

Invoke-WebRequest-Uri $url-Method Post -Headers $headers-Body $payload 

Thoughts?

daniel_paulsen
Active Contributor

Hopefully you were able to access the documentation. I did have to edit the link since the first one I posted was a draft copy.

don't use: /logon/long.

use: /logon/token

so your "edit 0" looks like the correct POST and Body.

A Serialized session is created similiar to a logontoken in the sdk. retrieve the string with

myEnterpriseSession.SerializedSession

first_last
Participant
0 Kudos

Changing the Url from <code>host:port/biprws/logon/long</code> to <code>host:port/biprws/logon/token</code> eliminated the error for the BI Platform 4.2 Support Pack 4 (14.2.4.2410).

Answers (1)

Answers (1)

former_member230921
Active Contributor

If BOE version is 4.2 SP03 + , use version 1 APIs (http://host:port/biprws/v1/logon/token).

first_last
Participant

Returns <code>Invalid logon token: . (FWM 02080)</code> for the BI Platform 4.2 Support Pack 4 (14.2.4.2410).

former_member230921
Active Contributor
0 Kudos

If you are sending serialized session :

<attrs xmlns="http://www.sap.com/rws/bip">
    <attr name="clienttype" type="string"></attr>
    <attr name="logontoken" type="string">put_token_here</attr>
    <attr name="tokentype" type="string" possibilities="token, serializedSession">serializedSession</attr>
</attrs>

former_member230921
Active Contributor
0 Kudos

I am assuming request headers contains:

content-type = "application/xml"

first_last
Participant

Yes, see my comments earlier in the thread.

former_member230921
Active Contributor
0 Kudos

is it happening only with version 1 APIs ?

check this tag value:

<attr name="tokentype" type="string" possibilities="token, serializedSession">serializedSession</attr>