Skip to Content
0

Convert .Net logon token to REST logon token?

Mar 22 at 06:50 PM

72

avatar image

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Daniel Paulsen
Mar 22 at 07:38 PM
2

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/45f5abf06e041014910aba7db0e91070.html

Dan

Show 3 Share
10 |10000 characters needed characters left characters exceeded

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?

0

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

2

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).

0
Bharath B N
Mar 23 at 04:26 AM
2

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

Show 5 Share
10 |10000 characters needed characters left characters exceeded

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

1

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>

0

I am assuming request headers contains:

content-type = "application/xml"

0

Yes, see my comments earlier in the thread.

1

is it happening only with version 1 APIs ?

check this tag value:

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