Question

I am building a BPEL process that takes an itinerary as input: this is made of an unbounded list of elements and some attributes.
The task of the process is to go over every element of the list "booking" it, assign some value to the attributes, and then return the itinerary.
Each of those elements is itself made of two elements: some information for the booking process (which works fine) and the specific object, which might be a flight or a hotel. I tried defining that element like so:

<xsd:complexType name="ObjectType" abstract="true">
    <xsd:sequence>
        <xsd:element name="objType" type="xsd:string"></xsd:element>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="FlightType">
    <xsd:complexContent>
        <xsd:extension base="tns:ObjectType">
            <xsd:sequence>
                <xsd:element name="departureCity" type="xsd:string"></xsd:element>
                <xsd:element name="arrivalCity" type="xsd:string"></xsd:element>
                <xsd:element name="departureTime" type="xsd:dateTime"></xsd:element>
                <xsd:element name="arrivalTime" type="xsd:dateTime"></xsd:element>
                <xsd:element name="airline" type="xsd:string"></xsd:element>
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="ItineraryReservationType">
    <xsd:sequence>
        <xsd:element name="object" type="tns:ObjectType"></xsd:element>
        <xsd:element name="reservation" type="tns:ReservationType"></xsd:element>
    </xsd:sequence>
</xsd:complexType>

and then using them in a CompositeApplication with this kind of input

    <urn:itineraryReservation>
      <urn:flight>
        <urn:objType>flight</urn:objType>
        <urn:departureCity>Ottawa</urn:departureCity>
        <urn:arrivalCity>Toronto</urn:arrivalCity>
        <urn:departureTime>2007-10-26T08:36:28</urn:departureTime>
        <urn:arrivalTime>2004-02-14T19:44:14</urn:arrivalTime>
        <urn:airline>Aircanada</urn:airline>
      </urn:flight>
      <urn:reservation>
        <urn:price>3</urn:price>
      </urn:reservation>
    </urn:itineraryReservation>

but whenever the process reaches the last assign and tries to copy the itinerary element to output it I get a Particle not found in the complex type. element={urn:ws.bpelschema}flight, complexType={urn:ws.bpelschema}ItineraryReservationType.
The obvious alternative is to carry two lists around, one for flights and one for hotels, but I thought things could be better and couldn't find anything on this topic.
Thanks for helping!

Was it helpful?

Solution

The problem with your XML, as far as I can tell from the XML Schema snippets, is that instead of <urn:flight> you're supposed to use <urn:object xsi:type="urn:FlightType">; all should be fine then. Unless your intent was to use substitution groups... Again hard to tell from the XSD snippet.

My best advice for this type of problems is to recommend to have an XML sample file generated from your validated XML Schema, by a tool. It should provide you with a visualization of what a valid XML should look like, and from there it should be easy for anyone to code for that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top