cancel
Showing results for 
Search instead for 
Did you mean: 

B1if - httpCall atom with OAuth authorization for getting XML data from a server with a token

fulopl
Explorer
0 Kudos

Hi Experts,

I have created a simple B1if scenario with a httpCall atom, but I have an issue on how to configure the oauth authorisation.

I would like to achieve is the following call:

     GET https://www.domain.com/path/to/reports?param1=25&user=ALL&param2=2 HTTP/1.1

     Authorization: OAuth xyzoauthencriptedtokentoaccessthedata=

     Content-Type: application/xml

I am trying the following parameters in the atom2.xml -> which is the automatically created atom for my httpCall atom.

<connect>

     <destProtocol>https</destProtocol>

     <destHost>www.domain.com</destHost>

     <destPort>443</destPort>

     <destPath>/path/to/reports</destPath>

     <query/>

     <proxyHost/>

     <proxyPort/>

     <method>GET</method>

     <authentification>basic</authentification>   <!-- but I'm not sure in this, under the header I added the token... -->

     <user/>

     <password/>

     <user2query/>

     <password2query/>

     <trustStoreURI/>

     <keyStoreURI/>

</connect>

..


..

<htta>

          <par id="httpheader.???" value="">
               <!-- optional - you can specify here your own http header definitions - multiple elements allowed -->
             Authorization: OAuth oauth_token=xyzoauthencriptedtokentoaccessthedata=

         </par>

         ..


Is here anyone who have managed to make something similar to work?


The other question where and how to put the query parameters? (?param1=25&user=ALL&param2=2)


In advance thank you for your help.

Laszlo

Accepted Solutions (1)

Accepted Solutions (1)

bastian_schaefer
Active Contributor
0 Kudos

Hi Laszlo,

if you already have the token, you can hand it over as query, if you need a complete token process you need to manually handle it a the moment using the persist atom to store it in the bizstore for later usage.

Please compare with B1i help "Call HTTP Atom" usage of query id:


<query id="identifier" value="value"/>

<!--optional - define your own query parameters - multiple elements allowed-->

query id

Enter query strings for your call.

If you want to handover URL parameters containing special characters, you must URL encode the string. The integration framework provides the encode Java function in the utils2 namespace. To ensure that the function works correctly, cast the string with the string XPath function.

Define the call as follows:

<call>

     <xsl:variable name="var">{"myPar":"myVal"}</xsl:variable>

     <query id="json" value="{utils2:encode(string($var))}"/>

            ...

</call>

If the queries are fixed and you use the SLD entry for your HTTP connection settings, you could also enter them in the segment query using the following notation:


query

Enter the query strings, separated by semicolon. Do not add ?.

Best regards

Bastian

P.S.: A full automatic token process supporting Outh is not yet part of or http adapter, but we enhanced our http adapter to be able to communicate with the B1 Service Layer for HANA (based on a customized Outh protocol) with Framework version 1.22.1. This could maybe an option to avoid the manual token process for your requirement, too.

fulopl
Explorer
0 Kudos

Thanks for the help Bastian!

At the end I made a simple JSP page which gets the XML from the server with the given oauth token, and from the B1if atom I am just calling my page.  

So at the end the connection setting is just this:

<destProtocol>http</destProtocol>

<destHost>127.0.0.1</destHost>

<destPort>8080</destPort>

<destPath>/MyIntegration/getData.jsp</destPath>

<query/>

<proxyHost/>

<proxyPort/>

<method>GET</method>

<authentification/>


Thanks again!

Laszlo

Answers (0)