Search code examples
oraclesoapsoabpel

Problem handling a list of elements in BPEL 2.0 transformation


These are the different versions of my work environment:

Jdeveloper v 11.1.1.6.0

BPEL 2.0

Oracle SOA server

I have a problem when I receive a list of elements in a BPEL transformation step. This transformation is obtaining data from a received SOAP element (from the input of the previous step) and its objective is to generate a new SOAP element, using it as the input of the next step, which communicates with other web service.

This is the structure of the SOAP element which is being received into the transformation:

<NameOfRequest  version="1.0"  lang="es">
<idConv>133</idConv>
<gTram>
    <ns2:tipo>TIPO1</ns2:tipo>
    <ns2:anyo>2018</ns2:anyo>
    <ns2:numero>1</ns2:numero>
</gTram>
<ns8:solicitud>
    <ns3:idSolicitud>2</ns3:idSolicitud>
</ns8:solicitud>
<ns8:solicitud>
    <ns3:idSolicitud>1</ns3:idSolicitud>
</ns8:solicitud>
</NameOfRequest>

In addition, the following one is the XSD structure which follows the Request:

<xsd:complexType name="ComunicarAltaBdnsBySolicitudesRequestType_v1.0">
    <xsd:complexContent>
        <xsd:extension base="cm:RequestMessageBaseType_v1.0">
            <xsd:sequence>
                <xsd:element name="idConv" type="xsd:long" nillable="false"/>
                <xsd:element name="gTram" type="cgt:CodigoGrupoTramitacionType_v1.0" nillable="false" minOccurs="1"/>
                <xsd:element name="solicitud" type="cso:CodigoSolicitudType_v1.0" minOccurs="1" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="CodigoSolicitudType_v1.0">
        <xsd:sequence>
            <xsd:element name="idSolicitud" minOccurs="1" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>

I need to copy all the elements called solicitud into another SOAP structure (for a new request, after the current transformation).

I tried different procedures in the transformation step (for each, copy, copyList, append, etc.) but I'm not able to copy all the repetitions of solicitud elements. I tried even copying the content into a new variable an then assigning this variable to the target list.

The most positive result I achieved was to copy only one of the solicitud elements into the new SOAP call... but it's not enough for my purpose.

Any idea about how to copy all the elements?

Thanks in advance!


Solution

  • I solved the problem using the Transformation step instead of the Assign step.

    The correct procedure is the following one:

    1. Insert a new Transformation into the BPEL process.

    2. Select the input (sources) and the output (target) and create a new XSL file from the right buttons (the one which is a green +).

    3. Open the new XSL file and display all the elements from the source (on the left) and the target (on the right). This action is very important, if a part of the source data or the target data is not displayed, the elements will not be linked, generating a bad mapping.

    4. Link the elements form the source to the target and select YES if an auto-map message appears on the screen. This will insert for-each elements into the target part, copying all the elements of the source list into the target.

    Working in that way allows to copy elements with lists, which is not supported using the Assing operation of the BPEL.

    Hope it helps!