Calling Web Services with HTTP Basic Authentication from BPEL & BPMN — oracle-tech

    Forum Stats

  • 3,702,040 Users
  • 2,239,552 Discussions
  • 7,835,730 Comments

Discussions

Calling Web Services with HTTP Basic Authentication from BPEL & BPMN

Maroof AhmadMaroof Ahmad Posts: 118
edited April 2018 in SOA & Process Management

Hi All,

I am using SOA 12c rest adapter to call Rest Java Services. Rest java services are secured with Basic Auth, I want to pass user id and password when invoking rest service Since the password is encrypted i am decrypting password before invoking services.

How can i pass user and password for secured rest service from BPEL and BPMS services?

Regards,

Maroof

Tagged:
Martien van den Akker

Best Answer

  • Maroof AhmadMaroof Ahmad Posts: 118
    edited April 2018 Accepted Answer

    Hi Guys,

    I am updating this thread for other guys ease, whoever having the same issue can try later.

    My requirement was passing basic authentication while invoking rest adapter from BPEL. For this issue, I did below.

    rest.binding.http.Authorization = 'Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk'

    Since for basic authentication, u have to send base64encoded user and password instead of plain user and password.

    "Basic" will be hardcoded and dGVzdHVzZXI6dGVzdHBhc3N3b3Jk is encoded Base64Encode which equivalent to testuser:testpassword

    Use https://www.base64encode.org/ for encoding decoding base64 bit.

    If you encode testuser:testpassword you will get dGVzdHVzZXI6dGVzdHBhc3N3b3Jk

    See image

    oracle community.JPG

    Martien van den Akker

Answers

  • Martien van den AkkerMartien van den Akker Posts: 2,756 Bronze Crown
    edited March 2018

    Hi Maroof,

    I found this as a good explanation: https://stackoverflow.com/questions/47081479/bpel-12c-call-webservices-with-basic-authentication

    But actually, you could just set a WSM policy. But I believe it only allows basic authentication over ssl.

    Regards,

    Martien

  • Maroof AhmadMaroof Ahmad Posts: 118
    edited April 2018

    Hi Martien,

    the above link is for SOAP Adapter, i am looking solution for Rest services and also want to pass user id and password from invoke activity. I have encrypted password which i decrypt before invoking service using another common service.

    Regards,

    Maroof

  • Maroof AhmadMaroof Ahmad Posts: 118
    edited April 2018
    Hi,

    In invoke properties, I passed below and its worked fine, but Authorization value I copied from SOAPUI, this one is created when i called rest java services with basic credentials.

    rest.binding.http.Authorization = 'Basic dGVzdHVzZXI6c2xpY2V0ZXN0MTIzNDU='

    My objective to pass actual user and password when i am invoking rest java services.

    Regards,
    Maroof

  • Martien van den AkkerMartien van den Akker Posts: 2,756 Bronze Crown
    edited April 2018

    Hi Maroof,

    I didn't try it myself, but I guess that it is essentially the same for SOAP and REST, since it is in fact part of the http protocol.

    Regards,
    Martien

  • Maroof AhmadMaroof Ahmad Posts: 118
    edited April 2018 Accepted Answer

    Hi Guys,

    I am updating this thread for other guys ease, whoever having the same issue can try later.

    My requirement was passing basic authentication while invoking rest adapter from BPEL. For this issue, I did below.

    rest.binding.http.Authorization = 'Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk'

    Since for basic authentication, u have to send base64encoded user and password instead of plain user and password.

    "Basic" will be hardcoded and dGVzdHVzZXI6dGVzdHBhc3N3b3Jk is encoded Base64Encode which equivalent to testuser:testpassword

    Use https://www.base64encode.org/ for encoding decoding base64 bit.

    If you encode testuser:testpassword you will get dGVzdHVzZXI6dGVzdHBhc3N3b3Jk

    See image

    oracle community.JPG

    Martien van den Akker
This discussion has been closed.