Skip to Content

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Oct 15, 2015 at 09:47 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.