Search code examples
oracle-databasexsdsoabpel

Appending multiple strings in Oracle SOA Suit in a BPEL process


I'm new to the Oracle SOA Suite and I have created a basic BPEL process that allows you to create a "User" with some basic values.

XSD:

//INPUT
<element name="User">
    <complexType>
        <sequence>
            <element name="First_Name" type="string"/>
            <element name="Last_Name" type="string"/>
            <element name="Age" type="string"/>
            <element name="DOB" type="string"/>
        </sequence>
    </complexType>
</element>
// String to output
<element name="processResponse">
    <complexType>
        <sequence>
             <element name="Output" type="string"/>
        </sequence>
    </complexType>
</element>

So using this XSD I want to be able to create a user, and append all the values together and create a response/reply with my synchronous BPEL process.

I've tried simply adding all the values together using the '+' operation but doesn't work as it tries to cast it it a integer, so it seems and the value comes out as "Jon NaN".

  <copy>
    <from>concat("Hello! ", $inputVariable.payload/ns1:Last_Namel)</from>
    <to>$outputVariable.payload</to>
  </copy>

I've also tried to use multiple concat's but it get's real ugly real quick, and something i would like to avoid is messy code.

So as a summary i want to be able to take all the input values (First Name, Last Name, Age, DOB) and convert them into a nice string with some padding and extra hard coded strings to show a nice message at the end.


Solution

  • Give all the values which you require to be concatenated comma separated in the concat() function:

    <from>concat('Hello! ', $inputVariable.payload/ns1:Last_Name,' ',$inputVariable.payload/ns1:First_Name,' ',$inputVariable.payload/ns1:Age,' ',$inputVariable.payload/ns1:DOB)</from>
    
    <to>$outputVariable.payload/Output</to>