Forum Stats

  • 3,770,167 Users
  • 2,253,079 Discussions
  • 7,875,357 Comments

Discussions

Oracle SOA 12c REST Service consumption shows bad request

User_XRB76
User_XRB76 Member Posts: 17 Red Ribbon
edited Oct 5, 2018 7:02AM in SOA Suite Discusssions

Hello,

I have developed a simple composite to consume a REST service using JDeveloper 12.2.1.3. The setup using the REST adapter wizard is attached. I have one template parameter 'IntId ' which is based on expression - $msg.request/pns:IntId. I am passing value to this in the BPEL component through the assign activity.

This fails with below error

<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>URL request parameter IntId cannot be used in this context.</detail></part></bindingFault></bpelFault>

1. Is using the assign activity the right way to pass the value to 'IntId ' ?

2. If I modify the URI to have query parameters, how to pass the values at run time ?

I have attached the relevant security policy as well. Please provide pointers to address the issue.

Thanks,

Ashwin

Tagged:
User_XRB76

Best Answer

  • RakeshKr
    RakeshKr Member Posts: 401 Silver Badge
    edited Oct 5, 2018 6:14AM Accepted Answer

    For simple JSON, mapping is quite easy. Lets say you get something like this in response:

    {
      "message": "success",
      "poNumber": "1234"
    }

    Your response JSON variable is varJSONResponse and you have a xml variable varXMLString.

    Put an assign activity after the invoke. In the assign select "javascript" as Expression Language. Map varJSONResponse to varXMLString. After the mapping in the From you will see "process.varJSONResponse", double click on that and add "poNumber" in the end. It will be "process.varJSONResponse.poNumber" -> "varXMLString". You got the poNumber mapped.

    Now if you have a complex JSON with arrays and all, you can use the "Translate" activity to translate native JSON to XML.

    User_XRB76User_XRB76
«1

Answers

This discussion has been closed.