Forum Stats

  • 3,814,623 Users
  • 2,258,892 Discussions
  • 7,892,787 Comments

Discussions

Rest adapter not supporting SubstitutionGroup in OSB

Prasanna G
Prasanna G Member Posts: 96 Blue Ribbon
edited Mar 28, 2019 7:31PM in SOA Suite Discusssions

Hi All,

I have a requirement of using a schema with SubstitutionGroup and expose a REST service (with the same schema) using Rest adapter in OSB 12.2.1.3

But I see that the Rest adapter works fine when xml is given as input, but when JSON is given as input, the substitution element behaves wierdly. Please find more details below.

XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="Input" type="input_Type"/>

  <xs:complexType name="input_Type">

    <xs:all>

      <xs:element name="firstName" type="xs:string"/>

      <xs:element ref="countryDtls"/>

    </xs:all>

  </xs:complexType>

 

  <xs:element name="countryDtls" abstract="true"/>

   <xs:element name="usa" type="usa_Type" substitutionGroup="countryDtls"/>

   <xs:element name="india" type="india_Type" substitutionGroup="countryDtls"/>    

  <xs:complexType name="usa_Type">

    <xs:all>

      <xs:element name="addr1" type="xs:string"/>

      <xs:element name="zip" type="xs:string"/>

    </xs:all>

  </xs:complexType>

 

  <xs:complexType name="india_Type">

    <xs:all>

      <xs:element name="addr1" type="xs:string"/>

      <xs:element name="pincode" type="xs:string"/>

    </xs:all>

  </xs:complexType>

</xs:schema>

countryDtls element is substituted with usa/india elements.

I created a REST proxy in OSB and used the above schema as input. I tested the REST adapter with the following xml and it processed further.

Working -

<Input>

    <firstName>str1234</firstName>

    <usa>

        <addr1>Apt 1A Miamisburg</addr1>

        <zip>45638</zip>

    </usa>

</Input>

But when I test the same above input in JSON format, the usa section is wiped off, when the input is logged in the pipeline. Note: JSON is enabled in the proxy input.

Input JSON:

{

  "Input": {

    "firstName": "str1234",

    "usa": {

      "addr1": "Apt 1A Miamisburg",

      "zip": "45638"

    }

  }

}

What I see in the pipeline for the above JSON is as follows. The entire substitutionGroup element is wiped out when JSON is passed as input.

<Input>

    <firstName>str1234</firstName>

</Input>

Can you please help me understand if Substitution Group is even supported in REST adapter for JSON.

Thanks,

Prasanna

Tagged:
3419415Prasanna G

Answers