oracle-soa

Oracle SOA - Invoking a service with x-form-urlencoded


Need your help!

Goal: Invoke an API that will generate a token with body type as x-form-urlencoded.

Result: 400-Bad request

What we done so far is the ff:

  1. Indicate in the invoke property (to) that Content-Type : apppication/x-form-urlencoded.
  2. Assign the value of grant_type and assertion in a variable like below.

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiAiM01WRzlMekt4YTQzenFkSWR4TGJaRVlQOUFnMzNOS0FGcVJ6aDdRM21hTWRJSjAwVmxMakI4bE5oaFRMN0M1Tm1OT0M4eUN6c1F1RUdEbVlVcTVzVyIsICJzdWIiOiAisdasdbi5sb3JlbnpvQGhvZWdoLmNvbS5zb2FhdXRoIiwgImF1ZCI6ICJodHRwczovL3Rlc3Quc2FsZXNmb3JjZS5jb20iLCAiZXhwIjogIjE2Mjk5NDQwMDcifQ.JiAEVW0sP96If24-oYTiCVMK8oyDlo_xfT4Yei44AYAwH0trfRtJCDZOsuDdOLkdAz0kRValqrPcOuPzPIfyWtrSAHU0bUWwmAc9XK5pV4MLgfKuZ_AfkLSygdu0Z9Tk9eG4WYyj953STNY316vTXQwa_uWG

  1. In the trace. & is converted to '&' not sure if this is the issue here. We are sure that the assertion key is valid tried it by postman/soapui to call the api.

<messages><input> <urlEncoded><urlEncoded xmlns:def="http://www.w3.org/2001/XMLSchema" xsi:type="def:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&amp;amp;assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiAiM01WRzlMekt4YTQzenFkSWR4TGJaRVlQOUFnMzNOS0FGcVJ6aDdRM21hTWRJSjAwVmxMakI4bE5oaFRMN0M1Tm1OT0M4eUN6c1F1RUdEbVlVcTVzVyIsICJzdWIiOiAiam9obi5sb3JlbnpvQGhvZWdoLmNvbS5zb2FhdXRoIiwgImF1ZCI6ICJodHRwczovL3Rlc3Quc2FsZXNmb3JjZS5jb20iLCAiZXhwIjogIjE2Mjk5NDQwMDcifQ.JiAEVW0sP96If24-oYTiCVMK8oyDlo_adadsAwH0trfRtJCDZOsuDdOLkdAz0kRValqrPcOuPzPIfyWtrSAHU0bUWwmAc9XK5pV4MLgfKuZ_AfkLSygdu0Z9Tk9eG4WYyj953STNY316vTXQwa_uWGAb2bsfVWWX1Jvdjwc3oSGtKfZl4IaVVAvIYnVWVrTgrY80M0LQhDBp5UKkTzI-Mam_NaRN30GFlwrJipwFPgm8t-eJ__FU-srpLO4LZG5FBseUOLVtnmrDlxPm7l_i8ee8vKTzNvgySLt0hVC4C1e51xFY4OSkNMa6E3jF-YnEkJJERMW82fFozalg</urlEncoded></urlEncoded></input><fault> <bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Bad Request</summary></part><part name="code"><code>400</code></part><part name="detail"><detail>{"error":"unsupported_grant_type","error_description":"grant type not supported"}</detail></part></bindingFault></bpelFault></fault><faultType> <message>0</message></faultType></messages>

  1. Additionally, we also tried wrapping the grant type and assertion in cdata using toCdata of oracle but no luck!!! argh!

<messages><input> <urlEncoded><urlEncoded xmlns:def="http://www.w3.org/2001/XMLSchema" xsi:type="def:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><![CDATA[grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiAiM01WRzlMekt4YTQzenFkSWR4TGJaRVlQOUFnMzNOS0FGcVJ6aDdRM21hTWRJSjAwVmxMakI4bE5oaFRMN0M1Tm1OT0M4eUN6c1F1RUdEbVlVcTVzVyIsICJzdWIiOiAiam9obi5sb3JlbnpvQGhvZWdoLmNvbS5zb2FhdXRoIiwgImF1ZCI6ICJodHRwczovL3Rlc3Quc2FsZXNmb3JjZS5jb20iLCAiZXhwIjogIjE2Mjk5NDUwMzkifQ.oi4LFRjX_iF-9tRCzvlLO-JJLg4xMDMnLSHXCz627LqYaC0UqYe2gsUEPZJ8Wpa-5SyosWJLkAp7T98Bpy-JqHni5jL4Ef50zsJ8gXloThhdB3LIMsQ3nZ4tpoP_4tYoa8Tc90oma3hlbZ_9GnGh19oy3eLsxr0odZA5cEFWwyxs20vb4XJ0za0RxeO3-bcH2M9k904mzTPZVM4x7MqJW--EHYhaLwYJj__HHsLvpFI6iP0vcc1FcTbjbDZsvBsMS_F5L6RYbOiua2rTV4FHdqi085-x_qms2yEMxhGdYSZFEIMzaoe9TMYpWIMZ34Dfjj84t0bCIXWL5ZVfdH3tcQ]]></urlEncoded></urlEncoded></input><fault> <bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Bad Request</summary></part><part name="code"><code>400</code></part><part name="detail"><detail>{"error":"unsupported_grant_type","error_description":"grant type not supported"}</detail></part></bindingFault></bpelFault></fault><faultType> <message>0</message></faultType></messages>

Anyyyy suggestions/recommendation?


Solution

  • Solution:

    1. In the reference swim lane, ensure that in request payload the url-encoded is selected. add grant_type, and assertion as query param.
    2. In the bpel, invoke > property tab, select rest.query.grant_type value is urn:ietf:params:oauth:grant-type:jwt-bearer . do the same process in assertion.